Title: [212162] trunk
Revision
212162
Author
commit-qu...@webkit.org
Date
2017-02-10 15:53:31 -0800 (Fri, 10 Feb 2017)

Log Message

[Fetch API] fetch fails when undefined is passed as headers
https://bugs.webkit.org/show_bug.cgi?id=168043

Patch by Youenn Fablet <you...@apple.com> on 2017-02-10
Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/request/request-headers-expected.txt:
* web-platform-tests/fetch/api/request/request-headers.html:

Source/WebCore:

Covered by updated test.

* Modules/fetch/FetchInternals.js:
(fillFetchHeaders): Exit early in case of undefined headers, since it is an optional parameter.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (212161 => 212162)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-02-10 23:51:47 UTC (rev 212161)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-02-10 23:53:31 UTC (rev 212162)
@@ -1,3 +1,13 @@
+2017-02-10  Youenn Fablet  <you...@apple.com>
+
+        [Fetch API] fetch fails when undefined is passed as headers
+        https://bugs.webkit.org/show_bug.cgi?id=168043
+
+        Reviewed by Geoffrey Garen.
+
+        * web-platform-tests/fetch/api/request/request-headers-expected.txt:
+        * web-platform-tests/fetch/api/request/request-headers.html:
+
 2017-02-10  Jiewen Tan  <jiewen_...@apple.com>
 
         [WebCrypto] Remove imported/w3c/WebCryptoAPI tests

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-headers-expected.txt (212161 => 212162)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-headers-expected.txt	2017-02-10 23:51:47 UTC (rev 212161)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-headers-expected.txt	2017-02-10 23:53:31 UTC (rev 212162)
@@ -55,4 +55,5 @@
 PASS Request should get its content-type from init headers if one is provided 
 PASS Testing request header creations with various objects 
 PASS Testing empty Request Content-Type header 
+PASS Passing undefined headers to Request constructor should not throw 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-headers.html (212161 => 212162)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-headers.html	2017-02-10 23:51:47 UTC (rev 212161)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-headers.html	2017-02-10 23:53:31 UTC (rev 212162)
@@ -168,6 +168,11 @@
         });
       }, "Testing empty Request Content-Type header");
 
+      test(function() {
+        var request = new Request("", {"headers" : undefined, "body" : "this is my plate", "method" : "POST"});
+        assert_equals(request.headers.get("Content-Type"), "text/plain;charset=UTF-8");
+      }, "Passing undefined headers to Request constructor should not throw");
+
     </script>
   </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (212161 => 212162)


--- trunk/Source/WebCore/ChangeLog	2017-02-10 23:51:47 UTC (rev 212161)
+++ trunk/Source/WebCore/ChangeLog	2017-02-10 23:53:31 UTC (rev 212162)
@@ -1,3 +1,15 @@
+2017-02-10  Youenn Fablet  <you...@apple.com>
+
+        [Fetch API] fetch fails when undefined is passed as headers
+        https://bugs.webkit.org/show_bug.cgi?id=168043
+
+        Reviewed by Geoffrey Garen.
+
+        Covered by updated test.
+
+        * Modules/fetch/FetchInternals.js:
+        (fillFetchHeaders): Exit early in case of undefined headers, since it is an optional parameter.
+
 2017-02-10  Csaba Osztrogonác  <o...@webkit.org>
 
         Fix the !ENABLE(WEB_TIMING) build

Modified: trunk/Source/WebCore/Modules/fetch/FetchInternals.js (212161 => 212162)


--- trunk/Source/WebCore/Modules/fetch/FetchInternals.js	2017-02-10 23:51:47 UTC (rev 212161)
+++ trunk/Source/WebCore/Modules/fetch/FetchInternals.js	2017-02-10 23:53:31 UTC (rev 212162)
@@ -30,6 +30,9 @@
 {
     "use strict";
 
+    if (headersInit === @undefined)
+        return;
+
     if (headersInit instanceof @Headers) {
         @Headers.prototype.@fillFromJS.@call(headers, headersInit);
         return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to