[iOS] Crash in -[WebPreviewLoader failed] when running http/tests/multipart/policy...
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Mar 2017 23:50:55 +0000 (23:50 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Mar 2017 23:50:55 +0000 (23:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170197
<rdar://problem/30314067>

Reviewed by Brady Eidson.

Source/WebCore:

If QuickLook conversion fails, we call ResourceLoader::didFail() with the NSError from
QuickLook, which will call back into PreviewLoader::didFail(). We only care about network
failures in PreviewLoader, not conversion failures, so check if
m_finishedLoadingDataIntoConverter is set before continuing (like we do in
PreviewLoader::didFinishLoading()).

Fixes crash in http/tests/multipart/policy-ignore-crash.php.

* loader/ios/PreviewLoader.mm:
(WebCore::PreviewLoader::didFail):

LayoutTests:

* platform/ios/TestExpectations: Unskipped http/tests/multipart/policy-ignore-crash.php.
* platform/ios/http/tests/multipart/policy-ignore-crash-expected.txt: Added an iOS-specific result.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@214506 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/ios/http/tests/multipart/policy-ignore-crash-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/ios/PreviewLoader.mm

index 95e261e..b4c53cd 100644 (file)
@@ -1,3 +1,14 @@
+2017-03-28  Andy Estes  <aestes@apple.com>
+
+        [iOS] Crash in -[WebPreviewLoader failed] when running http/tests/multipart/policy-ignore-crash.php
+        https://bugs.webkit.org/show_bug.cgi?id=170197
+        <rdar://problem/30314067>
+
+        Reviewed by Brady Eidson.
+
+        * platform/ios/TestExpectations: Unskipped http/tests/multipart/policy-ignore-crash.php.
+        * platform/ios/http/tests/multipart/policy-ignore-crash-expected.txt: Added an iOS-specific result.
+
 2017-03-28  Chris Dumez  <cdumez@apple.com>
 
         Animated SVG images are not paused when outside viewport
index 324b014..2271b39 100644 (file)
@@ -480,7 +480,6 @@ http/tests/misc/link-rel-icon-beforeload.html [ Failure ]
 http/tests/misc/object-embedding-svg-delayed-size-negotiation.xhtml [ Failure ]
 http/tests/misc/submit-post-keygen.html [ Failure ]
 http/tests/misc/willCacheResponse-delegate-callback.html [ Failure ]
-http/tests/multipart/policy-ignore-crash.php [ Failure ]
 http/tests/navigation/response204.html [ Failure ]
 http/tests/security/clipboard/clipboard-file-access.html [ Failure ]
 http/tests/security/contentSecurityPolicy/object-src-no-url-blocked.html [ Failure ]
diff --git a/LayoutTests/platform/ios/http/tests/multipart/policy-ignore-crash-expected.txt b/LayoutTests/platform/ios/http/tests/multipart/policy-ignore-crash-expected.txt
new file mode 100644 (file)
index 0000000..04ed3ca
--- /dev/null
@@ -0,0 +1,4 @@
+
+ERROR_MESSAGE_MAIN
+
+ERROR_MESSAGE_REASON
index b2e6588..87df0aa 100644 (file)
@@ -1,3 +1,22 @@
+2017-03-28  Andy Estes  <aestes@apple.com>
+
+        [iOS] Crash in -[WebPreviewLoader failed] when running http/tests/multipart/policy-ignore-crash.php
+        https://bugs.webkit.org/show_bug.cgi?id=170197
+        <rdar://problem/30314067>
+
+        Reviewed by Brady Eidson.
+
+        If QuickLook conversion fails, we call ResourceLoader::didFail() with the NSError from
+        QuickLook, which will call back into PreviewLoader::didFail(). We only care about network
+        failures in PreviewLoader, not conversion failures, so check if
+        m_finishedLoadingDataIntoConverter is set before continuing (like we do in
+        PreviewLoader::didFinishLoading()).
+
+        Fixes crash in http/tests/multipart/policy-ignore-crash.php.
+
+        * loader/ios/PreviewLoader.mm:
+        (WebCore::PreviewLoader::didFail):
+
 2017-03-28  Chris Dumez  <cdumez@apple.com>
 
         Audio indicator is visible on uni-watch.com but there is no audible audio
index 061152f..5f15f45 100644 (file)
@@ -233,6 +233,10 @@ bool PreviewLoader::didFinishLoading()
 
 void PreviewLoader::didFail()
 {
+    if (m_finishedLoadingDataIntoConverter)
+        return;
+
+    m_finishedLoadingDataIntoConverter = true;
     [m_previewLoader failed];
     m_previewLoader = nullptr;
 }