Revision 4e5f09f89e6f1976dd49a57ba46cd447c7e19a1e authored by Alex Moshchuk on 13 April 2018, 15:22:14 UTC, committed by Chromium WPT Sync on 13 April 2018, 15:22:14 UTC
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}
1 parent f90d3d6
Raw File
test_cross_frame_start.html
<!DOCTYPE html>
<html>
  <head>
        <meta charset="utf-8" >
        <title>window.performance.now across frames</title>
        <link rel="author" title="Google" href="http://www.google.com/">
        <link rel="help" href="http://www.w3.org/TR/hr-time/#sec-extenstions-performance-interface">

        <script src="/resources/testharness.js"></script>
        <script src="/resources/testharnessreport.js"></script>

        <script type="text/javascript">
            setup({explicit_done: true});

            var setup_frame = async_test("Setup the frame");

            function start_test() {
              setup_frame.step_timeout(function () {
                var iframe = document.createElement('iframe');
                iframe.id = 'frameContext';
                iframe.onload = finish_test;
                iframe.src = "resources/now_frame.html";
                document.body.appendChild(iframe);
                setup_frame.done();
              }, 1000);
            }

            function finish_test() {
              var childWindow = document.getElementById('frameContext').contentWindow;

              // Verify a positive number is returned for both the frame and parent.
              test(function() { assert_true(window.performance.now() > 0); }, 'parent performance.now() > 0');
              test(function() { assert_true(childWindow.performance.now() > 0); }, 'child performance.now() > 0');

              // Verify that the test properly created the child at least a second after the parent.
              test(function () { assert_true(childWindow.performance.timing.navigationStart > (window.performance.timing.navigationStart + 1000)); },
                                'Child created at least 1 second after parent');

              test(function () {
                var parentNow = window.performance.now();
                var childNow = childWindow.performance.now();
                var childParentSkew = Math.abs(childNow - parentNow);
                assert_true(childParentSkew > 1000, 'Child and parent\'s now()s have different bases (skewed more than 1 second)');

                var childLoadTime = childWindow.performance.timing.loadEventStart - childWindow.performance.timing.navigationStart;
                assert_true(1000 > (childNow - childLoadTime), 'Child\'s now() is based on its document\'s navigationStart');
              }, 'Child and parent time bases are correct');

              done();
            }
        </script>

    </head>
    <body onload="start_test()">
        <h1>Description</h1>
        <p>This test validates the values of the window.performance.now() are based on the current document's navigationStart.</p>
        <div id="log"></div>
    </body>
</html>
back to top