Bug 1518222 [wpt PR 14740] - Portals: Add support for PortalActivateEvent., a=testonly

Automatic update from web-platform-tests
Portals: Add support for PortalActivateEvent.

This event is dispatched on the portal Window when it is activated.

Bug: 914122
Change-Id: I4fa3117e1684c8f1d4ead95f62a7285978afaca2
Reviewed-on: https://chromium-review.googlesource.com/c/1396449
Commit-Queue: Lucas Gadani <lfg@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621708}

--

wpt-commits: 29de5e8fdb67de6b57342a83c076a49a93f0e7cf
wpt-pr: 14740
This commit is contained in:
Lucas Furukawa Gadani 2019-01-31 18:30:49 +00:00 коммит произвёл James Graham
Родитель 8f68c0d0bc
Коммит 9c978c8e50
3 изменённых файлов: 38 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,14 @@
<!DOCTYPE html>
<title>Tests that the PortalActivateEvent is dispatched when a portal is activated</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function(t) {
var bc = new BroadcastChannel("test");
bc.onmessage = t.step_func_done(function(e) {
assert_equals(e.data, "passed");
bc.close();
});
window.open("resources/portal-activate-event-window.html");
}, "Tests that the PortalActivateEvent is dispatched when a portal is activated.");
</script>

Просмотреть файл

@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>Tests that the PortalActivateEvent is dispatched when a portal is activated</title>
<script>
window.addEventListener("portalactivate", function(e) {
var bc = new BroadcastChannel("test");
bc.postMessage("passed");
bc.close();
});
var bc = new BroadcastChannel("portal");
bc.postMessage("loaded");
bc.close();
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<script>
var bc = new BroadcastChannel("portal");
bc.onmessage = function(e) {
document.querySelector("portal").activate();
bc.close();
}
</script>
<body>
<portal src="portal-activate-event-portal.html"></portal>
</body>