Title: [197026] trunk/Source/WebCore
Revision
197026
Author
youenn.fab...@crf.canon.fr
Date
2016-02-24 04:11:15 -0800 (Wed, 24 Feb 2016)

Log Message

[Fetch API] Refactor FetchHeaders initialization with iterators
https://bugs.webkit.org/show_bug.cgi?id=154537

Reviewed by Darin Adler.

Covered by existing tests.

* Modules/fetch/FetchHeaders.cpp:
(WebCore::initializeWith): Deleted.
* Modules/fetch/FetchHeaders.h: Removed FetchHeaders::initializeWith.
* Modules/fetch/FetchHeaders.idl: Ditto.
* Modules/fetch/FetchHeaders.js:
(initializeFetchHeaders): Making use of iterators to fill headers.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (197025 => 197026)


--- trunk/Source/WebCore/ChangeLog	2016-02-24 11:13:58 UTC (rev 197025)
+++ trunk/Source/WebCore/ChangeLog	2016-02-24 12:11:15 UTC (rev 197026)
@@ -1,3 +1,19 @@
+2016-02-24  Youenn Fablet  <youenn.fab...@crf.canon.fr>
+
+        [Fetch API] Refactor FetchHeaders initialization with iterators
+        https://bugs.webkit.org/show_bug.cgi?id=154537
+
+        Reviewed by Darin Adler.
+
+        Covered by existing tests.
+
+        * Modules/fetch/FetchHeaders.cpp:
+        (WebCore::initializeWith): Deleted.
+        * Modules/fetch/FetchHeaders.h: Removed FetchHeaders::initializeWith.
+        * Modules/fetch/FetchHeaders.idl: Ditto.
+        * Modules/fetch/FetchHeaders.js:
+        (initializeFetchHeaders): Making use of iterators to fill headers.
+
 2016-02-24  Carlos Garcia Campos  <cgar...@igalia.com>
 
         Unreviewed. Fix GObject DOM bindings API break after r196998.

Modified: trunk/Source/WebCore/Modules/fetch/FetchHeaders.cpp (197025 => 197026)


--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.cpp	2016-02-24 11:13:58 UTC (rev 197025)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.cpp	2016-02-24 12:11:15 UTC (rev 197026)
@@ -36,13 +36,6 @@
 
 namespace WebCore {
 
-void FetchHeaders::initializeWith(const FetchHeaders* headers, ExceptionCode&)
-{
-    if (!headers)
-        return;
-    m_headers = headers->m_headers;
-}
-
 // FIXME: Optimize these routines for HTTPHeaderMap keys and/or refactor them with XMLHttpRequest code.
 static bool isForbiddenHeaderName(const String& name)
 {

Modified: trunk/Source/WebCore/Modules/fetch/FetchHeaders.h (197025 => 197026)


--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.h	2016-02-24 11:13:58 UTC (rev 197025)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.h	2016-02-24 12:11:15 UTC (rev 197026)
@@ -62,7 +62,6 @@
     bool has(const String&, ExceptionCode&) const;
     void set(const String& name, const String& value, ExceptionCode&);
 
-    void initializeWith(const FetchHeaders*, ExceptionCode&);
     void fill(const FetchHeaders*);
 
     String fastGet(HTTPHeaderName name) const { return m_headers.get(name); }

Modified: trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl (197025 => 197026)


--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl	2016-02-24 11:13:58 UTC (rev 197025)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl	2016-02-24 12:11:15 UTC (rev 197026)
@@ -43,5 +43,4 @@
     iterable<DOMString, DOMString>;
 
     [Private, RaisesException, ImplementedAs=append] void appendFromJS(DOMString name, DOMString value);
-    [Private, RaisesException] void initializeWith(FetchHeaders headers);
 };

Modified: trunk/Source/WebCore/Modules/fetch/FetchHeaders.js (197025 => 197026)


--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.js	2016-02-24 11:13:58 UTC (rev 197025)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.js	2016-02-24 12:11:15 UTC (rev 197026)
@@ -36,8 +36,9 @@
         throw new @TypeError("headersInit must be an object");
 
     if (this.constructor === headersInit.constructor) {
-         // FIXME: Use iterators when available?
-         this.@initializeWith(headersInit);
+         headersInit.forEach((value, name) => {
+             this.@appendFromJS(name, value);
+         });
     }
 
     if (headersInit instanceof @Array) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to