Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851

This commit is contained in:
WPT Sync Bot 2019-03-06 20:32:15 -05:00
parent 55347aa39f
commit bf84a079f9
1983 changed files with 58006 additions and 31437 deletions

View file

@ -0,0 +1,54 @@
<!DOCTYPE html>
<!--
Tentative due to:
https://github.com/whatwg/html/issues/4364
-->
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
</head>
<body>
<h1>User activation can be transferred to a cross-origin child frame via a postMessage option.</h1>
<ol id="instructions">
<li>Click this instruction text.
</ol>
<iframe id="child" width="200" height="200"></iframe>
<script>
async_test(function(t) {
var child = document.getElementById("child");
assert_false(navigator.userActivation.isActive);
assert_false(navigator.userActivation.hasBeenActive);
window.addEventListener("message", t.step_func(event => {
var msg = JSON.parse(event.data);
if (msg.type == 'child-four-loaded') {
// state should be false after load
assert_false(msg.isActive);
assert_false(msg.hasBeenActive);
// click in parent document
test_driver.click(document.getElementById('instructions'));
} else if (msg.type == 'child-four-report') {
assert_true(msg.isActive);
assert_true(msg.hasBeenActive);
assert_false(navigator.userActivation.isActive);
assert_false(navigator.userActivation.hasBeenActive);
t.done();
}
}));
window.addEventListener("click", t.step_func(event => {
assert_true(navigator.userActivation.isActive);
assert_true(navigator.userActivation.hasBeenActive);
// transfer user activation to the child frame
child.contentWindow.postMessage("transfer_user_activation", {targetOrigin: "*", transferUserActivation: true});
}));
child.src = "http://{{domains[www]}}:{{ports[http][0]}}/html/user-activation/resources/child-four.html";
}, "Cross-origin user activation transfer through postMessages");
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!DOCTYPE html>
<!--
Tentative due to:
https://github.com/whatwg/html/issues/4364
-->
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
</head>
<body>
<h1>User activation can be transferred to a child frame via a postMessage option.</h1>
<ol id="instructions">
<li>Click this instruction text.
</ol>
<iframe id="child" width="200" height="200"></iframe>
<script>
async_test(function(t) {
var child = document.getElementById("child");
assert_false(navigator.userActivation.isActive);
assert_false(navigator.userActivation.hasBeenActive);
window.addEventListener("message", t.step_func(event => {
var msg = JSON.parse(event.data);
if (msg.type == 'child-four-loaded') {
// state should be false after load
assert_false(msg.isActive);
assert_false(msg.hasBeenActive);
// click in parent document
test_driver.click(document.getElementById('instructions'));
} else if (msg.type == 'child-four-report') {
assert_true(msg.isActive);
assert_true(msg.hasBeenActive);
assert_false(navigator.userActivation.isActive);
assert_false(navigator.userActivation.hasBeenActive);
t.done();
}
}));
window.addEventListener("click", t.step_func(event => {
assert_true(navigator.userActivation.isActive);
assert_true(navigator.userActivation.hasBeenActive);
// transfer user activation to the child frame
child.contentWindow.postMessage("transfer_user_activation", {transferUserActivation: true});
}));
child.src = "resources/child-four.html";
}, "User activation transfer through postMessages");
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!DOCTYPE html>
<!--
Tentative due to:
https://github.com/whatwg/html/issues/4364
-->
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>User activation transfer request from an inactive frame is ignored.</h1>
<iframe id="child" width="200" height="200"></iframe>
<script>
async_test(function(t) {
var child = document.getElementById("child");
var is_page_loaded = false;
var is_child_four_loaded = false;
assert_false(navigator.userActivation.isActive);
assert_false(navigator.userActivation.hasBeenActive);
function tryPostMessaging() {
if (is_page_loaded && is_child_four_loaded)
child.contentWindow.postMessage("transfer_user_activation", {transferUserActivation: true});
}
window.addEventListener("message", t.step_func(event => {
var msg = JSON.parse(event.data);
if (msg.type == 'child-four-loaded') {
// state should be false after load
assert_false(msg.isActive);
assert_false(msg.hasBeenActive);
is_child_four_loaded = true;
tryPostMessaging();
} else if (msg.type == 'child-four-report') {
assert_false(msg.isActive);
assert_false(msg.hasBeenActive);
assert_false(navigator.userActivation.isActive);
assert_false(navigator.userActivation.hasBeenActive);
t.done();
}
}));
window.addEventListener("load", function(event) {
is_page_loaded = true;
tryPostMessaging();
});
child.src = "resources/child-four.html";
}, "User activation transfer from inactive frame");
</script>
</body>
</html>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<body style="background: lightgrey;">
<script>
window.parent.postMessage(JSON.stringify({"type": "child-four-loaded", "isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive}), "*");
window.addEventListener("message", event => {
if (event.source === window.parent && event.data == "transfer_user_activation") {
window.parent.postMessage(JSON.stringify({"type": "child-four-report", "isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive}), "*");
}
});
</script>
</body>