Diff
Modified: trunk/LayoutTests/ChangeLog (195529 => 195530)
--- trunk/LayoutTests/ChangeLog 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/LayoutTests/ChangeLog 2016-01-25 10:53:53 UTC (rev 195530)
@@ -1,3 +1,20 @@
+2016-01-25 Youenn Fablet <[email protected]>
+
+ [Fetch API] Implement Fetch API Headers
+ https://bugs.webkit.org/show_bug.cgi?id=152384
+
+ Reviewed by Darin Adler.
+
+ * js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
+ * js/dom/global-constructors-attributes-expected.txt:
+ * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
+ * platform/efl/js/dom/global-constructors-attributes-expected.txt:
+ * platform/gtk/js/dom/global-constructors-attributes-expected.txt:
+ * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt:
+ * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
+ * platform/mac/js/dom/global-constructors-attributes-expected.txt:
+ * platform/win/js/dom/global-constructors-attributes-expected.txt:
+
2016-01-22 Sergio Villar Senin <[email protected]>
[css-grid] grid shorthand must reset gap properties to their initial values
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (195529 => 195530)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-01-25 10:53:53 UTC (rev 195530)
@@ -1,3 +1,25 @@
+2016-01-25 Youenn Fablet <[email protected]>
+
+ [Fetch API] Implement Fetch API Headers
+ https://bugs.webkit.org/show_bug.cgi?id=152384
+
+ Reviewed by Darin Adler.
+
+ * web-platform-tests/fetch/api/headers/headers-basic-expected.txt: Added.
+ * web-platform-tests/fetch/api/headers/headers-basic.html: Added.
+ * web-platform-tests/fetch/api/headers/headers-casing-expected.txt: Added.
+ * web-platform-tests/fetch/api/headers/headers-casing.html: Added.
+ * web-platform-tests/fetch/api/headers/headers-errors-expected.txt: Added.
+ * web-platform-tests/fetch/api/headers/headers-errors.html: Added.
+ * web-platform-tests/fetch/api/headers/headers-idl-expected.txt: Added.
+ * web-platform-tests/fetch/api/headers/headers-idl.html: Added.
+ * web-platform-tests/fetch/api/headers/headers-nameshake-expected.txt: Added.
+ * web-platform-tests/fetch/api/headers/headers-nameshake.html: Added.
+ * web-platform-tests/fetch/api/headers/headers-normalize-expected.txt: Added.
+ * web-platform-tests/fetch/api/headers/headers-normalize.html: Added.
+ * web-platform-tests/fetch/api/headers/headers-structure-expected.txt: Added.
+ * web-platform-tests/fetch/api/headers/headers-structure.html: Added.
+
2016-01-24 Chris Dumez <[email protected]>
An XMLDocument interface should be exposed on the global Window object
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic-expected.txt (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,15 @@
+
+PASS Create headers from no parameter
+PASS Create headers from undefined parameter
+PASS Create headers from empty object
+PASS Create headers with null should throw
+PASS Create headers with 1 should throw
+PASS Create headers with sequence
+PASS Create headers with OpenEndedDictionary
+PASS Create headers whith existing headers
+PASS Check append method
+PASS Check set method
+PASS Check has method
+PASS Check delete method
+PASS Check get method
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,115 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers structure</title>
+ <meta name="help" href=""
+ <meta name="author" title="Canon Research France" href=""
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+ test(function() {
+ new Headers();
+ }, "Create headers from no parameter");
+
+ test(function() {
+ new Headers(undefined);
+ }, "Create headers from undefined parameter");
+
+ test(function() {
+ new Headers({});
+ }, "Create headers from empty object");
+
+ var parameters = [null, 1];
+ parameters.forEach(function(parameter) {
+ test(function() {
+ assert_throws(new TypeError(), () => new Headers(parameter));
+ }, "Create headers with " + parameter + " should throw");
+ });
+
+ var headerDict = {"name1": "value1",
+ "name2": "value2",
+ "name3": "value3",
+ "name4": null,
+ "name5": undefined,
+ "name6": 1,
+ "Content-Type": "value4"
+ };
+
+ var headerSeq = [];
+ for (var name in headerDict)
+ headerSeq.push([name, headerDict[name]]);
+
+ test(function() {
+ var headers = new Headers(headerSeq);
+ for (name in headerDict) {
+ assert_equals(headers.get(name), String(headerDict[name]),
+ "name: " + name + " has value: " + headerDict[name]);
+ }
+ }, "Create headers with sequence");
+
+ test(function() {
+ var headers = new Headers(headerDict);
+ for (name in headerDict) {
+ assert_equals(headers.get(name), String(headerDict[name]),
+ "name: " + name + " has value: " + headerDict[name]);
+ }
+ }, "Create headers with OpenEndedDictionary");
+
+ test(function() {
+ var headers = new Headers(headerDict);
+ var headers2 = new Headers(headers);
+ for (name in headerDict) {
+ assert_equals(headers2.get(name), String(headerDict[name]),
+ "name: " + name + " has value: " + headerDict[name]);
+ }
+ }, "Create headers whith existing headers");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDict) {
+ headers.append(name, headerDict[name]);
+ assert_equals(headers.get(name), String(headerDict[name]),
+ "name: " + name + " has value: " + headerDict[name]);
+ }
+ }, "Check append method");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDict) {
+ headers.set(name, headerDict[name]);
+ assert_equals(headers.get(name), String(headerDict[name]),
+ "name: " + name + " has value: " + headerDict[name]);
+ }
+ }, "Check set method");
+
+ test(function() {
+ var headers = new Headers(headerDict);
+ for (name in headerDict)
+ assert_true(headers.has(name),"headers has name " + name);
+
+ assert_false(headers.has("nameNotInHeaders"),"headers do not have header: nameNotInHeaders");
+ }, "Check has method");
+
+ test(function() {
+ var headers = new Headers(headerDict);
+ for (name in headerDict) {
+ assert_true(headers.has(name),"headers have a header: " + name);
+ headers.delete(name)
+ assert_true(!headers.has(name),"headers do not have anymore a header: " + name);
+ }
+ }, "Check delete method");
+
+ test(function() {
+ var headers = new Headers(headerDict);
+ for (name in headerDict)
+ assert_equals(headers.get(name), String(headerDict[name]),
+ "name: " + name + " has value: " + headerDict[name]);
+
+ assert_equals(headers.get("nameNotInHeaders"), null, "header: nameNotInHeaders has no value");
+ }, "Check get method");
+ </script>
+ </body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-casing-expected.txt (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-casing-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-casing-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,6 @@
+
+PASS Create headers, names use characters with different case
+PASS Check append method, names use characters with different case
+PASS Check set method, names use characters with different case
+PASS Check delete method, names use characters with different case
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-casing.html (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-casing.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-casing.html 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,64 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers case management</title>
+ <meta name="help" href=""
+ <meta name="author" title="Canon Research France" href=""
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+ var headerDictCase = {"UPPERCASE": "value1",
+ "lowercase": "value2",
+ "mixedCase": "value3",
+ "Content-TYPE": "value4"
+ };
+
+ function checkHeadersCase(originalName, headersToCheck, expectedDict) {
+ var lowCaseName = originalName.toLowerCase();
+ var upCaseName = originalName.toUpperCase();
+ var expectedValue = expectedDict[originalName];
+ assert_equals(headersToCheck.get(originalName), expectedValue,
+ "name: " + originalName + " has value: " + expectedValue);
+ assert_equals(headersToCheck.get(lowCaseName), expectedValue,
+ "name: " + lowCaseName + " has value: " + expectedValue);
+ assert_equals(headersToCheck.get(upCaseName), expectedValue,
+ "name: " + upCaseName + " has value: " + expectedValue);
+ }
+
+ test(function() {
+ var headers = new Headers(headerDictCase);
+ for (name in headerDictCase)
+ checkHeadersCase(name, headers, headerDictCase)
+ }, "Create headers, names use characters with different case");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDictCase) {
+ headers.append(name, headerDictCase[name]);
+ checkHeadersCase(name, headers, headerDictCase);
+ }
+ }, "Check append method, names use characters with different case");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDictCase) {
+ headers.set(name, headerDictCase[name]);
+ checkHeadersCase(name, headers, headerDictCase);
+ }
+ }, "Check set method, names use characters with different case");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDictCase)
+ headers.set(name, headerDictCase[name]);
+ for (name in headerDictCase)
+ headers.delete(name.toLowerCase());
+ for (name in headerDictCase)
+ assert_false(headers.has(name), "header " + name + " should have been deleted");
+ }, "Check delete method, names use characters with different case");
+ </script>
+ </body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-errors-expected.txt (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-errors-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-errors-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,18 @@
+
+PASS Create headers giving an array having one string as init argument
+PASS Create headers giving an array having three strings as init argument
+PASS Create headers giving bad header name as init argument
+PASS Create headers giving bad header value as init argument
+PASS Check headers get with an invalid name invalidĀ
+PASS Check headers get with an invalid name [object Object]
+PASS Check headers delete with an invalid name invalidĀ
+PASS Check headers delete with an invalid name [object Object]
+PASS Check headers has with an invalid name invalidĀ
+PASS Check headers has with an invalid name [object Object]
+PASS Check headers set with an invalid name invalidĀ
+PASS Check headers set with an invalid name [object Object]
+PASS Check headers set with an invalid value invalidĀ
+PASS Check headers append with an invalid name invalidĀ
+PASS Check headers append with an invalid name [object Object]
+PASS Check headers append with an invalid value invalidĀ
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-errors.html (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-errors.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-errors.html 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,83 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers errors</title>
+ <meta name="help" href=""
+ <meta name="author" title="Canon Research France" href=""
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Headers([["name"]]); });
+ }, "Create headers giving an array having one string as init argument");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Headers([["invalid", "invalidValue1", "invalidValue2"]]); });
+ }, "Create headers giving an array having three strings as init argument");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Headers([["invalidĀ", "Value1"]]); });
+ }, "Create headers giving bad header name as init argument");
+
+ test(function() {
+ assert_throws(new TypeError() , function() { new Headers([["name", "invalidValueĀ"]]); });
+ }, "Create headers giving bad header value as init argument");
+
+ var badNames = ["invalidĀ", {}];
+ var badValues = ["invalidĀ"];
+
+ badNames.forEach(function(name) {
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.get(name); });
+ }, "Check headers get with an invalid name " + name);
+ });
+
+ badNames.forEach(function(name) {
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.delete(name); });
+ }, "Check headers delete with an invalid name " + name);
+ });
+
+ badNames.forEach(function(name) {
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.has(name); });
+ }, "Check headers has with an invalid name " + name);
+ });
+
+ badNames.forEach(function(name) {
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.set(name, "Value1"); });
+ }, "Check headers set with an invalid name " + name);
+ });
+
+ badValues.forEach(function(value) {
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.set("name", value); });
+ }, "Check headers set with an invalid value " + value);
+ });
+
+ badNames.forEach(function(name) {
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.append("invalidĀ", "Value1"); });
+ }, "Check headers append with an invalid name " + name);
+ });
+
+ badValues.forEach(function(value) {
+ test(function() {
+ var headers = new Headers();
+ assert_throws(new TypeError() , function() { headers.append("name", value); });
+ }, "Check headers append with an invalid value " + value);
+ });
+ </script>
+ </body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl-expected.txt (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,24 @@
+
+FAIL Headers interface: existence and properties of interface object assert_equals: class string of Headers expected "[object Function]" but got "[object HeadersConstructor]"
+PASS Headers interface object length
+PASS Headers interface object name
+PASS Headers interface: existence and properties of interface prototype object
+FAIL Headers interface: existence and properties of interface prototype object's "constructor" property assert_true: Headers.prototype.constructor is not writable expected true got false
+PASS Headers interface: operation append(ByteString,ByteString)
+PASS Headers interface: operation delete(ByteString)
+PASS Headers interface: operation get(ByteString)
+PASS Headers interface: operation has(ByteString)
+PASS Headers interface: operation set(ByteString,ByteString)
+PASS Headers must be primary interface of new Headers()
+PASS Stringification of new Headers()
+PASS Headers interface: new Headers() must inherit property "append" with the proper type (0)
+PASS Headers interface: calling append(ByteString,ByteString) on new Headers() with too few arguments must throw TypeError
+PASS Headers interface: new Headers() must inherit property "delete" with the proper type (1)
+PASS Headers interface: calling delete(ByteString) on new Headers() with too few arguments must throw TypeError
+PASS Headers interface: new Headers() must inherit property "get" with the proper type (2)
+PASS Headers interface: calling get(ByteString) on new Headers() with too few arguments must throw TypeError
+PASS Headers interface: new Headers() must inherit property "has" with the proper type (3)
+PASS Headers interface: calling has(ByteString) on new Headers() with too few arguments must throw TypeError
+PASS Headers interface: new Headers() must inherit property "set" with the proper type (4)
+PASS Headers interface: calling set(ByteString,ByteString) on new Headers() with too few arguments must throw TypeError
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl.html (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl.html 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,36 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers idl interface</title>
+ <meta name="help" href=""
+ <meta name="author" title="Canon Research France" href=""
+ <script src=""
+ <script src=""
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script id="headers-idl" type="text/plain">
+ typedef (Headers or sequence<sequence<ByteString>> or OpenEndedDictionary<ByteString>) HeadersInit;
+
+ [Constructor(optional HeadersInit init),
+ Exposed=(Window,Worker)]
+ interface Headers {
+ void append(ByteString name, ByteString value);
+ void delete(ByteString name);
+ ByteString? get(ByteString name);
+ boolean has(ByteString name);
+ void set(ByteString name, ByteString value);
+ iterable<ByteString, ByteString>;
+ };
+ </script>
+ <script>
+ var idlsArray = new IdlArray();
+ var idl = document.getElementById("headers-idl").innerHTML
+ idlsArray.add_idls(idl);
+ idlsArray.add_objects({ Headers: ['new Headers()'] });
+ idlsArray.test();
+ </script>
+ </body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-nameshake-expected.txt (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-nameshake-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-nameshake-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,6 @@
+
+PASS Create headers using same name for different values
+PASS Check delete and has methods when using same name for different values
+PASS Check set methods when called with already used name
+PASS Check append methods when called with already used name
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-nameshake.html (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-nameshake.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-nameshake.html 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,60 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers nameshake</title>
+ <meta name="help" href=""
+ <meta name="author" title="Canon Research France" href=""
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+ var headerSeqNameshake = [["single", "singleValue"],
+ ["double", "doubleValue1"],
+ ["double", "doubleValue2"],
+ ["triple", "tripleValue1"],
+ ["triple", "tripleValue2"],
+ ["triple", "tripleValue3"]
+ ];
+ var expectedDict = {"single": "singleValue",
+ "double": "doubleValue1, doubleValue2",
+ "triple": "tripleValue1, tripleValue2, tripleValue3"
+ };
+
+ test(function() {
+ var headers = new Headers(headerSeqNameshake);
+ for (name in expectedDict)
+ assert_equals(headers.get(name), expectedDict[name],
+ "name: " + name + " has value: " + expectedDict[name]);
+ }, "Create headers using same name for different values");
+
+ test(function() {
+ var headers = new Headers(headerSeqNameshake);
+ for (name in expectedDict) {
+ assert_true(headers.has(name), "name: " + name + " has value(s)");
+ headers.delete(name);
+ assert_false(headers.has(name), "name: " + name + " has no value(s) anymore");
+ }
+ }, "Check delete and has methods when using same name for different values");
+
+ test(function() {
+ var headers = new Headers(headerSeqNameshake);
+ for (name in expectedDict) {
+ headers.set(name,"newSingleValue");
+ assert_equals(headers.get(name), "newSingleValue", "name: " + name + " has value: newSingleValue");
+ }
+ }, "Check set methods when called with already used name");
+
+ test(function() {
+ var headers = new Headers(headerSeqNameshake);
+ for (name in expectedDict) {
+ var value = headers.get(name);
+ headers.append(name,"newSingleValue");
+ assert_equals(headers.get(name), (value + ", " + "newSingleValue"),
+ "name: " + name + " has value: " + headers.get(name));
+ }
+ }, "Check append methods when called with already used name");
+ </script>
+ </body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-normalize-expected.txt (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-normalize-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-normalize-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,5 @@
+
+PASS Create headers with not normalized values
+PASS Check append method whith not normalized values
+PASS Check set method whith not normalized values
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-normalize.html (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-normalize.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-normalize.html 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,47 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers normalize values</title>
+ <meta name="help" href=""
+ <meta name="author" title="Canon Research France" href=""
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+ var headerDictWS = {"name1": " space ",
+ "name2": "\ttab\t",
+ "name3": " spaceAndTab\t",
+ "name4": "\r\n newLine", //obs-fold cases
+ "name5": "newLine\r\n ",
+ "name6": "\r\n\tnewLine",
+ };
+
+ test(function() {
+ var headers = new Headers(headerDictWS);
+ for (name in headerDictWS)
+ assert_equals(headers.get(name), headerDictWS[name].trim(),
+ "name: " + name + " has normalized value: " + headerDictWS[name].trim());
+ }, "Create headers with not normalized values");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDictWS) {
+ headers.append(name, headerDictWS[name]);
+ assert_equals(headers.get(name), headerDictWS[name].trim(),
+ "name: " + name + " has value: " + headerDictWS[name].trim());
+ }
+ }, "Check append method whith not normalized values");
+
+ test(function() {
+ var headers = new Headers();
+ for (name in headerDictWS) {
+ headers.set(name, headerDictWS[name]);
+ assert_equals(headers.get(name), headerDictWS[name].trim(),
+ "name: " + name + " has value: " + headerDictWS[name].trim());
+ }
+ }, "Check set method whith not normalized values");
+ </script>
+ </body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-structure-expected.txt (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-structure-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-structure-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,10 @@
+
+PASS Headers has append method
+PASS Headers has delete method
+PASS Headers has get method
+PASS Headers has has method
+PASS Headers has set method
+FAIL Headers has entries method assert_true: headers has entries method expected true got false
+FAIL Headers has keys method assert_true: headers has keys method expected true got false
+FAIL Headers has values method assert_true: headers has values method expected true got false
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-structure.html (0 => 195530)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-structure.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-structure.html 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Headers basic</title>
+ <meta name="help" href=""
+ <meta name="help" href=""
+ <meta name="author" title="Canon Research France" href=""
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+ var headers = new Headers();
+ var methods = ["append",
+ "delete",
+ "get",
+ "has",
+ "set",
+ //Headers is iterable
+ "entries",
+ "keys",
+ "values"
+ ];
+ for (var idx in methods)
+ test(function() {
+ assert_true(methods[idx] in headers, "headers has " + methods[idx] + " method");
+ }, "Headers has " + methods[idx] + " method");
+ </script>
+ </body>
+</html>
Modified: trunk/LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt (195529 => 195530)
--- trunk/LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -39,6 +39,11 @@
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'FileReaderSync').hasOwnProperty('set') is false
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'FileReaderSync').enumerable is false
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'FileReaderSync').configurable is true
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Headers').value is Headers
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('get') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('set') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Headers').enumerable is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Headers').configurable is true
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt (195529 => 195530)
--- trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -743,6 +743,11 @@
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').value is Headers
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'History').value is History
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt (195529 => 195530)
--- trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -39,6 +39,11 @@
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'FileReaderSync').hasOwnProperty('set') is false
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'FileReaderSync').enumerable is false
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'FileReaderSync').configurable is true
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Headers').value is Headers
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('get') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('set') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Headers').enumerable is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Headers').configurable is true
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS [Worker] Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt (195529 => 195530)
--- trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -758,6 +758,11 @@
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').value is Headers
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'History').value is History
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt (195529 => 195530)
--- trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -758,6 +758,11 @@
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').value is Headers
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'History').value is History
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt (195529 => 195530)
--- trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -763,6 +763,11 @@
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').value is Headers
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'History').value is History
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt (195529 => 195530)
--- trunk/LayoutTests/platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/LayoutTests/platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -758,6 +758,11 @@
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').value is Headers
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'History').value is History
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt (195529 => 195530)
--- trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -763,6 +763,11 @@
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').value is Headers
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'History').value is History
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('set') is false
Modified: trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt (195529 => 195530)
--- trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -678,6 +678,11 @@
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'HashChangeEvent').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').value is Headers
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'Headers').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'History').value is History
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'History').hasOwnProperty('set') is false
Modified: trunk/Source/WebCore/CMakeLists.txt (195529 => 195530)
--- trunk/Source/WebCore/CMakeLists.txt 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-01-25 10:53:53 UTC (rev 195530)
@@ -6,6 +6,7 @@
"${WEBCORE_DIR}/Modules/airplay"
"${WEBCORE_DIR}/Modules/battery"
"${WEBCORE_DIR}/Modules/encryptedmedia"
+ "${WEBCORE_DIR}/Modules/fetch"
"${WEBCORE_DIR}/Modules/geolocation"
"${WEBCORE_DIR}/Modules/indexeddb"
"${WEBCORE_DIR}/Modules/indexeddb/client"
@@ -138,6 +139,7 @@
Modules/airplay
Modules/battery
Modules/encryptedmedia
+ Modules/fetch
Modules/geolocation
Modules/indexeddb
Modules/indieui
@@ -169,6 +171,8 @@
Modules/battery/BatteryManager.idl
Modules/battery/NavigatorBattery.idl
+ Modules/fetch/FetchHeaders.idl
+
Modules/geolocation/Coordinates.idl
Modules/geolocation/Geolocation.idl
Modules/geolocation/Geoposition.idl
@@ -810,6 +814,8 @@
Modules/battery/BatteryStatus.cpp
Modules/battery/NavigatorBattery.cpp
+ Modules/fetch/FetchHeaders.cpp
+
Modules/geolocation/Coordinates.cpp
Modules/geolocation/GeoNotifier.cpp
Modules/geolocation/Geolocation.cpp
@@ -3640,6 +3646,7 @@
# WebCore JS Builtins
set(WebCore_BUILTINS_SOURCES
+ ${WEBCORE_DIR}/Modules/fetch/FetchHeaders.js
${WEBCORE_DIR}/Modules/mediastream/MediaDevices.js
${WEBCORE_DIR}/Modules/mediastream/NavigatorUserMedia.js
${WEBCORE_DIR}/Modules/mediastream/RTCPeerConnection.js
Modified: trunk/Source/WebCore/ChangeLog (195529 => 195530)
--- trunk/Source/WebCore/ChangeLog 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/Source/WebCore/ChangeLog 2016-01-25 10:53:53 UTC (rev 195530)
@@ -1,3 +1,53 @@
+2016-01-25 Youenn Fablet <[email protected]>
+
+ [Fetch API] Implement Fetch API Headers
+ https://bugs.webkit.org/show_bug.cgi?id=152384
+
+ Reviewed by Darin Adler.
+
+ Adding Fetch Headers API as a wapper around HTTPHeaderMap.
+
+ Tests: imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html
+ imported/w3c/web-platform-tests/fetch/api/headers/headers-casing.html
+ imported/w3c/web-platform-tests/fetch/api/headers/headers-errors.html
+ imported/w3c/web-platform-tests/fetch/api/headers/headers-idl.html
+ imported/w3c/web-platform-tests/fetch/api/headers/headers-nameshake.html
+ imported/w3c/web-platform-tests/fetch/api/headers/headers-normalize.html
+ imported/w3c/web-platform-tests/fetch/api/headers/headers-structure.html
+
+ * CMakeLists.txt:
+ * DerivedSources.cpp:
+ * DerivedSources.make:
+ * Modules/fetch/FetchHeaders.cpp: Added.
+ (WebCore::FetchHeaders::initializeWith):
+ (WebCore::isForbiddenHeaderName):
+ (WebCore::isForbiddenResponseHeaderName):
+ (WebCore::isSimpleHeader):
+ (WebCore::canWriteHeader):
+ (WebCore::FetchHeaders::append):
+ (WebCore::FetchHeaders::remove):
+ (WebCore::FetchHeaders::get):
+ (WebCore::FetchHeaders::has):
+ (WebCore::FetchHeaders::set):
+ * Modules/fetch/FetchHeaders.h: Added.
+ (WebCore::FetchHeaders::create):
+ (WebCore::FetchHeaders::~FetchHeaders):
+ (WebCore::FetchHeaders::internalHeaders):
+ (WebCore::FetchHeaders::FetchHeaders):
+ * Modules/fetch/FetchHeaders.idl: Added.
+ * Modules/fetch/FetchHeaders.js: Added.
+ (initializeFetchHeaders):
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/WebCoreBuiltinNames.h:
+ * bindings/js/WebCoreJSBuiltins.cpp:
+ * bindings/js/WebCoreJSBuiltins.h:
+ (WebCore::JSBuiltinFunctions::JSBuiltinFunctions):
+ (WebCore::JSBuiltinFunctions::fetchHeadersBuiltins):
+ * platform/network/HTTPHeaderMap.cpp:
+ (WebCore::HTTPHeaderMap::contains):
+ (WebCore::HTTPHeaderMap::remove):
+ * platform/network/HTTPHeaderMap.h:
+
2016-01-22 Sergio Villar Senin <[email protected]>
[css-grid] grid shorthand must reset gap properties to their initial values
Modified: trunk/Source/WebCore/DerivedSources.cpp (195529 => 195530)
--- trunk/Source/WebCore/DerivedSources.cpp 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/Source/WebCore/DerivedSources.cpp 2016-01-25 10:53:53 UTC (rev 195530)
@@ -154,6 +154,7 @@
#include "JSEvent.cpp"
#include "JSEventSource.cpp"
#include "JSEventTarget.cpp"
+#include "JSFetchHeaders.cpp"
#include "JSFile.cpp"
#include "JSFileError.cpp"
#include "JSFileException.cpp"
Modified: trunk/Source/WebCore/DerivedSources.make (195529 => 195530)
--- trunk/Source/WebCore/DerivedSources.make 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/Source/WebCore/DerivedSources.make 2016-01-25 10:53:53 UTC (rev 195530)
@@ -30,6 +30,7 @@
$(WebCore) \
$(WebCore)/Modules/airplay \
$(WebCore)/Modules/encryptedmedia \
+ $(WebCore)/Modules/fetch \
$(WebCore)/Modules/gamepad \
$(WebCore)/Modules/geolocation \
$(WebCore)/Modules/indexeddb \
@@ -53,6 +54,7 @@
$(WebCore)/css \
$(WebCore)/dom \
$(WebCore)/editing \
+ $(WebCore)/fetch \
$(WebCore)/fileapi \
$(WebCore)/html \
$(WebCore)/html/canvas \
@@ -77,6 +79,7 @@
$(WebCore)/Modules/encryptedmedia/MediaKeyNeededEvent.idl \
$(WebCore)/Modules/encryptedmedia/MediaKeySession.idl \
$(WebCore)/Modules/encryptedmedia/MediaKeys.idl \
+ $(WebCore)/Modules/fetch/FetchHeaders.idl \
$(WebCore)/Modules/gamepad/Gamepad.idl \
$(WebCore)/Modules/gamepad/GamepadButton.idl \
$(WebCore)/Modules/gamepad/GamepadEvent.idl \
@@ -1253,6 +1256,7 @@
# WebCore JS Builtins
WebCore_BUILTINS_SOURCES = \
+ $(WebCore)/Modules/fetch/FetchHeaders.js \
$(WebCore)/Modules/mediastream/MediaDevices.js \
$(WebCore)/Modules/mediastream/NavigatorUserMedia.js \
$(WebCore)/Modules/mediastream/RTCPeerConnection.js \
Added: trunk/Source/WebCore/Modules/fetch/FetchHeaders.cpp (0 => 195530)
--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.cpp 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Canon Inc. nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FetchHeaders.h"
+
+#if ENABLE(FETCH_API)
+
+#include "ExceptionCode.h"
+#include "HTTPParsers.h"
+
+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)
+{
+ HTTPHeaderName headerName;
+ if (findHTTPHeaderName(name, headerName)) {
+ switch (headerName) {
+ case HTTPHeaderName::AcceptCharset:
+ case HTTPHeaderName::AcceptEncoding:
+ case HTTPHeaderName::AccessControlRequestHeaders:
+ case HTTPHeaderName::AccessControlRequestMethod:
+ case HTTPHeaderName::Connection:
+ case HTTPHeaderName::ContentLength:
+ case HTTPHeaderName::Cookie:
+ case HTTPHeaderName::Cookie2:
+ case HTTPHeaderName::Date:
+ case HTTPHeaderName::DNT:
+ case HTTPHeaderName::Expect:
+ case HTTPHeaderName::Host:
+ case HTTPHeaderName::KeepAlive:
+ case HTTPHeaderName::Origin:
+ case HTTPHeaderName::Referer:
+ case HTTPHeaderName::TE:
+ case HTTPHeaderName::Trailer:
+ case HTTPHeaderName::TransferEncoding:
+ case HTTPHeaderName::Upgrade:
+ case HTTPHeaderName::Via:
+ return true;
+ default:
+ break;
+ }
+ }
+ return name.startsWithIgnoringASCIICase(ASCIILiteral("Sec-")) || name.startsWithIgnoringASCIICase(ASCIILiteral("Proxy-"));
+}
+
+static bool isForbiddenResponseHeaderName(const String& name)
+{
+ return equalLettersIgnoringASCIICase(name, "set-cookie") || equalLettersIgnoringASCIICase(name, "set-cookie2");
+}
+
+static bool isSimpleHeader(const String& name, const String& value)
+{
+ HTTPHeaderName headerName;
+ if (!findHTTPHeaderName(name, headerName))
+ return false;
+ switch (headerName) {
+ case HTTPHeaderName::Accept:
+ case HTTPHeaderName::AcceptLanguage:
+ case HTTPHeaderName::ContentLanguage:
+ return true;
+ case HTTPHeaderName::ContentType: {
+ String mimeType = extractMIMETypeFromMediaType(value);
+ return equalLettersIgnoringASCIICase(mimeType, "application/x-www-form-urlencoded") || equalLettersIgnoringASCIICase(mimeType, "multipart/form-data") || equalLettersIgnoringASCIICase(mimeType, "text/plain");
+ }
+ default:
+ return false;
+ }
+}
+
+static bool canWriteHeader(const String& name, const String& value, FetchHeaders::Guard guard)
+{
+ if (!isValidHTTPToken(name) || !isValidHTTPHeaderValue(value))
+ return false;
+ if (guard == FetchHeaders::Guard::Immutable)
+ return false;
+ if (guard == FetchHeaders::Guard::Request && isForbiddenHeaderName(name))
+ return false;
+ if (guard == FetchHeaders::Guard::RequestNoCors && !isSimpleHeader(name, value))
+ return false;
+ if (guard == FetchHeaders::Guard::Response && isForbiddenResponseHeaderName(name))
+ return false;
+ return true;
+}
+
+void FetchHeaders::append(const String& name, const String& value, ExceptionCode& ec)
+{
+ String normalizedValue = stripLeadingAndTrailingHTTPSpaces(value);
+ if (!canWriteHeader(name, normalizedValue, m_guard)) {
+ ec = TypeError;
+ return;
+ }
+ m_headers.add(name, normalizedValue);
+}
+
+void FetchHeaders::remove(const String& name, ExceptionCode& ec)
+{
+ if (!canWriteHeader(name, String(), m_guard)) {
+ ec = TypeError;
+ return;
+ }
+ m_headers.remove(name);
+}
+
+String FetchHeaders::get(const String& name, ExceptionCode& ec) const
+{
+ if (!isValidHTTPToken(name)) {
+ ec = TypeError;
+ return String();
+ }
+ return m_headers.get(name);
+}
+
+bool FetchHeaders::has(const String& name, ExceptionCode& ec) const
+{
+ if (!isValidHTTPToken(name)) {
+ ec = TypeError;
+ return false;
+ }
+ return m_headers.contains(name);
+}
+
+void FetchHeaders::set(const String& name, const String& value, ExceptionCode& ec)
+{
+ String normalizedValue = stripLeadingAndTrailingHTTPSpaces(value);
+ if (!canWriteHeader(name, normalizedValue, m_guard)) {
+ ec = TypeError;
+ return;
+ }
+ m_headers.set(name, normalizedValue);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(FETCH_API)
Added: trunk/Source/WebCore/Modules/fetch/FetchHeaders.h (0 => 195530)
--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.h (rev 0)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.h 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Canon Inc. nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FetchHeaders_h
+#define FetchHeaders_h
+
+#if ENABLE(FETCH_API)
+
+#include "HTTPHeaderMap.h"
+
+namespace WebCore {
+
+typedef int ExceptionCode;
+
+class FetchHeaders : public RefCounted<FetchHeaders> {
+public:
+ enum class Guard {
+ None,
+ Immutable,
+ Request,
+ RequestNoCors,
+ Response
+ };
+
+ static Ref<FetchHeaders> create(Guard guard = Guard::None) { return adoptRef(*new FetchHeaders(guard)); }
+
+ void append(const String& name, const String& value, ExceptionCode&);
+ void remove(const String&, ExceptionCode&);
+ String get(const String&, ExceptionCode&) const;
+ bool has(const String&, ExceptionCode&) const;
+ void set(const String& name, const String& value, ExceptionCode&);
+
+ void initializeWith(const FetchHeaders*, ExceptionCode&);
+
+private:
+ FetchHeaders(Guard guard) : m_guard(guard) { }
+
+ Guard m_guard;
+ HTTPHeaderMap m_headers;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(FETCH_API)
+
+#endif // FetchHeaders_h
Added: trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl (0 => 195530)
--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl (rev 0)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Canon Inc. nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ Conditional=FETCH_API,
+ GlobalContext=DOMWindow&WorkerGlobalScope,
+ ImplementationLacksVTable,
+ InterfaceName=Headers,
+ JSBuiltinConstructor
+]
+interface FetchHeaders {
+ [RaisesException] void append(DOMString name, DOMString value);
+ [RaisesException, ImplementedAs=remove] void delete(DOMString name);
+ [RaisesException, TreatReturnedNullStringAs=Null] DOMString get(DOMString name);
+ [RaisesException] boolean has(DOMString name);
+ [RaisesException] void set(DOMString name, DOMString value);
+
+ // FIXME: Support iterable.
+ //iterable<DOMString, DOMString>;
+
+ [Private, RaisesException, ImplementedAs=append] void appendFromJS(DOMString name, DOMString value);
+ [Private, RaisesException] void initializeWith(FetchHeaders headers);
+};
Added: trunk/Source/WebCore/Modules/fetch/FetchHeaders.js (0 => 195530)
--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.js (rev 0)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.js 2016-01-25 10:53:53 UTC (rev 195530)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CANON INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// @conditional=ENABLE(FETCH_API)
+
+function initializeFetchHeaders(headersInit)
+{
+ "use strict";
+
+ if (headersInit === undefined)
+ return this;
+
+ if (!@isObject(headersInit))
+ throw new @TypeError("headersInit must be an object");
+
+ if (this.constructor === headersInit.constructor) {
+ // FIXME: Use iterators when available?
+ this.@initializeWith(headersInit);
+ }
+
+ if (headersInit instanceof @Array) {
+ for (let i = 0; i < headersInit.length; i++) {
+ let header = headersInit[i];
+ if (header.length !== 2)
+ throw new @TypeError("headersInit sequence items should contain two values");
+ this.@appendFromJS(header[0], header[1]);
+ }
+ }
+
+ @Object.@getOwnPropertyNames(headersInit).forEach((name) => {
+ this.@appendFromJS(name, headersInit[name]);
+ });
+
+ return this;
+}
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (195529 => 195530)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-01-25 10:53:53 UTC (rev 195530)
@@ -1547,6 +1547,7 @@
41F066E50F64BCF600A07EAC /* ScriptGlobalObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F066E30F64BCF600A07EAC /* ScriptGlobalObject.cpp */; };
41F1D21F0EF35C2A00DA8753 /* ScriptCachedFrameData.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F1D21D0EF35C2A00DA8753 /* ScriptCachedFrameData.h */; settings = {ATTRIBUTES = (Private, ); }; };
41F1D2200EF35C2A00DA8753 /* ScriptCachedFrameData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F1D21E0EF35C2A00DA8753 /* ScriptCachedFrameData.cpp */; };
+ 41F54F8D1C50C50800338488 /* FetchHeaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F54F821C50C4F600338488 /* FetchHeaders.cpp */; };
41F584C7104652CB009CAA64 /* JSMessagePortCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F584C6104652CB009CAA64 /* JSMessagePortCustom.h */; };
41FA303E1316C29C00C0BFC5 /* RenderMediaControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FA303C1316C29C00C0BFC5 /* RenderMediaControls.cpp */; };
41FA303F1316C29C00C0BFC5 /* RenderMediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FA303D1316C29C00C0BFC5 /* RenderMediaControls.h */; };
@@ -2775,6 +2776,8 @@
7CEAC1091B483D7F00334482 /* NodeOrString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAC1081B483D7F00334482 /* NodeOrString.cpp */; };
7CFDC57C1AC1D80500E24A57 /* ContentExtensionError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFDC57A1AC1D80500E24A57 /* ContentExtensionError.cpp */; };
7CFDC57D1AC1D80500E24A57 /* ContentExtensionError.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CFDC57B1AC1D80500E24A57 /* ContentExtensionError.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 7D4C96DC1AD4483500365A50 /* JSFetchHeaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7D4C96D81AD4483500365A50 /* JSFetchHeaders.cpp */; };
+ 7D4C96DD1AD4483500365A50 /* JSFetchHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 7D4C96D91AD4483500365A50 /* JSFetchHeaders.h */; };
7D741BDA177226AA00859170 /* CSSValueKeywords.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 6565814809D13043000E61D7 /* CSSValueKeywords.h */; };
7E37EF2E1339208800B29250 /* SubresourceLoaderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E37EF2D1339208800B29250 /* SubresourceLoaderCF.cpp */; };
7E428CE513E3407F003B661C /* ResourceHandleIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E428CE413E3407F003B661C /* ResourceHandleIOS.mm */; };
@@ -8940,6 +8943,10 @@
41F066E30F64BCF600A07EAC /* ScriptGlobalObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptGlobalObject.cpp; sourceTree = "<group>"; };
41F1D21D0EF35C2A00DA8753 /* ScriptCachedFrameData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCachedFrameData.h; sourceTree = "<group>"; };
41F1D21E0EF35C2A00DA8753 /* ScriptCachedFrameData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCachedFrameData.cpp; sourceTree = "<group>"; };
+ 41F54F821C50C4F600338488 /* FetchHeaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchHeaders.cpp; sourceTree = "<group>"; };
+ 41F54F831C50C4F600338488 /* FetchHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchHeaders.h; sourceTree = "<group>"; };
+ 41F54F841C50C4F600338488 /* FetchHeaders.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchHeaders.idl; sourceTree = "<group>"; };
+ 41F54F851C50C4F600338488 /* FetchHeaders.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = FetchHeaders.js; sourceTree = "<group>"; };
41F584C6104652CB009CAA64 /* JSMessagePortCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessagePortCustom.h; sourceTree = "<group>"; };
41FA303C1316C29C00C0BFC5 /* RenderMediaControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMediaControls.cpp; sourceTree = "<group>"; };
41FA303D1316C29C00C0BFC5 /* RenderMediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMediaControls.h; sourceTree = "<group>"; };
@@ -10318,6 +10325,8 @@
7CEAC1081B483D7F00334482 /* NodeOrString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodeOrString.cpp; sourceTree = "<group>"; };
7CFDC57A1AC1D80500E24A57 /* ContentExtensionError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionError.cpp; sourceTree = "<group>"; };
7CFDC57B1AC1D80500E24A57 /* ContentExtensionError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionError.h; sourceTree = "<group>"; };
+ 7D4C96D81AD4483500365A50 /* JSFetchHeaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchHeaders.cpp; sourceTree = "<group>"; };
+ 7D4C96D91AD4483500365A50 /* JSFetchHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFetchHeaders.h; sourceTree = "<group>"; };
7E37EF2D1339208800B29250 /* SubresourceLoaderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubresourceLoaderCF.cpp; sourceTree = "<group>"; };
7E428CE413E3407F003B661C /* ResourceHandleIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceHandleIOS.mm; sourceTree = "<group>"; };
7E46F6F81627A2C900062223 /* JSOESElementIndexUint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESElementIndexUint.cpp; sourceTree = "<group>"; };
@@ -15734,6 +15743,7 @@
A83B790E0CCAFF97000B0825 /* CSS */,
CDA98DCD1601515C00FEA3B1 /* EncryptedMedia */,
A83B79120CCB003F000B0825 /* Events */,
+ 42A023FA1A39F13A00F722CF /* FetchAPI */,
89878576122CA1DA003AABDA /* FileAPI */,
518F4FFC194CABE30081BAAE /* Gamepad */,
A83B79080CCAFF2B000B0825 /* HTML */,
@@ -16573,6 +16583,26 @@
name = Streams;
sourceTree = "<group>";
};
+ 41F54F7C1C50C4F600338488 /* fetch */ = {
+ isa = PBXGroup;
+ children = (
+ 41F54F821C50C4F600338488 /* FetchHeaders.cpp */,
+ 41F54F831C50C4F600338488 /* FetchHeaders.h */,
+ 41F54F841C50C4F600338488 /* FetchHeaders.idl */,
+ 41F54F851C50C4F600338488 /* FetchHeaders.js */,
+ );
+ path = fetch;
+ sourceTree = "<group>";
+ };
+ 42A023FA1A39F13A00F722CF /* FetchAPI */ = {
+ isa = PBXGroup;
+ children = (
+ 7D4C96D81AD4483500365A50 /* JSFetchHeaders.cpp */,
+ 7D4C96D91AD4483500365A50 /* JSFetchHeaders.h */,
+ );
+ name = FetchAPI;
+ sourceTree = "<group>";
+ };
439046C212DA25CE00AF80A2 /* mathml */ = {
isa = PBXGroup;
children = (
@@ -19245,6 +19275,7 @@
children = (
CE26169D187E6554007955F3 /* airplay */,
CDA98DBD16014E0800FEA3B1 /* encryptedmedia */,
+ 41F54F7C1C50C4F600338488 /* fetch */,
518F4FE9194CA4B60081BAAE /* gamepad */,
971145FF14EF007900674FD9 /* geolocation */,
9712A55315004E3C0048AF10 /* indexeddb */,
@@ -26389,6 +26420,7 @@
077664FD183E6B5C00133B92 /* JSQuickTimePluginReplacement.h in Headers */,
B658FFA21522EF3A00DD5595 /* JSRadioNodeList.h in Headers */,
65DF320209D1CC60000BE325 /* JSRange.h in Headers */,
+ 7D4C96DD1AD4483500365A50 /* JSFetchHeaders.h in Headers */,
7C4C96DD1AD4483500365A50 /* JSReadableStream.h in Headers */,
6C4C96DF1AD4483500365A50 /* JSReadableStreamController.h in Headers */,
4129DF861BB5B80C00322A16 /* JSReadableStreamPrivateConstructors.h in Headers */,
@@ -30091,6 +30123,7 @@
077664FC183E6B5C00133B92 /* JSQuickTimePluginReplacement.cpp in Sources */,
B658FFA11522EF3A00DD5595 /* JSRadioNodeList.cpp in Sources */,
65DF320109D1CC60000BE325 /* JSRange.cpp in Sources */,
+ 7D4C96DC1AD4483500365A50 /* JSFetchHeaders.cpp in Sources */,
7C4C96DC1AD4483500365A50 /* JSReadableStream.cpp in Sources */,
6C4C96DE1AD4483500365A50 /* JSReadableStreamController.cpp in Sources */,
4129DF851BB5B80700322A16 /* JSReadableStreamPrivateConstructors.cpp in Sources */,
@@ -30212,6 +30245,7 @@
B2FA3D940AB75A6F000E5AC4 /* JSSVGFETurbulenceElement.cpp in Sources */,
B2FA3D960AB75A6F000E5AC4 /* JSSVGFilterElement.cpp in Sources */,
B27B28250CEF0C0700D39D54 /* JSSVGFontElement.cpp in Sources */,
+ 41F54F8D1C50C50800338488 /* FetchHeaders.cpp in Sources */,
A83B79040CCAFF15000B0825 /* JSSVGFontFaceElement.cpp in Sources */,
A83B79010CCAFF15000B0825 /* JSSVGFontFaceFormatElement.cpp in Sources */,
A83B79030CCAFF15000B0825 /* JSSVGFontFaceNameElement.cpp in Sources */,
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (195529 => 195530)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2016-01-25 10:53:53 UTC (rev 195530)
@@ -32,13 +32,15 @@
namespace WebCore {
#define WEBCORE_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(macro)\
- macro(operations) \
+ macro(appendFromJS) \
macro(closeRequested) \
macro(closedPromiseCapability) \
macro(controlledReadableStream) \
macro(controller) \
macro(disturbed) \
macro(getUserMediaFromJS) \
+ macro(initializeWith) \
+ macro(operations) \
macro(ownerReadableStream) \
macro(privateGetStats) \
macro(pulling) \
Modified: trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp (195529 => 195530)
--- trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.cpp 2016-01-25 10:53:53 UTC (rev 195530)
@@ -26,6 +26,10 @@
#include "config.h"
+#if ENABLE(FETCH_API)
+#include "FetchHeadersBuiltins.cpp"
+#endif
+
#if ENABLE(MEDIA_STREAM)
#include "MediaDevicesBuiltins.cpp"
#include "NavigatorUserMediaBuiltins.cpp"
Modified: trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.h (195529 => 195530)
--- trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.h 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/Source/WebCore/bindings/js/WebCoreJSBuiltins.h 2016-01-25 10:53:53 UTC (rev 195530)
@@ -27,6 +27,10 @@
#ifndef WebCoreJSBuiltins_h
#define WebCoreJSBuiltins_h
+#if ENABLE(FETCH_API)
+#include "FetchHeadersBuiltins.h"
+#endif
+
#if ENABLE(MEDIA_STREAM)
#include "MediaDevicesBuiltins.h"
#include "NavigatorUserMediaBuiltins.h"
@@ -54,6 +58,9 @@
public:
explicit JSBuiltinFunctions(JSC::VM& v)
: vm(v)
+#if ENABLE(FETCH_API)
+ , m_fetchHeadersBuiltins(&vm)
+#endif
#if ENABLE(STREAMS_API)
, m_byteLengthQueuingStrategyBuiltins(&vm)
, m_countQueuingStrategyBuiltins(&vm)
@@ -81,6 +88,9 @@
m_rtcPeerConnectionInternalsBuiltins.exportNames();
#endif
}
+#if ENABLE(FETCH_API)
+ FetchHeadersBuiltinsWrapper& fetchHeadersBuiltins() { return m_fetchHeadersBuiltins; }
+#endif
#if ENABLE(STREAMS_API)
ByteLengthQueuingStrategyBuiltinsWrapper& byteLengthQueuingStrategyBuiltins() { return m_byteLengthQueuingStrategyBuiltins; }
CountQueuingStrategyBuiltinsWrapper& countQueuingStrategyBuiltins() { return m_countQueuingStrategyBuiltins; }
@@ -101,6 +111,9 @@
private:
JSC::VM& vm;
+#if ENABLE(FETCH_API)
+ FetchHeadersBuiltinsWrapper m_fetchHeadersBuiltins;
+#endif
#if ENABLE(STREAMS_API)
ByteLengthQueuingStrategyBuiltinsWrapper m_byteLengthQueuingStrategyBuiltins;
CountQueuingStrategyBuiltinsWrapper m_countQueuingStrategyBuiltins;
Modified: trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp (195529 => 195530)
--- trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp 2016-01-25 10:53:53 UTC (rev 195530)
@@ -101,6 +101,22 @@
add(headerName, value);
}
+bool HTTPHeaderMap::contains(const String& name) const
+{
+ HTTPHeaderName headerName;
+ if (findHTTPHeaderName(name, headerName))
+ return contains(headerName);
+ return m_uncommonHeaders.contains(name);
+}
+
+bool HTTPHeaderMap::remove(const String& name)
+{
+ HTTPHeaderName headerName;
+ if (findHTTPHeaderName(name, headerName))
+ return remove(headerName);
+ return m_uncommonHeaders.remove(name);
+}
+
String HTTPHeaderMap::get(HTTPHeaderName name) const
{
return m_commonHeaders.get(name);
Modified: trunk/Source/WebCore/platform/network/HTTPHeaderMap.h (195529 => 195530)
--- trunk/Source/WebCore/platform/network/HTTPHeaderMap.h 2016-01-25 09:24:19 UTC (rev 195529)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderMap.h 2016-01-25 10:53:53 UTC (rev 195530)
@@ -139,6 +139,8 @@
WEBCORE_EXPORT String get(const String& name) const;
WEBCORE_EXPORT void set(const String& name, const String& value);
void add(const String& name, const String& value);
+ bool contains(const String&) const;
+ bool remove(const String&);
WEBCORE_EXPORT String get(HTTPHeaderName) const;
void set(HTTPHeaderName, const String& value);