Changeset 251019 in webkit


Ignore:
Timestamp:
Oct 11, 2019 1:26:15 PM (5 years ago)
Author:
Chris Dumez
Message:

Pages frequently fail to enter the back/forward cache due to frames with a quick redirect coming
https://bugs.webkit.org/show_bug.cgi?id=202768
<rdar://problem/56132022>

Reviewed by Alex Christensen.

Source/WebCore:

When a quick redirect is scheduled with the navigation scheduler, we set the m_quickRedirectComing flag.
This flag is supposed to get unset if the navigation gets cancelled and when the navigation actually
happens. However, for a navigation to a javascript: URL, we would return early after executing the JS
and fail to reset the m_quickRedirectComing flag. Later on, we would fail to enter the page cache because
we would think that the iframe still has a quick redirect scheduled.

Test: fast/history/page-cache-iframe-js-url.html

  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::urlSelected):
Reset the m_quickRedirectComing flag if we return early after executing
the javascript URL.

(WebCore::FrameLoader::stopForPageCache):
Stop policy checks & cancel scheduled navigations after stopping loads. Stopping loads may
run script which may in theory schedule new navigations. This is hardening.

LayoutTests:

Add lauout test coverage.

  • fast/history/page-cache-iframe-js-url-expected.txt: Added.
  • fast/history/page-cache-iframe-js-url.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r251016 r251019  
     12019-10-11  Chris Dumez  <cdumez@apple.com>
     2
     3        Pages frequently fail to enter the back/forward cache due to frames with a quick redirect coming
     4        https://bugs.webkit.org/show_bug.cgi?id=202768
     5        <rdar://problem/56132022>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Add lauout test coverage.
     10
     11        * fast/history/page-cache-iframe-js-url-expected.txt: Added.
     12        * fast/history/page-cache-iframe-js-url.html: Added.
     13
    1142019-10-11  Kate Cheney  <katherine_cheney@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r251015 r251019  
     12019-10-11  Chris Dumez  <cdumez@apple.com>
     2
     3        Pages frequently fail to enter the back/forward cache due to frames with a quick redirect coming
     4        https://bugs.webkit.org/show_bug.cgi?id=202768
     5        <rdar://problem/56132022>
     6
     7        Reviewed by Alex Christensen.
     8
     9        When a quick redirect is scheduled with the navigation scheduler, we set the m_quickRedirectComing flag.
     10        This flag is supposed to get unset if the navigation gets cancelled and when the navigation actually
     11        happens. However, for a navigation to a javascript: URL, we would return early after executing the JS
     12        and fail to reset the m_quickRedirectComing flag. Later on, we would fail to enter the page cache because
     13        we would think that the iframe still has a quick redirect scheduled.
     14
     15        Test: fast/history/page-cache-iframe-js-url.html
     16
     17        * loader/FrameLoader.cpp:
     18        (WebCore::FrameLoader::urlSelected):
     19        Reset the m_quickRedirectComing flag if we return early after executing
     20        the javascript URL.
     21
     22        (WebCore::FrameLoader::stopForPageCache):
     23        Stop policy checks & cancel scheduled navigations after stopping loads. Stopping loads may
     24        run script which may in theory schedule new navigations. This is hardening.
     25
    1262019-10-11  Antti Koivisto  <antti@apple.com>
    227
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r250686 r251019  
    396396    Ref<Frame> protect(m_frame);
    397397
    398     if (m_frame.script().executeIfJavaScriptURL(frameRequest.resourceRequest().url(), frameRequest.shouldReplaceDocumentIfJavaScriptURL()))
    399         return;
     398    if (m_frame.script().executeIfJavaScriptURL(frameRequest.resourceRequest().url(), frameRequest.shouldReplaceDocumentIfJavaScriptURL())) {
     399        m_quickRedirectComing = false;
     400        return;
     401    }
    400402
    401403    if (frameRequest.frameName().isEmpty())
     
    18481850void FrameLoader::stopForPageCache()
    18491851{
    1850     // Make sure there are no scheduled loads or policy checks.
    1851     policyChecker().stopCheck();
    1852     m_frame.navigationScheduler().cancel();
    1853 
    18541852    // Stop provisional loads in subframes (The one in the main frame is about to be committed).
    18551853    if (!m_frame.isMainFrame()) {
     
    18651863    for (RefPtr<Frame> child = m_frame.tree().firstChild(); child; child = child->tree().nextSibling())
    18661864        child->loader().stopForPageCache();
     1865
     1866    // Make sure there are no scheduled loads or policy checks.
     1867    policyChecker().stopCheck();
     1868    m_frame.navigationScheduler().cancel();
    18671869}
    18681870
Note: See TracChangeset for help on using the changeset viewer.