Bug 1526467 [wpt PR 15026] - Portals: Send detach message to browser process for portals, a=testonly
authorAdithya Srinivasan <adithyas@chromium.org>
Tue, 12 Feb 2019 14:08:56 +0000
changeset 459262 09befdcd331f690d9044d82157802f1cc9e2ebbd
parent 459261 d787de09def9dce2b6947288d7e0a59baa0f9c65
child 459263 3150b479cad2d862ee24165adfea42b7ee8e9cff
push id35557
push userdvarga@mozilla.com
push dateFri, 15 Feb 2019 01:42:08 +0000
treeherdermozilla-central@426ca85d2303 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1526467, 15026, 923898, 1430586, 628179
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 1526467 [wpt PR 15026] - Portals: Send detach message to browser process for portals, a=testonly Automatic update from web-platform-tests Portals: Send detach message to browser process for portals We don't currently send a message because the RenderFrameProxy created has no parent (so it looks like a main frame). This ensures that same-origin frames within the portal are also detached. The test added would fail with --enable-leak-detection without this change (the iframe inside the portal would leak). Bug: 923898 Change-Id: I2b56b8e303b40d275976da5ed8a0fdde7726b51c Reviewed-on: https://chromium-review.googlesource.com/c/1430586 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Charlie Reis <creis@chromium.org> Reviewed-by: Lucas Gadani <lfg@chromium.org> Reviewed-by: Jeremy Roman <jbroman@chromium.org> Commit-Queue: Adithya Srinivasan <adithyas@chromium.org> Cr-Commit-Position: refs/heads/master@{#628179} -- wpt-commits: bf09c7c954ec1bf3860448d9db98d040c5ad5354 wpt-pr: 15026
testing/web-platform/tests/portals/portals-cross-origin-load.sub.html
testing/web-platform/tests/portals/resources/portal-cross-origin.sub.html
testing/web-platform/tests/portals/resources/portal-forward-with-broadcast.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/portals/portals-cross-origin-load.sub.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<script>
+  promise_test(async () => {
+    var bc = new BroadcastChannel("portals-cross-origin-load");
+    var receiveMessage = new Promise((resolve, reject) => {
+      bc.onmessage = e => {
+        bc.close();
+        resolve();
+      }
+    });
+    var portal = document.createElement("portal");
+    portal.src = "http://{{hosts[alt][www]}}:{{ports[http][0]}}/portals/resources/portal-cross-origin.sub.html";
+    document.body.appendChild(portal);
+    return receiveMessage;
+  });
+</script>
+</body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/portals/resources/portal-cross-origin.sub.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<body>
+  <script>
+    var iframe = document.createElement("iframe");
+    iframe.src = "http://{{host}}:{{ports[http][0]}}/portals/resources/portal-forward-with-broadcast.html?broadcastchannel=portals-cross-origin-load";
+    iframe.onload = e => {
+      iframe.contentWindow.postMessage("loaded", "*");
+    }
+    document.body.appendChild(iframe);
+  </script>
+</body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/portals/resources/portal-forward-with-broadcast.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<body>
+  <script>
+    function forwardMessage(e) {
+      let broadcastChannel = new BroadcastChannel(new URL(location).searchParams.get('broadcastchannel'));
+      try {
+        broadcastChannel.postMessage(e.data);
+      } finally {
+        broadcastChannel.close();
+      }
+    }
+    window.addEventListener("message", forwardMessage);
+  </script>
+</body>