Bug 1453952 [wpt PR 10456] - Reland: Use PostTask to schedule cross-process postMessage forwarding., a=testonly
authorAlex Moshchuk <alexmos@chromium.org>
Sun, 22 Apr 2018 15:03:24 +0000
changeset 468873 8fee71d393903989b19422c2b592236e6806d9e0
parent 468872 846bc7887b927295a8c7d2f51f5e486394171970
child 468874 b5a7874d1f31011fc3ffc401ad16a05f546edb8d
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1453952, 10456, 999182, 832319, 828529, 550284, 1011287, 550621
milestone61.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 1453952 [wpt PR 10456] - Reland: Use PostTask to schedule cross-process postMessage forwarding., a=testonly Automatic update from web-platform-testsReland: Use PostTask to schedule cross-process postMessage forwarding. Changes from original attempt at https://crrev.com/c/999182: - fix flakiness in two additional ChromeOS login tests - fix CSP WPT tests to not depend on ordering between iframe's onload and postMessage - see https://crbug.com/832319. Previously, we sent the IPC to forward a cross-process postMessage immediately. This caused a behavioral difference from the same-process case where the postMessage is always scheduled. Namely, in a scenario like this: frame.postMessage(...); doSomethingThatSendsIPCsToFrame(frame); the IPCs from JS following the postMessage would've been ordered incorrectly, causing |frame| to see their side effects after the postMessage dispatch in the cross-process case, whereas they would be seen before the postMessage dispatch in the same-process case. One example of this is frame.focus(), and another is a frame element onload event (dispatched via FrameHostMsg_DispatchLoad) arriving after a postMessage dispatched from an inline script while the frame was still loading. To resolve these ordering concerns, this CL changes cross-process postMessage to do a PostTask on the sender side before sending the message to the browser process. This improves the current state of the world, but does not yet achieve a perfect match for the IPC ordering in the same-process case - see discussion on the bug. Bug: 828529 Change-Id: I62a627c501526d09900be4f5bd2c899acf4d1e07 Reviewed-on: https://chromium-review.googlesource.com/999182 Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Alex Moshchuk <alexmos@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#550284} Reviewed-on: https://chromium-review.googlesource.com/1011287 Cr-Commit-Position: refs/heads/master@{#550621} -- wpt-commits: f281334c36847064b75740239882e2684aee0437 wpt-pr: 10456
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/content-security-policy/embedded-enforcement/support/testharness-helper.sub.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -423628,17 +423628,17 @@
    "363e06143474e3a3941fe4b96631146902351aff",
    "support"
   ],
   "content-security-policy/embedded-enforcement/support/echo-required-csp.py": [
    "8d73332cdc154e05cdfa936d3f6b936b9c0ebdba",
    "support"
   ],
   "content-security-policy/embedded-enforcement/support/testharness-helper.sub.js": [
-   "23feae559098474ba96b15f07619b9d7dba12dec",
+   "3f5930842625b190576a163cbe1a01aa8fc4c086",
    "support"
   ],
   "content-security-policy/font-src/font-match-allowed.sub.html": [
    "4bc23af2a5a3280630e50cc4c35a9769e499b7a6",
    "testharness"
   ],
   "content-security-policy/font-src/font-mismatch-blocked.sub.html": [
    "274372eb59cca6e399d8c786d7a0f443c6f35254",
--- a/testing/web-platform/tests/content-security-policy/embedded-enforcement/support/testharness-helper.sub.js
+++ b/testing/web-platform/tests/content-security-policy/embedded-enforcement/support/testharness-helper.sub.js
@@ -133,18 +133,24 @@ function assert_iframe_with_csp(t, url, 
     // Assert iframe loads with an expected violation.
     window.addEventListener('message', t.step_func(e => {
       if (e.source != i.contentWindow)
         return;
       assert_equals(e.data["blockedURI"], blockedURI);
       t.done();
     }));
   } else {
-    // Assert iframe loads.
+    // Assert iframe loads.  Wait for both the load event and the postMessage.
+    window.addEventListener('message', t.step_func(e => {
+      if (e.source != i.contentWindow)
+        return;
+      assert_true(loaded[urlId]);
+      if (i.onloadReceived)
+        t.done();
+    }));
     i.onload = t.step_func(function () {
-      // Delay the check until after the postMessage has a chance to execute.
-      setTimeout(t.step_func_done(function () {
-        assert_true(loaded[urlId]);
-      }), 1);
+      if (loaded[urlId])
+        t.done();
+      i.onloadReceived = true;
     });
   }
   document.body.appendChild(i);
 }