Changeset 229577 in webkit


Ignore:
Timestamp:
Mar 13, 2018 9:12:40 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html fails with async policy delegate
https://bugs.webkit.org/show_bug.cgi?id=183386

Patch by Danyao Wang <danyao@chromium.org> on 2018-03-13
Reviewed by Chris Dumez.

This test relies on the happenstance that with sync poicy decision, the subframe transitions
to FrameLoadProvisional before main frame navigation is committed. With async delegate,
policy checks for the main frame and subframe are interleaved. When the main frame policy
decision is received, it cancels the subframe check. So the page ends up being cached when
navigating away. This is working as intended.

  • http/tests/navigation/page-cache-iframe-provisional-load-async-delegates-expected.txt: Added.
  • http/tests/navigation/page-cache-iframe-provisional-load-async-delegates.html: Copied from LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html.

Add a new version of the test that forces async policy delegate.

  • http/tests/navigation/page-cache-iframe-provisional-load.html:

Update test to sequence main frame navigation after start of provisional navigation in subframe.

Location:
trunk/LayoutTests
Files:
1 added
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r229576 r229577  
     12018-03-13  Danyao Wang  <danyao@chromium.org>
     2
     3        LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html fails with async policy delegate
     4        https://bugs.webkit.org/show_bug.cgi?id=183386
     5
     6        Reviewed by Chris Dumez.
     7
     8        This test relies on the happenstance that with sync poicy decision, the subframe transitions
     9        to FrameLoadProvisional before main frame navigation is committed. With async delegate,
     10        policy checks for the main frame and subframe are interleaved. When the main frame policy
     11        decision is received, it cancels the subframe check. So the page ends up being cached when
     12        navigating away. This is working as intended.
     13
     14        * http/tests/navigation/page-cache-iframe-provisional-load-async-delegates-expected.txt: Added.
     15        * http/tests/navigation/page-cache-iframe-provisional-load-async-delegates.html: Copied from LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html.
     16        Add a new version of the test that forces async policy delegate.
     17
     18        * http/tests/navigation/page-cache-iframe-provisional-load.html:
     19        Update test to sequence main frame navigation after start of provisional navigation in subframe.
     20
    1212018-03-13  Frederic Wang  <fwang@igalia.com>
    222
  • trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load-async-delegates.html

    r229576 r229577  
    77window.jsTestIsAsync = true;
    88
    9 if (window.testRunner)
     9if (window.testRunner) {
     10    if (testRunner.setShouldDecideNavigationPolicyAfterDelay)
     11          testRunner.setShouldDecideNavigationPolicyAfterDelay(true);
     12
    1013    testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
     14}
    1115
    1216window.addEventListener("pageshow", function(event) {
     
    3236function loadSubframeAndNavigateAway()
    3337{
    34     // Force a back navigation back to this page.
    3538    window.sessionStorage.page_cache_provisional_load_test_started = true;
    36     window.location.href = "resources/page-cache-helper.html";
    3739
     40    // Force a back navigation back to this page after the subframe starts provisional navigation.
    3841    var testFrame = document.getElementById("testFrame");
     42    testFrame.onbeforeunload = function() {
     43        setTimeout(function() {
     44            window.location.href = "resources/page-cache-helper.html";
     45        }, 0);
     46    };
    3947    testFrame.src = "http://127.0.0.1:8000/navigation/resources/slow-resource.pl?delay=3000";
    4048}
    4149
    42 window.addEventListener('load', function() {
    43     setTimeout(function() {
    44         loadSubframeAndNavigateAway();
    45     }, 0);
    46 }, false);
     50window.addEventListener('load', loadSubframeAndNavigateAway, false);
    4751
    4852</script>
  • trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html

    r188592 r229577  
    3232function loadSubframeAndNavigateAway()
    3333{
    34     // Force a back navigation back to this page.
    3534    window.sessionStorage.page_cache_provisional_load_test_started = true;
    36     window.location.href = "resources/page-cache-helper.html";
    3735
     36    // Force a back navigation back to this page after the subframe starts provisional navigation.
    3837    var testFrame = document.getElementById("testFrame");
     38    testFrame.onbeforeunload = function() {
     39        setTimeout(function() {
     40            window.location.href = "resources/page-cache-helper.html";
     41        }, 0);
     42    };
    3943    testFrame.src = "http://127.0.0.1:8000/navigation/resources/slow-resource.pl?delay=3000";
    4044}
    4145
    42 window.addEventListener('load', function() {
    43     setTimeout(function() {
    44         loadSubframeAndNavigateAway();
    45     }, 0);
    46 }, false);
     46window.addEventListener('load', loadSubframeAndNavigateAway, false);
    4747
    4848</script>
Note: See TracChangeset for help on using the changeset viewer.