Title: [279969] trunk
Revision
279969
Author
[email protected]
Date
2021-07-15 16:24:52 -0700 (Thu, 15 Jul 2021)

Log Message

FetchResponse.formData() should reject promise with a TypeError if the body is null
https://bugs.webkit.org/show_bug.cgi?id=228007

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline WPT tests now that more checks are passing.

* web-platform-tests/fetch/api/request/request-consume-empty.any-expected.txt:
* web-platform-tests/fetch/api/request/request-consume-empty.any.worker-expected.txt:
* web-platform-tests/fetch/api/response/response-consume-empty.any-expected.txt:
* web-platform-tests/fetch/api/response/response-consume-empty.any.worker-expected.txt:

Source/WebCore:

FetchResponse.formData() should reject promise with a TypeError if the body is null, to match
the behavior of Chrome and Firefox.

No new tests, rebaselined existing tests.

* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::formData):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (279968 => 279969)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-07-15 22:56:57 UTC (rev 279968)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-07-15 23:24:52 UTC (rev 279969)
@@ -1,5 +1,19 @@
 2021-07-15  Chris Dumez  <[email protected]>
 
+        FetchResponse.formData() should reject promise with a TypeError if the body is null
+        https://bugs.webkit.org/show_bug.cgi?id=228007
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline WPT tests now that more checks are passing.
+
+        * web-platform-tests/fetch/api/request/request-consume-empty.any-expected.txt:
+        * web-platform-tests/fetch/api/request/request-consume-empty.any.worker-expected.txt:
+        * web-platform-tests/fetch/api/response/response-consume-empty.any-expected.txt:
+        * web-platform-tests/fetch/api/response/response-consume-empty.any.worker-expected.txt:
+
+2021-07-15  Chris Dumez  <[email protected]>
+
         Sync XHR 'load' event is always has total/loaded=0
         https://bugs.webkit.org/show_bug.cgi?id=228004
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.any-expected.txt (279968 => 279969)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.any-expected.txt	2021-07-15 22:56:57 UTC (rev 279968)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.any-expected.txt	2021-07-15 23:24:52 UTC (rev 279969)
@@ -3,9 +3,9 @@
 PASS Consume request's body as blob
 PASS Consume request's body as arrayBuffer
 PASS Consume request's body as json (error case)
-FAIL Consume request's body as formData with correct multipart type (error case) promise_rejects_js: function "function () { throw e }" threw undefined with type "undefined", not an object
-FAIL Consume request's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: undefined
-FAIL Consume request's body as formData without correct type (error case) promise_rejects_js: function "function () { throw e }" threw undefined with type "undefined", not an object
+PASS Consume request's body as formData with correct multipart type (error case)
+FAIL Consume request's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: object "TypeError: Type error"
+PASS Consume request's body as formData without correct type (error case)
 PASS Consume empty blob request body as arrayBuffer
 PASS Consume empty text request body as arrayBuffer
 PASS Consume empty blob request body as text

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.any.worker-expected.txt (279968 => 279969)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.any.worker-expected.txt	2021-07-15 22:56:57 UTC (rev 279968)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.any.worker-expected.txt	2021-07-15 23:24:52 UTC (rev 279969)
@@ -3,9 +3,9 @@
 PASS Consume request's body as blob
 PASS Consume request's body as arrayBuffer
 PASS Consume request's body as json (error case)
-FAIL Consume request's body as formData with correct multipart type (error case) promise_rejects_js: function "function () { throw e }" threw undefined with type "undefined", not an object
-FAIL Consume request's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: undefined
-FAIL Consume request's body as formData without correct type (error case) promise_rejects_js: function "function () { throw e }" threw undefined with type "undefined", not an object
+PASS Consume request's body as formData with correct multipart type (error case)
+FAIL Consume request's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: object "TypeError: Type error"
+PASS Consume request's body as formData without correct type (error case)
 PASS Consume empty blob request body as arrayBuffer
 PASS Consume empty text request body as arrayBuffer
 PASS Consume empty blob request body as text

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.any-expected.txt (279968 => 279969)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.any-expected.txt	2021-07-15 22:56:57 UTC (rev 279968)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.any-expected.txt	2021-07-15 23:24:52 UTC (rev 279969)
@@ -3,9 +3,9 @@
 PASS Consume response's body as blob
 PASS Consume response's body as arrayBuffer
 PASS Consume response's body as json (error case)
-FAIL Consume response's body as formData with correct multipart type (error case) promise_rejects_js: function "function () { throw e }" threw undefined with type "undefined", not an object
-FAIL Consume response's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: undefined
-FAIL Consume response's body as formData without correct type (error case) promise_rejects_js: function "function () { throw e }" threw undefined with type "undefined", not an object
+PASS Consume response's body as formData with correct multipart type (error case)
+FAIL Consume response's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: object "TypeError: Type error"
+PASS Consume response's body as formData without correct type (error case)
 PASS Consume empty blob response body as arrayBuffer
 PASS Consume empty text response body as arrayBuffer
 PASS Consume empty blob response body as text

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.any.worker-expected.txt (279968 => 279969)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.any.worker-expected.txt	2021-07-15 22:56:57 UTC (rev 279968)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.any.worker-expected.txt	2021-07-15 23:24:52 UTC (rev 279969)
@@ -3,9 +3,9 @@
 PASS Consume response's body as blob
 PASS Consume response's body as arrayBuffer
 PASS Consume response's body as json (error case)
-FAIL Consume response's body as formData with correct multipart type (error case) promise_rejects_js: function "function () { throw e }" threw undefined with type "undefined", not an object
-FAIL Consume response's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: undefined
-FAIL Consume response's body as formData without correct type (error case) promise_rejects_js: function "function () { throw e }" threw undefined with type "undefined", not an object
+PASS Consume response's body as formData with correct multipart type (error case)
+FAIL Consume response's body as formData with correct urlencoded type promise_test: Unhandled rejection with value: object "TypeError: Type error"
+PASS Consume response's body as formData without correct type (error case)
 PASS Consume empty blob response body as arrayBuffer
 PASS Consume empty text response body as arrayBuffer
 PASS Consume empty blob response body as text

Modified: trunk/Source/WebCore/ChangeLog (279968 => 279969)


--- trunk/Source/WebCore/ChangeLog	2021-07-15 22:56:57 UTC (rev 279968)
+++ trunk/Source/WebCore/ChangeLog	2021-07-15 23:24:52 UTC (rev 279969)
@@ -1,5 +1,20 @@
 2021-07-15  Chris Dumez  <[email protected]>
 
+        FetchResponse.formData() should reject promise with a TypeError if the body is null
+        https://bugs.webkit.org/show_bug.cgi?id=228007
+
+        Reviewed by Alex Christensen.
+
+        FetchResponse.formData() should reject promise with a TypeError if the body is null, to match
+        the behavior of Chrome and Firefox.
+
+        No new tests, rebaselined existing tests.
+
+        * Modules/fetch/FetchBodyOwner.cpp:
+        (WebCore::FetchBodyOwner::formData):
+
+2021-07-15  Chris Dumez  <[email protected]>
+
         Sync XHR 'load' event is always has total/loaded=0
         https://bugs.webkit.org/show_bug.cgi?id=228004
 

Modified: trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp (279968 => 279969)


--- trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp	2021-07-15 22:56:57 UTC (rev 279968)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp	2021-07-15 23:24:52 UTC (rev 279969)
@@ -186,7 +186,7 @@
     }
 
     if (isBodyNullOrOpaque()) {
-        promise->reject();
+        promise->reject(TypeError);
         return;
     }
     if (isDisturbedOrLocked()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to