Changeset 228922 in webkit


Ignore:
Timestamp:
Feb 22, 2018 10:29:26 AM (6 years ago)
Author:
Chris Dumez
Message:

Document.open() cancels existing provisional load but not navigation policy check
https://bugs.webkit.org/show_bug.cgi?id=183012
<rdar://problem/37755831>

Reviewed by Alex Christensen.

Source/WebCore:

Test: fast/dom/Document/open-with-pending-load-async-policy.html

  • dom/Document.cpp:

(WebCore::Document::open):
The existing code was calling FrameLoader::stopAllLoaders() when the loader's state
is FrameStateProvisional. The issue is that the FrameLoader's state only gets set
to FrameStateProvisional after the policy decision for the navigation is made.
This means that we fail to cancel a pending load if is still in the policy decision
stage, which can happen when the policy decision is made asynchronously. We now
also cancel such pending navigation policy checks as well.

  • loader/PolicyChecker.cpp:

(WebCore::PolicyChecker::checkNavigationPolicy):
Make sure the m_delegateIsDecidingNavigationPolicy flag gets reset inside the
lambda. Otherwise, it gets reset too early when the policy decision is made
asynchronously.

LayoutTests:

Add layout test coverage.

  • fast/dom/Document/open-with-pending-load-async-policy-expected.txt: Added.
  • fast/dom/Document/open-with-pending-load-async-policy.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r228921 r228922  
     12018-02-22  Chris Dumez  <cdumez@apple.com>
     2
     3        Document.open() cancels existing provisional load but not navigation policy check
     4        https://bugs.webkit.org/show_bug.cgi?id=183012
     5        <rdar://problem/37755831>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Add layout test coverage.
     10
     11        * fast/dom/Document/open-with-pending-load-async-policy-expected.txt: Added.
     12        * fast/dom/Document/open-with-pending-load-async-policy.html: Added.
     13
    1142018-02-22  Matt Lewis  <jlewis3@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r228919 r228922  
     12018-02-22  Chris Dumez  <cdumez@apple.com>
     2
     3        Document.open() cancels existing provisional load but not navigation policy check
     4        https://bugs.webkit.org/show_bug.cgi?id=183012
     5        <rdar://problem/37755831>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Test: fast/dom/Document/open-with-pending-load-async-policy.html
     10
     11        * dom/Document.cpp:
     12        (WebCore::Document::open):
     13        The existing code was calling FrameLoader::stopAllLoaders() when the loader's state
     14        is FrameStateProvisional. The issue is that the FrameLoader's state only gets set
     15        to FrameStateProvisional after the policy decision for the navigation is made.
     16        This means that we fail to cancel a pending load if is still in the policy decision
     17        stage, which can happen when the policy decision is made asynchronously. We now
     18        also cancel such pending navigation policy checks as well.
     19
     20        * loader/PolicyChecker.cpp:
     21        (WebCore::PolicyChecker::checkNavigationPolicy):
     22        Make sure the m_delegateIsDecidingNavigationPolicy flag gets reset inside the
     23        lambda. Otherwise, it gets reset too early when the policy decision is made
     24        asynchronously.
     25
    1262018-02-22  Youenn Fablet  <youenn@apple.com>
    227
  • trunk/Source/WebCore/dom/Document.cpp

    r228889 r228922  
    143143#include "PluginDocument.h"
    144144#include "PointerLockController.h"
     145#include "PolicyChecker.h"
    145146#include "PopStateEvent.h"
    146147#include "ProcessingInstruction.h"
     
    26192620        }
    26202621
     2622        if (m_frame->loader().policyChecker().delegateIsDecidingNavigationPolicy())
     2623            m_frame->loader().policyChecker().stopCheck();
    26212624        if (m_frame->loader().state() == FrameStateProvisional)
    26222625            m_frame->loader().stopAllLoaders();
  • trunk/Source/WebCore/loader/PolicyChecker.cpp

    r224758 r228922  
    146146    ResourceRequest requestCopy = request;
    147147    m_frame.loader().client().dispatchDecidePolicyForNavigationAction(action, request, didReceiveRedirectResponse, formState, [this, function = WTFMove(function), request = WTFMove(requestCopy), formState = makeRefPtr(formState), suggestedFilename = WTFMove(suggestedFilename)](PolicyAction policyAction) mutable {
     148        m_delegateIsDecidingNavigationPolicy = false;
     149
    148150        switch (policyAction) {
    149151        case PolicyAction::Download:
     
    162164        ASSERT_NOT_REACHED();
    163165    });
    164     m_delegateIsDecidingNavigationPolicy = false;
    165166}
    166167
Note: See TracChangeset for help on using the changeset viewer.