Title: [290160] branches/safari-613.1.17.1-branch/Source/WebCore
Revision
290160
Author
alanc...@apple.com
Date
2022-02-18 13:18:04 -0800 (Fri, 18 Feb 2022)

Log Message

Cherry-pick r290152. rdar://problem/88327814

    Keep promise in scope when calling DeferredPromise::reject
    https://bugs.webkit.org/show_bug.cgi?id=236454

    Patch by Gabriel Nava Marino <gnavamar...@apple.com> on 2022-02-18
    Reviewed by Darin Adler.

    Keep promise in scope when calling DeferredPromise::reject, as createDOMException
    could go through a path that invokes GC on its owner and the promise.

    * Modules/fetch/FetchBodyConsumer.cpp:
    (WebCore::FetchBodyConsumer::resolveWithFormData):

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

Modified Paths

Diff

Modified: branches/safari-613.1.17.1-branch/Source/WebCore/ChangeLog (290159 => 290160)


--- branches/safari-613.1.17.1-branch/Source/WebCore/ChangeLog	2022-02-18 21:17:59 UTC (rev 290159)
+++ branches/safari-613.1.17.1-branch/Source/WebCore/ChangeLog	2022-02-18 21:18:04 UTC (rev 290160)
@@ -1,5 +1,36 @@
 2022-02-18  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r290152. rdar://problem/88327814
+
+    Keep promise in scope when calling DeferredPromise::reject
+    https://bugs.webkit.org/show_bug.cgi?id=236454
+    
+    Patch by Gabriel Nava Marino <gnavamar...@apple.com> on 2022-02-18
+    Reviewed by Darin Adler.
+    
+    Keep promise in scope when calling DeferredPromise::reject, as createDOMException
+    could go through a path that invokes GC on its owner and the promise.
+    
+    * Modules/fetch/FetchBodyConsumer.cpp:
+    (WebCore::FetchBodyConsumer::resolveWithFormData):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-18  Gabriel Nava Marino  <gnavamar...@apple.com>
+
+            Keep promise in scope when calling DeferredPromise::reject
+            https://bugs.webkit.org/show_bug.cgi?id=236454
+
+            Reviewed by Darin Adler.
+
+            Keep promise in scope when calling DeferredPromise::reject, as createDOMException
+            could go through a path that invokes GC on its owner and the promise.
+
+            * Modules/fetch/FetchBodyConsumer.cpp:
+            (WebCore::FetchBodyConsumer::resolveWithFormData):
+
+2022-02-18  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r290156. rdar://problem/89154452
 
     ServiceWorkerGlobalScope+PushAPI requires PushAPIEnabled

Modified: branches/safari-613.1.17.1-branch/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp (290159 => 290160)


--- branches/safari-613.1.17.1-branch/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp	2022-02-18 21:17:59 UTC (rev 290159)
+++ branches/safari-613.1.17.1-branch/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp	2022-02-18 21:18:04 UTC (rev 290160)
@@ -268,8 +268,9 @@
     if (!context)
         return;
 
-    m_formDataConsumer = makeUnique<FormDataConsumer>(formData, *context, [this, promise = WTFMove(promise), contentType, builder = SharedBufferBuilder { }](auto&& result) mutable {
+    m_formDataConsumer = makeUnique<FormDataConsumer>(formData, *context, [this, capturedPromise = WTFMove(promise), contentType, builder = SharedBufferBuilder { }](auto&& result) mutable {
         if (result.hasException()) {
+            auto promise = WTFMove(capturedPromise);
             promise->reject(result.releaseException());
             return;
         }
@@ -277,7 +278,7 @@
         auto& value = result.returnValue();
         if (value.empty()) {
             auto buffer = builder.takeAsContiguous();
-            resolveWithData(WTFMove(promise), contentType, buffer->data(), buffer->size());
+            resolveWithData(WTFMove(capturedPromise), contentType, buffer->data(), buffer->size());
             return;
         }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to