Title: [187944] releases/WebKitGTK/webkit-2.8/Source/WebCore
Revision
187944
Author
carlo...@webkit.org
Date
2015-08-05 00:28:24 -0700 (Wed, 05 Aug 2015)

Log Message

Merge r187466 - 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.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (187943 => 187944)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-08-05 07:19:51 UTC (rev 187943)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-08-05 07:28:24 UTC (rev 187944)
@@ -1,3 +1,21 @@
+2015-07-27  Brady Eidson  <beid...@apple.com>
+
+        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-27  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Pass a GstInstallPluginsContext to gst_install_plugins_async

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/DocumentLoader.cpp (187943 => 187944)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/DocumentLoader.cpp	2015-08-05 07:19:51 UTC (rev 187943)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/DocumentLoader.cpp	2015-08-05 07:28:24 UTC (rev 187944)
@@ -553,8 +553,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
@@ -584,10 +586,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: releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/cache/CachedResource.cpp (187943 => 187944)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/cache/CachedResource.cpp	2015-08-05 07:19:51 UTC (rev 187943)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/cache/CachedResource.cpp	2015-08-05 07:28:24 UTC (rev 187944)
@@ -405,6 +405,7 @@
 void CachedResource::clearLoader()
 {
     ASSERT(m_loader);
+    m_identifierForLoadWithoutResourceLoader = m_loader->identifier();
     m_loader = nullptr;
     deleteIfPossible();
 }

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/cache/CachedResource.h (187943 => 187944)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/cache/CachedResource.h	2015-08-05 07:19:51 UTC (rev 187943)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/cache/CachedResource.h	2015-08-05 07:28:24 UTC (rev 187944)
@@ -257,6 +257,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);
@@ -338,6 +340,8 @@
     HashSet<CachedResourceHandleBase*> m_handlesToRevalidate;
 
     RedirectChainCacheStatus m_redirectChainCacheStatus;
+
+    unsigned long m_identifierForLoadWithoutResourceLoader { 0 };
 };
 
 class CachedResource::Callback {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to