Changeset 223556 in webkit


Ignore:
Timestamp:
Oct 17, 2017 10:41:28 AM (7 years ago)
Author:
achristensen@apple.com
Message:

de-flakify http/tests/security/cross-frame-access-put.html
https://bugs.webkit.org/show_bug.cgi?id=178371

Reviewed by Tim Horton.

In the iframe, the test was being run after 0ms. Sometimes, the whole iframe hadn't loaded yet,
so window.innerHeight and window.innerWidth were 0 instead of their intended values. This changes
the test to wait for the iframe to finish loading before running the test, then post a message to
the parent to tell it to finish running its test instead of just relying on setTimeout(..., 0) to
always work after the iframe had finished loading.

  • http/tests/security/cross-frame-access-put-expected.txt:
  • http/tests/security/cross-frame-access-put.html:
  • http/tests/security/resources/cross-frame-iframe-for-put-test.html:
  • platform/mac-wk2/TestExpectations:
Location:
trunk/LayoutTests
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r223555 r223556  
     12017-10-17  Alex Christensen  <achristensen@webkit.org>
     2
     3        de-flakify http/tests/security/cross-frame-access-put.html
     4        https://bugs.webkit.org/show_bug.cgi?id=178371
     5
     6        Reviewed by Tim Horton.
     7
     8        In the iframe, the test was being run after 0ms.  Sometimes, the whole iframe hadn't loaded yet,
     9        so window.innerHeight and window.innerWidth were 0 instead of their intended values.  This changes
     10        the test to wait for the iframe to finish loading before running the test, then post a message to
     11        the parent to tell it to finish running its test instead of just relying on setTimeout(..., 0) to
     12        always work after the iframe had finished loading.
     13
     14        * http/tests/security/cross-frame-access-put-expected.txt:
     15        * http/tests/security/cross-frame-access-put.html:
     16        * http/tests/security/resources/cross-frame-iframe-for-put-test.html:
     17        * platform/mac-wk2/TestExpectations:
     18
    1192017-10-17  Alex Christensen  <achristensen@webkit.org>
    220
  • trunk/LayoutTests/http/tests/security/cross-frame-access-put-expected.txt

    r219663 r223556  
    186186ALERT: PASS: window.showModalDialog matched the expected value.
    187187ALERT: PASS: window.stop should be 'function stop() {    [native code]}' and is.
     188ALERT: continue test in parent frame
    188189This test checks cross-frame access security of window attribute setters (rdar://problem/5326791).
    189190
  • trunk/LayoutTests/http/tests/security/cross-frame-access-put.html

    r191423 r223556  
    2020window.targetWindow = window.frames[0];
    2121
     22window.addEventListener("message", test, false);
     23
    2224window.onload = function()
    2325{
     
    2628        testRunner.waitUntilDone();
    2729    }
    28 
    29     // There is code in subframe that runs some tests, and that is scheduled on a zero delay
    30     // timer when the subframe loads. The timer that we schedule here will run after the one
    31     // in subframe, making the order of tests predictable.
    32     setTimeout(test, 0);
    33 }
    34 
    35 function test() {
     30}
     31
     32function test(message) {
     33    alert(message.data);
    3634    // FIXME: This test should use fast/window/resources/window-properties.js instead of a custom list.
    3735    // Constructors
  • trunk/LayoutTests/http/tests/security/resources/cross-frame-iframe-for-put-test.html

    r191423 r223556  
    242242        // The test runs on a timer and not in a load event handler because we want both
    243243        // window.onload and window.event to be undefined.
    244         setTimeout(function() {
     244        function runTest() {
    245245            // Constructors
    246246            shouldBe("window.Attr", "AttrOld");
     
    452452            shouldBe("window.showModalDialog", "showModalDialogOld", true);
    453453            shouldBe("window.stop", "stopOld");
    454         }, 0);
     454            window.parent.postMessage("continue test in parent frame", "*")
     455        };
     456        function checkAndRunTest() {
     457            if (window.innerHeight == 150)
     458                runTest();
     459            else
     460                setTimeout(checkAndRunTest, 10);
     461        }
     462        checkAndRunTest();
    455463    </script>
    456464</body>
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r223555 r223556  
    337337webkit.org/b/150942 animations/multiple-backgrounds.html [ Pass ImageOnlyFailure ]
    338338
    339 webkit.org/b/151053 http/tests/security/cross-frame-access-put.html [ Pass Failure ]
    340 
    341339webkit.org/b/151326 [ Yosemite+ ] webarchive/loading/missing-data.html [ Pass Crash ]
    342340
Note: See TracChangeset for help on using the changeset viewer.