Changeset 229579 in webkit


Ignore:
Timestamp:
Mar 13, 2018 11:07:30 AM (6 years ago)
Author:
Chris Dumez
Message:

fast/loader/javascript-url-iframe-remove-on-navigate.html is flaky with async policy delegates
https://bugs.webkit.org/show_bug.cgi?id=183588

Reviewed by Alex Christensen.

The test was setting the frame's src to a javascript URL in a setTimeout(0), expecting the
navigation policy delegate to have already completed. However, with asynchronous policy
delegates, this is not necessarily the case. Therefore, we now wait for the beforeunload
event to be fired at the window, since this indicates a policy decision has been made and
we are actually navigating.

I checked that this test was printing the "FAIL" alert in both Firefox and Chrome before
this change.

  • fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate-expected.txt: Added.
  • fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate.html: Added.
  • fast/loader/javascript-url-iframe-remove-on-navigate.html:
Location:
trunk/LayoutTests
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r229578 r229579  
     12018-03-13  Chris Dumez  <cdumez@apple.com>
     2
     3        fast/loader/javascript-url-iframe-remove-on-navigate.html is flaky with async policy delegates
     4        https://bugs.webkit.org/show_bug.cgi?id=183588
     5
     6        Reviewed by Alex Christensen.
     7
     8        The test was setting the frame's src to a javascript URL in a setTimeout(0), expecting the
     9        navigation policy delegate to have already completed. However, with asynchronous policy
     10        delegates, this is not necessarily the case. Therefore, we now wait for the beforeunload
     11        event to be fired at the window, since this indicates a policy decision has been made and
     12        we are actually navigating.
     13
     14        I checked that this test was printing the "FAIL" alert in both Firefox and Chrome before
     15        this change.
     16
     17        * fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate-expected.txt: Added.
     18        * fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate.html: Added.
     19        * fast/loader/javascript-url-iframe-remove-on-navigate.html:
     20
    1212018-03-13  Ross Kirsling  <ross.kirsling@sony.com>
    222
  • trunk/LayoutTests/fast/loader/javascript-url-iframe-remove-on-navigate.html

    r190505 r229579  
    66}
    77
    8 setTimeout(function() {
    9         document.getElementById("target").src = "javascript:alert('FAIL')";
     8let frame = document.getElementById("target");
     9frame.contentWindow.onbeforeunload = function() {
     10    setTimeout(function() {
     11        frame.src = "javascript:alert('FAIL')";
    1012    }, 0);
     13};
    1114
    1215window.addEventListener("load", function() {
    13         document.write("PASS - Javascript URL blocked without crashing.");
    14         if (window.testRunner)
    15             testRunner.notifyDone();
    16     }, false);
     16    document.write("PASS - Javascript URL blocked without crashing.");
     17    if (window.testRunner)
     18        testRunner.notifyDone();
     19}, false);
    1720</script>
Note: See TracChangeset for help on using the changeset viewer.