Changeset 191636 in webkit


Ignore:
Timestamp:
Oct 27, 2015 1:41:34 PM (9 years ago)
Author:
achristensen@apple.com
Message:

Cancel navigation policy checks like we do content policy checks.
https://bugs.webkit.org/show_bug.cgi?id=150582
rdar://problem/22077579

Reviewed by Brent Fulgham.

This was verified manually and I'll write a layout test for it soon.

  • loader/DocumentLoader.cpp:

(WebCore::DocumentLoader::DocumentLoader):
(WebCore::DocumentLoader::~DocumentLoader):
(WebCore::DocumentLoader::willSendRequest):
(WebCore::DocumentLoader::continueAfterNavigationPolicy):
(WebCore::DocumentLoader::cancelPolicyCheckIfNeeded):

  • loader/DocumentLoader.h:

Add a bool to keep track of whether we are waiting for navigation policy checks, like we do with content policy checks.
Without this check, sometimes callbacks are made to DocumentLoaders that do not exist any more because they do not get
cancelled by cancelPolicyCheckIfNeeded when detaching from the frame.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r191635 r191636  
     12015-10-27  Alex Christensen  <achristensen@webkit.org>
     2
     3        Cancel navigation policy checks like we do content policy checks.
     4        https://bugs.webkit.org/show_bug.cgi?id=150582
     5        rdar://problem/22077579
     6
     7        Reviewed by Brent Fulgham.
     8
     9        This was verified manually and I'll write a layout test for it soon.
     10
     11        * loader/DocumentLoader.cpp:
     12        (WebCore::DocumentLoader::DocumentLoader):
     13        (WebCore::DocumentLoader::~DocumentLoader):
     14        (WebCore::DocumentLoader::willSendRequest):
     15        (WebCore::DocumentLoader::continueAfterNavigationPolicy):
     16        (WebCore::DocumentLoader::cancelPolicyCheckIfNeeded):
     17        * loader/DocumentLoader.h:
     18        Add a bool to keep track of whether we are waiting for navigation policy checks, like we do with content policy checks.
     19        Without this check, sometimes callbacks are made to DocumentLoaders that do not exist any more because they do not get
     20        cancelled by cancelPolicyCheckIfNeeded when detaching from the frame.
     21
    1222015-10-27  Brady Eidson  <beidson@apple.com>
    223
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r191369 r191636  
    143143    , m_identifierForLoadWithoutResourceLoader(0)
    144144    , m_dataLoadTimer(*this, &DocumentLoader::handleSubstituteDataLoadNow)
    145     , m_waitingForContentPolicy(false)
    146145    , m_subresourceLoadersArePageCacheAcceptable(false)
    147146    , m_applicationCacheHost(std::make_unique<ApplicationCacheHost>(*this))
     
    168167    ASSERT(!m_frame || frameLoader()->activeDocumentLoader() != this || !isLoading());
    169168    ASSERT_WITH_MESSAGE(!m_waitingForContentPolicy, "The content policy callback should never outlive its DocumentLoader.");
     169    ASSERT_WITH_MESSAGE(!m_waitingForNavigationPolicy, "The navigation policy callback should never outlive its DocumentLoader.");
    170170    if (m_iconLoadDecisionCallback)
    171171        m_iconLoadDecisionCallback->invalidate();
     
    571571        return;
    572572
     573    ASSERT(!m_waitingForNavigationPolicy);
     574    m_waitingForNavigationPolicy = true;
    573575    frameLoader()->policyChecker().checkNavigationPolicy(newRequest, [this](const ResourceRequest& request, PassRefPtr<FormState>, bool shouldContinue) {
    574576        continueAfterNavigationPolicy(request, shouldContinue);
     
    578580void DocumentLoader::continueAfterNavigationPolicy(const ResourceRequest&, bool shouldContinue)
    579581{
     582    ASSERT(m_waitingForNavigationPolicy);
     583    m_waitingForNavigationPolicy = false;
    580584    if (!shouldContinue)
    581585        stopLoadingForPolicyChange();
     
    14861490    RELEASE_ASSERT(frameLoader());
    14871491
    1488     if (m_waitingForContentPolicy) {
     1492    if (m_waitingForContentPolicy || m_waitingForNavigationPolicy) {
    14891493        frameLoader()->policyChecker().cancelCheck();
    14901494        m_waitingForContentPolicy = false;
     1495        m_waitingForNavigationPolicy = false;
    14911496    }
    14921497}
  • trunk/Source/WebCore/loader/DocumentLoader.h

    r190510 r191636  
    321321
    322322        void continueAfterNavigationPolicy(const ResourceRequest&, bool shouldContinue);
    323 
    324323        void continueAfterContentPolicy(PolicyAction);
    325324
     
    433432
    434433        DocumentLoaderTimer m_dataLoadTimer;
    435         bool m_waitingForContentPolicy;
     434        bool m_waitingForContentPolicy { false };
     435        bool m_waitingForNavigationPolicy { false };
    436436
    437437        RefPtr<IconLoadDecisionCallback> m_iconLoadDecisionCallback;
Note: See TracChangeset for help on using the changeset viewer.