Title: [277028] trunk
Revision
277028
Author
[email protected]
Date
2021-05-05 10:58:55 -0700 (Wed, 05 May 2021)

Log Message

No need to error a fetch body stream if its request or response is stopped
https://bugs.webkit.org/show_bug.cgi?id=225347

Reviewed by Geoffrey Garen.

Source/WebCore:

Test: http/wpt/fetch/fetch-response-body-stop-in-worker.html

* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::stop):
Nullify the source before we error it.

LayoutTests:

* http/wpt/fetch/fetch-response-body-stop-in-worker-expected.txt: Added.
* http/wpt/fetch/fetch-response-body-stop-in-worker.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (277027 => 277028)


--- trunk/LayoutTests/ChangeLog	2021-05-05 17:28:13 UTC (rev 277027)
+++ trunk/LayoutTests/ChangeLog	2021-05-05 17:58:55 UTC (rev 277028)
@@ -1,3 +1,13 @@
+2021-05-05  Youenn Fablet  <[email protected]>
+
+        No need to error a fetch body stream if its request or response is stopped
+        https://bugs.webkit.org/show_bug.cgi?id=225347
+
+        Reviewed by Geoffrey Garen.
+
+        * http/wpt/fetch/fetch-response-body-stop-in-worker-expected.txt: Added.
+        * http/wpt/fetch/fetch-response-body-stop-in-worker.html: Added.
+
 2021-05-05  Sam Weinig  <[email protected]>
 
         Add preliminary support for specifying a color space for 2D canvas

Added: trunk/LayoutTests/http/wpt/fetch/fetch-response-body-stop-in-worker-expected.txt (0 => 277028)


--- trunk/LayoutTests/http/wpt/fetch/fetch-response-body-stop-in-worker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/fetch/fetch-response-body-stop-in-worker-expected.txt	2021-05-05 17:58:55 UTC (rev 277028)
@@ -0,0 +1,3 @@
+
+PASS fetch response body stop in a worker
+

Added: trunk/LayoutTests/http/wpt/fetch/fetch-response-body-stop-in-worker.html (0 => 277028)


--- trunk/LayoutTests/http/wpt/fetch/fetch-response-body-stop-in-worker.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/fetch/fetch-response-body-stop-in-worker.html	2021-05-05 17:58:55 UTC (rev 277028)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<header>
+<script src=''></script>
+<script src=''></script>
+</header>
+<body>
+<script>
+promise_test(async (t) => {
+    const script = `
+        let streamReader;
+        fetch('${window.location.origin}/WebKit/fetch/resources/lengthy-pass.py?delay=1').then(response => {
+            streamReader = response.body.getReader();
+            self.postMessage('ready');
+        });
+    `;
+    const blob = new Blob([script], { type: 'text/_javascript_' });
+    const worker = new Worker(URL.createObjectURL(blob));
+    await new Promise(resolve => worker._onmessage_ = () => {
+        resolve();
+    });
+    worker.terminate();
+    await new Promise(resolve => setTimeout(resolve, 50));
+}, "fetch response body stop in a worker");
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (277027 => 277028)


--- trunk/Source/WebCore/ChangeLog	2021-05-05 17:28:13 UTC (rev 277027)
+++ trunk/Source/WebCore/ChangeLog	2021-05-05 17:58:55 UTC (rev 277028)
@@ -1,3 +1,16 @@
+2021-05-05  Youenn Fablet  <[email protected]>
+
+        No need to error a fetch body stream if its request or response is stopped
+        https://bugs.webkit.org/show_bug.cgi?id=225347
+
+        Reviewed by Geoffrey Garen.
+
+        Test: http/wpt/fetch/fetch-response-body-stop-in-worker.html
+
+        * Modules/fetch/FetchBodyOwner.cpp:
+        (WebCore::FetchBodyOwner::stop):
+        Nullify the source before we error it.
+
 2021-05-05  Sam Weinig  <[email protected]>
 
         Add preliminary support for specifying a color space for 2D canvas

Modified: trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp (277027 => 277028)


--- trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp	2021-05-05 17:28:13 UTC (rev 277027)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp	2021-05-05 17:58:55 UTC (rev 277028)
@@ -56,6 +56,7 @@
 
 void FetchBodyOwner::stop()
 {
+    m_readableStreamSource = nullptr;
     if (m_body)
         m_body->cleanConsumer();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to