Changeset 229539 in webkit


Ignore:
Timestamp:
Mar 12, 2018 10:50:53 AM (6 years ago)
Author:
Chris Dumez
Message:

http/tests/security/frame-loading-via-document-write-async-delegates.html fails with async delegates
https://bugs.webkit.org/show_bug.cgi?id=183460

Reviewed by Alex Christensen.

The test has 3 frames which all initially load "about:blank". Then using document.write(), it inserts
HTML in each frame.
Frame 1: body has an onload event handler, which calls JS is click an anchor link to navigate the frame.
Frame 2: body has an onload event handler to do some logging
Frame 3: body has an onload event handler and finishes the test (calls testRunner.notifyDone())

The issue is that with asynchronous policy delegates, the first frame may not have navigated yet by the
time the third frame is loaded. Indeed, the onload event of the first frame merely clicks am anchor link
which will trigger a navigation policy check and then later navigate.

To make the test more robust, we now count the number of loads and call testRunner.notifyDone() when
we've reached the expected number of loads.

  • http/tests/security/frame-loading-via-document-write-async-delegates-expected.txt: Added.
  • http/tests/security/frame-loading-via-document-write-async-delegates.html: Copied from LayoutTests/http/tests/security/frame-loading-via-document-write.html.
  • http/tests/security/frame-loading-via-document-write.html:
  • http/tests/security/resources/frame-loading-via-document-write.js:
Location:
trunk/LayoutTests
Files:
5 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r229534 r229539  
     12018-03-12  Chris Dumez  <cdumez@apple.com>
     2
     3        http/tests/security/frame-loading-via-document-write-async-delegates.html fails with async delegates
     4        https://bugs.webkit.org/show_bug.cgi?id=183460
     5
     6        Reviewed by Alex Christensen.
     7
     8        The test has 3 frames which all initially load "about:blank". Then using document.write(), it inserts
     9        HTML in each frame.
     10        Frame 1: body has an onload event handler, which calls JS is click an anchor link to navigate the frame.
     11        Frame 2: body has an onload event handler to do some logging
     12        Frame 3: body has an onload event handler and finishes the test (calls testRunner.notifyDone())
     13
     14        The issue is that with asynchronous policy delegates, the first frame may not have navigated yet by the
     15        time the third frame is loaded. Indeed, the onload event of the first frame merely clicks am anchor link
     16        which will trigger a navigation policy check and then later navigate.
     17
     18        To make the test more robust, we now count the number of loads and call testRunner.notifyDone() when
     19        we've reached the expected number of loads.
     20
     21        * http/tests/security/frame-loading-via-document-write-async-delegates-expected.txt: Added.
     22        * http/tests/security/frame-loading-via-document-write-async-delegates.html: Copied from LayoutTests/http/tests/security/frame-loading-via-document-write.html.
     23        * http/tests/security/frame-loading-via-document-write.html:
     24        * http/tests/security/resources/frame-loading-via-document-write.js:
     25
    1262018-03-12  Per Arne Vollan  <pvollan@apple.com>
    227
  • trunk/LayoutTests/TestExpectations

    r229423 r229539  
    188188imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html [ DumpJSConsoleLogInStdErr ]
    189189imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-weird.html [ DumpJSConsoleLogInStdErr ]
     190
     191# Line number in the console logging may change so we silence it to avoid flakiness.
     192http/tests/security/frame-loading-via-document-write.html [ DumpJSConsoleLogInStdErr ]
     193http/tests/security/frame-loading-via-document-write-async-delegates.html [ DumpJSConsoleLogInStdErr ]
    190194
    191195webkit.org/b/181901 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-cors-xhr.https.html [ DumpJSConsoleLogInStdErr ]
  • trunk/LayoutTests/http/tests/security/frame-loading-via-document-write-async-delegates-expected.txt

    r229538 r229539  
    1 CONSOLE MESSAGE: line 1: Not allowed to load local resource: abe.png
    21
    32
  • trunk/LayoutTests/http/tests/security/frame-loading-via-document-write-async-delegates.html

    r229538 r229539  
    44
    55<script language="JavaScript">
     6
     7const expectedLoadCount = 7;
     8let loadCount = 0;
     9function finishTestIfLastLoad()
     10{
     11    if (++loadCount == expectedLoadCount && window.testRunner)
     12        testRunner.notifyDone();
     13}
    614
    715function buildFrameset()
     
    1119        testRunner.dumpAsText();
    1220        testRunner.dumpChildFramesAsText();
     21        if (testRunner.setShouldDecideNavigationPolicyAfterDelay)
     22            testRunner.setShouldDecideNavigationPolicyAfterDelay(true);
    1323    }
    1424
    1525    var outHTML="<frameset rows=\"33%, 33%, 33%\">"+
    16                 "<frame src=\"\" name=\"topRow\">"+
    17                 "<frame src=\"\" name=\"middleRow\">"+
    18                 "<frame src=\"\" name=\"bottomRow\">"+
     26                "<frame src=\"\" onload=\"finishTestIfLastLoad()\" name=\"topRow\">"+
     27                "<frame src=\"\" onload=\"finishTestIfLastLoad()\" name=\"middleRow\">"+
     28                "<frame src=\"\" onload=\"finishTestIfLastLoad()\" name=\"bottomRow\">"+
    1929                "</frameset>";
    2030
     
    4959
    5060    outHTML = "<html><head><scr" + "ipt language=\"JavaScript\" src=\"resources/frame-loading-via-document-write.js\">"+
    51               "</scr" + "ipt></head><body onLoad=\"lastTest()\"><table><tr><td>"+
     61              "</scr" + "ipt></head><body onLoad=\"didImageLoad()\"><table><tr><td>"+
    5262              "<div id=\"result\"></div>"+
    5363              "<img src=\"/resources/abe.png\" id=\"myImg\">"+
  • trunk/LayoutTests/http/tests/security/frame-loading-via-document-write-expected.txt

    r182266 r229539  
    1 CONSOLE MESSAGE: line 1: Not allowed to load local resource: abe.png
    21
    32
  • trunk/LayoutTests/http/tests/security/frame-loading-via-document-write.html

    r229496 r229539  
    44
    55<script language="JavaScript">
     6
     7const expectedLoadCount = 7;
     8let loadCount = 0;
     9function finishTestIfLastLoad()
     10{
     11    if (++loadCount == expectedLoadCount && window.testRunner)
     12        testRunner.notifyDone();
     13}
    614
    715function buildFrameset()
     
    1422
    1523    var outHTML="<frameset rows=\"33%, 33%, 33%\">"+
    16                 "<frame src=\"\" name=\"topRow\">"+
    17                 "<frame src=\"\" name=\"middleRow\">"+
    18                 "<frame src=\"\" name=\"bottomRow\">"+
     24                "<frame src=\"\" onload=\"finishTestIfLastLoad()\" name=\"topRow\">"+
     25                "<frame src=\"\" onload=\"finishTestIfLastLoad()\" name=\"middleRow\">"+
     26                "<frame src=\"\" onload=\"finishTestIfLastLoad()\" name=\"bottomRow\">"+
    1927                "</frameset>";
    2028
     
    4957
    5058    outHTML = "<html><head><scr" + "ipt language=\"JavaScript\" src=\"resources/frame-loading-via-document-write.js\">"+
    51               "</scr" + "ipt></head><body onLoad=\"lastTest()\"><table><tr><td>"+
     59              "</scr" + "ipt></head><body onLoad=\"didImageLoad()\"><table><tr><td>"+
    5260              "<div id=\"result\"></div>"+
    5361              "<img src=\"/resources/abe.png\" id=\"myImg\">"+
  • trunk/LayoutTests/http/tests/security/resources/frame-loading-via-document-write.js

    r229496 r229539  
    1818}
    1919
    20 function lastTest()
    21 {
    22     didImageLoad();
    23 
    24     if (window.testRunner)
    25         testRunner.notifyDone();
    26 }
    27 
Note: See TracChangeset for help on using the changeset viewer.