Bug 1518222 [wpt PR 14740] - Portals: Add support for PortalActivateEvent., a=testonly
authorLucas Furukawa Gadani <lfg@chromium.org>
Thu, 31 Jan 2019 18:30:49 +0000
changeset 457950 d3aea0b0ff9c3f08a931992bc9289de144c26611
parent 457949 4aae84fccf6e629617f0f3537b74ca819c34b77f
child 457951 46cc96f83b8ec6158c93597d8395992040d4a3e7
push id35518
push useropoprus@mozilla.com
push dateFri, 08 Feb 2019 09:55:14 +0000
treeherdermozilla-central@3a3e393396f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1518222, 14740, 914122, 1396449, 621708
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
testing/web-platform/tests/portals/portal-activate-event.html
testing/web-platform/tests/portals/resources/portal-activate-event-portal.html
testing/web-platform/tests/portals/resources/portal-activate-event-window.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/portals/portal-activate-event.html
@@ -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>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/portals/resources/portal-activate-event-portal.html
@@ -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>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/portals/resources/portal-activate-event-window.html
@@ -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>