Update web-platform-tests to revision 7a7e16ad8d1a1b843340f47101c0a5c24c9bba57

This commit is contained in:
WPT Sync Bot 2019-04-23 21:37:32 -04:00
parent 155fad62b3
commit d4dc41672a
207 changed files with 3287 additions and 1703 deletions

View file

@ -22,4 +22,14 @@
});
window.open(`resources/portals-adopt-predecessor.html?test=${test}`);
}, "Tests that trying to adopt the predecessor twice will throw an exception.");
async_test(function(t) {
var test = "adopt-after-event";
var bc = new BroadcastChannel(`test-${test}`);
bc.onmessage = t.step_func_done(function(e) {
assert_equals(e.data, "passed");
bc.close();
});
window.open(`resources/portals-adopt-predecessor.html?test=${test}`);
}, "Tests that trying to adopt the predecessor after the PortalActivateEvent will throw an exception.");
</script>

View file

@ -4,21 +4,41 @@
var test = searchParams.get("test");
window.onportalactivate = function(e) {
var portal = e.adoptPredecessor();
document.body.appendChild(portal);
if (test == "adopt-once") {
var portal = e.adoptPredecessor();
document.body.appendChild(portal);
if (portal instanceof HTMLPortalElement) {
portal.postMessage("adopted", "*");
}
}
if (test == "adopt-twice") {
var portal = e.adoptPredecessor();
document.body.appendChild(portal);
try {
e.adoptPredecessor();
} catch(e) {
portal.postMessage("passed", "*");
if (e.name == "InvalidStateError") {
var bc_test = new BroadcastChannel(`test-${test}`);
bc_test.postMessage("passed");
bc_test.close();
}
}
}
if (test == "adopt-after-event") {
setTimeout(function() {
try {
e.adoptPredecessor();
} catch(e) {
if (e.name == "InvalidStateError") {
var bc_test = new BroadcastChannel(`test-${test}`);
bc_test.postMessage("passed");
bc_test.close();
}
}
});
}
}
var bc = new BroadcastChannel(`portal-${test}`);