Title: [187785] branches/safari-601.1-branch/Source/WebCore

Diff

Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (187784 => 187785)


--- branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-08-04 00:19:25 UTC (rev 187784)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-08-04 00:19:27 UTC (rev 187785)
@@ -1,3 +1,25 @@
+2015-08-03  Matthew Hanson  <[email protected]>
+
+        Merge r187466. rdar://problem/21960398
+
+    2015-07-27  Brady Eidson  <[email protected]>
+
+            Crash in WebCore::DocumentLoader::willSendRequest() with ContentFilter and AppCache.
+            <rdar://problem/21960398> and https://bugs.webkit.org/show_bug.cgi?id=147339
+
+            Reviewed by Alexey Proskuryakov.
+
+            No new tests (Not yet proven to be possible to test this).
+
+            * loader/DocumentLoader.cpp:
+            (WebCore::DocumentLoader::willSendRequest): Grab the identifier from the CachedResource directly, not from the null ResourceLoader.
+            (WebCore::DocumentLoader::continueAfterNavigationPolicy): Null check the ResourceLoader, as it can definitely be gone by this point.
+
+            * loader/cache/CachedResource.cpp:
+            (WebCore::CachedResource::clearLoader): Save off the identifier for later use.
+            * loader/cache/CachedResource.h:
+            (WebCore::CachedResource::identifierForLoadWithoutResourceLoader): Expose the identifier that the ResourceLoader had when it went away.
+
 2015-07-31  Matthew Hanson  <[email protected]>
 
         Merge r187675. rdar://problem/21632211

Modified: branches/safari-601.1-branch/Source/WebCore/loader/DocumentLoader.cpp (187784 => 187785)


--- branches/safari-601.1-branch/Source/WebCore/loader/DocumentLoader.cpp	2015-08-04 00:19:25 UTC (rev 187784)
+++ branches/safari-601.1-branch/Source/WebCore/loader/DocumentLoader.cpp	2015-08-04 00:19:27 UTC (rev 187785)
@@ -550,8 +550,10 @@
         // We checked application cache for initial URL, now we need to check it for redirected one.
         ASSERT(!m_substituteData.isValid());
         m_applicationCacheHost->maybeLoadMainResourceForRedirect(newRequest, m_substituteData);
-        if (m_substituteData.isValid())
-            m_identifierForLoadWithoutResourceLoader = mainResourceLoader()->identifier();
+        if (m_substituteData.isValid()) {
+            RELEASE_ASSERT(m_mainResource);
+            m_identifierForLoadWithoutResourceLoader = m_mainResource->identifierForLoadWithoutResourceLoader();
+        }
     }
 
     // FIXME: Ideally we'd stop the I/O until we hear back from the navigation policy delegate
@@ -581,10 +583,15 @@
         // However, from an API perspective, this isn't a cancellation. Therefore, sever our relationship with the network load,
         // but prevent the ResourceLoader from sending ResourceLoadNotifier callbacks.
         RefPtr<ResourceLoader> resourceLoader = mainResourceLoader();
-        ASSERT(resourceLoader->shouldSendResourceLoadCallbacks());
-        resourceLoader->setSendCallbackPolicy(DoNotSendCallbacks);
+        if (resourceLoader) {
+            ASSERT(resourceLoader->shouldSendResourceLoadCallbacks());
+            resourceLoader->setSendCallbackPolicy(DoNotSendCallbacks);
+        }
+
         clearMainResource();
-        resourceLoader->setSendCallbackPolicy(SendCallbacks);
+
+        if (resourceLoader)
+            resourceLoader->setSendCallbackPolicy(SendCallbacks);
         handleSubstituteDataLoadSoon();
     }
 }

Modified: branches/safari-601.1-branch/Source/WebCore/loader/cache/CachedResource.cpp (187784 => 187785)


--- branches/safari-601.1-branch/Source/WebCore/loader/cache/CachedResource.cpp	2015-08-04 00:19:25 UTC (rev 187784)
+++ branches/safari-601.1-branch/Source/WebCore/loader/cache/CachedResource.cpp	2015-08-04 00:19:27 UTC (rev 187785)
@@ -405,6 +405,7 @@
 void CachedResource::clearLoader()
 {
     ASSERT(m_loader);
+    m_identifierForLoadWithoutResourceLoader = m_loader->identifier();
     m_loader = nullptr;
     deleteIfPossible();
 }

Modified: branches/safari-601.1-branch/Source/WebCore/loader/cache/CachedResource.h (187784 => 187785)


--- branches/safari-601.1-branch/Source/WebCore/loader/cache/CachedResource.h	2015-08-04 00:19:25 UTC (rev 187784)
+++ branches/safari-601.1-branch/Source/WebCore/loader/cache/CachedResource.h	2015-08-04 00:19:27 UTC (rev 187785)
@@ -260,6 +260,8 @@
     virtual char* getOrCreateReadBuffer(size_t /* requestedSize */, size_t& /* actualSize */) { return nullptr; }
 #endif
 
+    unsigned long identifierForLoadWithoutResourceLoader() const { return m_identifierForLoadWithoutResourceLoader; }
+
 protected:
     void setEncodedSize(unsigned);
     void setDecodedSize(unsigned);
@@ -341,6 +343,8 @@
     HashSet<CachedResourceHandleBase*> m_handlesToRevalidate;
 
     RedirectChainCacheStatus m_redirectChainCacheStatus;
+
+    unsigned long m_identifierForLoadWithoutResourceLoader { 0 };
 };
 
 class CachedResource::Callback {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to