Title: [191657] branches/safari-601-branch/Source/WebCore
Revision
191657
Author
matthew_han...@apple.com
Date
2015-10-27 22:19:36 -0700 (Tue, 27 Oct 2015)

Log Message

Merge r191636. <rdar://problem/23078059>

Modified Paths

Diff

Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (191656 => 191657)


--- branches/safari-601-branch/Source/WebCore/ChangeLog	2015-10-28 05:19:33 UTC (rev 191656)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog	2015-10-28 05:19:36 UTC (rev 191657)
@@ -1,5 +1,30 @@
 2015-10-27  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r191636. rdar://problem/23078059
+
+    2015-10-27  Alex Christensen  <achristen...@webkit.org>
+
+            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.
+
+2015-10-27  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r191525. rdar://problem/23239748
 
     2015-10-23  Simon Fraser  <simon.fra...@apple.com>

Modified: branches/safari-601-branch/Source/WebCore/loader/DocumentLoader.cpp (191656 => 191657)


--- branches/safari-601-branch/Source/WebCore/loader/DocumentLoader.cpp	2015-10-28 05:19:33 UTC (rev 191656)
+++ branches/safari-601-branch/Source/WebCore/loader/DocumentLoader.cpp	2015-10-28 05:19:36 UTC (rev 191657)
@@ -140,7 +140,6 @@
     , m_timeOfLastDataReceived(0.0)
     , m_identifierForLoadWithoutResourceLoader(0)
     , m_dataLoadTimer(*this, &DocumentLoader::handleSubstituteDataLoadNow)
-    , m_waitingForContentPolicy(false)
     , m_subresourceLoadersArePageCacheAcceptable(false)
     , m_applicationCacheHost(std::make_unique<ApplicationCacheHost>(*this))
 #if ENABLE(CONTENT_FILTERING)
@@ -165,6 +164,7 @@
 {
     ASSERT(!m_frame || frameLoader()->activeDocumentLoader() != this || !isLoading());
     ASSERT_WITH_MESSAGE(!m_waitingForContentPolicy, "The content policy callback should never outlive its DocumentLoader.");
+    ASSERT_WITH_MESSAGE(!m_waitingForNavigationPolicy, "The navigation policy callback should never outlive its DocumentLoader.");
     if (m_iconLoadDecisionCallback)
         m_iconLoadDecisionCallback->invalidate();
     if (m_iconDataCallback)
@@ -568,6 +568,8 @@
     if (redirectResponse.isNull())
         return;
 
+    ASSERT(!m_waitingForNavigationPolicy);
+    m_waitingForNavigationPolicy = true;
     frameLoader()->policyChecker().checkNavigationPolicy(newRequest, [this](const ResourceRequest& request, PassRefPtr<FormState>, bool shouldContinue) {
         continueAfterNavigationPolicy(request, shouldContinue);
     });
@@ -575,6 +577,8 @@
 
 void DocumentLoader::continueAfterNavigationPolicy(const ResourceRequest&, bool shouldContinue)
 {
+    ASSERT(m_waitingForNavigationPolicy);
+    m_waitingForNavigationPolicy = false;
     if (!shouldContinue)
         stopLoadingForPolicyChange();
     else if (m_substituteData.isValid()) {
@@ -1472,10 +1476,11 @@
 
 void DocumentLoader::cancelPolicyCheckIfNeeded()
 {
-    if (m_waitingForContentPolicy && frameLoader())
+    if ((m_waitingForContentPolicy || m_waitingForNavigationPolicy) && frameLoader()) {
         frameLoader()->policyChecker().cancelCheck();
-
-    m_waitingForContentPolicy = false;
+        m_waitingForNavigationPolicy = false;
+        m_waitingForContentPolicy = false;
+    }
 }
 
 void DocumentLoader::cancelMainResourceLoad(const ResourceError& resourceError)

Modified: branches/safari-601-branch/Source/WebCore/loader/DocumentLoader.h (191656 => 191657)


--- branches/safari-601-branch/Source/WebCore/loader/DocumentLoader.h	2015-10-28 05:19:33 UTC (rev 191656)
+++ branches/safari-601-branch/Source/WebCore/loader/DocumentLoader.h	2015-10-28 05:19:36 UTC (rev 191657)
@@ -317,7 +317,6 @@
         bool isPostOrRedirectAfterPost(const ResourceRequest&, const ResourceResponse&);
 
         void continueAfterNavigationPolicy(const ResourceRequest&, bool shouldContinue);
-
         void continueAfterContentPolicy(PolicyAction);
 
         void stopLoadingForPolicyChange();
@@ -429,7 +428,8 @@
         unsigned long m_identifierForLoadWithoutResourceLoader;
 
         DocumentLoaderTimer m_dataLoadTimer;
-        bool m_waitingForContentPolicy;
+        bool m_waitingForContentPolicy { false };
+        bool m_waitingForNavigationPolicy { false };
 
         RefPtr<IconLoadDecisionCallback> m_iconLoadDecisionCallback;
         RefPtr<IconDataCallback> m_iconDataCallback;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to