Title: [246525] trunk/Source/WebCore
Revision
246525
Author
[email protected]
Date
2019-06-17 17:14:59 -0700 (Mon, 17 Jun 2019)

Log Message

Fix iOS crash when starting loads with no active DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=187360
<rdar://problem/29389084>

Reviewed by Geoff Garen.

When FrameLoader::activeDocumentLoader returns null in the ResourceLoader constructor,
on iOS we will dereference it to ask if it has a frame in an early return in init.
Let's not.  If we don't have a DocumentLoader, we don't have a frame and should fail.

Crash reports indicate this crash is related to Beacon and other uses of LoaderStrategy::startPingLoad,
but attempts to make a unit test to reproduce the crash were unsuccessful.

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::init):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (246524 => 246525)


--- trunk/Source/WebCore/ChangeLog	2019-06-18 00:06:17 UTC (rev 246524)
+++ trunk/Source/WebCore/ChangeLog	2019-06-18 00:14:59 UTC (rev 246525)
@@ -1,3 +1,21 @@
+2019-06-17  Alex Christensen  <[email protected]>
+
+        Fix iOS crash when starting loads with no active DocumentLoader
+        https://bugs.webkit.org/show_bug.cgi?id=187360
+        <rdar://problem/29389084>
+
+        Reviewed by Geoff Garen.
+
+        When FrameLoader::activeDocumentLoader returns null in the ResourceLoader constructor,
+        on iOS we will dereference it to ask if it has a frame in an early return in init.
+        Let's not.  If we don't have a DocumentLoader, we don't have a frame and should fail.
+
+        Crash reports indicate this crash is related to Beacon and other uses of LoaderStrategy::startPingLoad,
+        but attempts to make a unit test to reproduce the crash were unsuccessful.
+
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::init):
+
 2019-06-17  Robin Morisset  <[email protected]>
 
         [WHLSL] The name resolver does not deal with nativeFunctionDeclaration

Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (246524 => 246525)


--- trunk/Source/WebCore/loader/ResourceLoader.cpp	2019-06-18 00:06:17 UTC (rev 246524)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp	2019-06-18 00:14:59 UTC (rev 246525)
@@ -119,6 +119,14 @@
 
 void ResourceLoader::init(ResourceRequest&& clientRequest, CompletionHandler<void(bool)>&& completionHandler)
 {
+#if PLATFORM(IOS_FAMILY)
+    if (!m_documentLoader) {
+        // We should always have a DocumentLoader at this point, but crash reports indicate that it is sometimes null.
+        // See https://bugs.webkit.org/show_bug.cgi?id=187360
+        ASSERT_NOT_REACHED();
+        return completionHandler(false);
+    }
+#endif
     ASSERT(!m_handle);
     ASSERT(m_request.isNull());
     ASSERT(m_deferredRequest.isNull());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to