Title: [293064] branches/safari-613-branch/Source/WebCore
Revision
293064
Author
[email protected]
Date
2022-04-19 22:37:47 -0700 (Tue, 19 Apr 2022)

Log Message

Cherry-pick r288680. rdar://91446363

    Detect failed ThreadableLoader creation in FileReaderLoader.
    https://bugs.webkit.org/show_bug.cgi?id=235566

    Patch by Gavin Phillips <[email protected]> on 2022-01-27
    Reviewed by Youenn Fablet.

    When we fail to successfully create a ThreadableLoader in FileReaderLoader we should catch
    the failure and return early.

    * Modules/fetch/FormDataConsumer.cpp:
    (WebCore::FormDataConsumer::consumeBlob):
    * fileapi/FileReaderLoader.cpp:
    (WebCore::FileReaderLoader::start):

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

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (293063 => 293064)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-20 05:31:36 UTC (rev 293063)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-20 05:37:47 UTC (rev 293064)
@@ -1,3 +1,38 @@
+2022-04-19  Alan Coon  <[email protected]>
+
+        Cherry-pick r288680. rdar://problem/91993398
+
+    Detect failed ThreadableLoader creation in FileReaderLoader.
+    https://bugs.webkit.org/show_bug.cgi?id=235566
+    
+    Patch by Gavin Phillips <[email protected]> on 2022-01-27
+    Reviewed by Youenn Fablet.
+    
+    When we fail to successfully create a ThreadableLoader in FileReaderLoader we should catch
+    the failure and return early.
+    
+    * Modules/fetch/FormDataConsumer.cpp:
+    (WebCore::FormDataConsumer::consumeBlob):
+    * fileapi/FileReaderLoader.cpp:
+    (WebCore::FileReaderLoader::start):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-27  Gavin Phillips  <[email protected]>
+
+            Detect failed ThreadableLoader creation in FileReaderLoader.
+            https://bugs.webkit.org/show_bug.cgi?id=235566
+
+            Reviewed by Youenn Fablet.
+
+            When we fail to successfully create a ThreadableLoader in FileReaderLoader we should catch
+            the failure and return early.
+
+            * Modules/fetch/FormDataConsumer.cpp:
+            (WebCore::FormDataConsumer::consumeBlob):
+            * fileapi/FileReaderLoader.cpp:
+            (WebCore::FileReaderLoader::start):
+
 2022-04-11  Yusuke Suzuki  <[email protected]>
 
         [JSC] Reduce use of unnecessary cryptographicallyRandom numbers

Modified: branches/safari-613-branch/Source/WebCore/Modules/fetch/FormDataConsumer.cpp (293063 => 293064)


--- branches/safari-613-branch/Source/WebCore/Modules/fetch/FormDataConsumer.cpp	2022-04-20 05:31:36 UTC (rev 293063)
+++ branches/safari-613-branch/Source/WebCore/Modules/fetch/FormDataConsumer.cpp	2022-04-20 05:37:47 UTC (rev 293064)
@@ -95,6 +95,9 @@
             return;
 
         auto loader = std::exchange(weakThis->m_blobLoader, { });
+        if (!loader)
+            return;
+
         if (auto optionalErrorCode = loader->errorCode()) {
             if (weakThis->m_callback)
                 weakThis->m_callback(Exception { InvalidStateError, "Failed to read form data blob"_s });
@@ -107,7 +110,7 @@
 
     m_blobLoader->start(blobURL, m_context.get(), FileReaderLoader::ReadAsArrayBuffer);
 
-    if (!m_blobLoader->isLoading()) {
+    if (!m_blobLoader || !m_blobLoader->isLoading()) {
         m_callback(Exception { InvalidStateError, "Unable to read form data blob"_s });
         m_blobLoader = nullptr;
     }

Modified: branches/safari-613-branch/Source/WebCore/fileapi/FileReaderLoader.cpp (293063 => 293064)


--- branches/safari-613-branch/Source/WebCore/fileapi/FileReaderLoader.cpp	2022-04-20 05:31:36 UTC (rev 293063)
+++ branches/safari-613-branch/Source/WebCore/fileapi/FileReaderLoader.cpp	2022-04-20 05:37:47 UTC (rev 293064)
@@ -102,9 +102,12 @@
     options.mode = FetchOptions::Mode::SameOrigin;
     options.contentSecurityPolicyEnforcement = ContentSecurityPolicyEnforcement::DoNotEnforce;
 
-    if (m_client)
-        m_loader = ThreadableLoader::create(*scriptExecutionContext, *this, WTFMove(request), options);
-    else
+    if (m_client) {
+        auto loader = ThreadableLoader::create(*scriptExecutionContext, *this, WTFMove(request), options);
+        if (!loader)
+            return;
+        std::exchange(m_loader, loader);
+    } else
         ThreadableLoader::loadResourceSynchronously(*scriptExecutionContext, WTFMove(request), *this, options);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to