Title: [220244] trunk
Revision
220244
Author
[email protected]
Date
2017-08-03 18:00:13 -0700 (Thu, 03 Aug 2017)

Log Message

[Fetch API] Add support for Request keepalive getter
https://bugs.webkit.org/show_bug.cgi?id=175151

Patch by Youenn Fablet <[email protected]> on 2017-08-03
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/request/request-idl-expected.txt:
* web-platform-tests/fetch/api/request/request-idl.html:
* web-platform-tests/fetch/api/request/request-keepalive-expected.txt: Added.
* web-platform-tests/fetch/api/request/request-keepalive.html: Added.

Source/WebCore:

Test: imported/w3c/web-platform-tests/fetch/api/request/request-keepalive.html

Adding keepalive as a fetch option.
Adding initialization and getter of keepalive into FetchRequest.

* Modules/fetch/FetchRequest.cpp:
(WebCore::buildOptions):
* Modules/fetch/FetchRequest.h:
* Modules/fetch/FetchRequest.idl:
* loader/FetchOptions.h:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (220243 => 220244)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-08-04 00:20:37 UTC (rev 220243)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-08-04 01:00:13 UTC (rev 220244)
@@ -1,5 +1,17 @@
 2017-08-03  Youenn Fablet  <[email protected]>
 
+        [Fetch API] Add support for Request keepalive getter
+        https://bugs.webkit.org/show_bug.cgi?id=175151
+
+        Reviewed by Chris Dumez.
+
+        * web-platform-tests/fetch/api/request/request-idl-expected.txt:
+        * web-platform-tests/fetch/api/request/request-idl.html:
+        * web-platform-tests/fetch/api/request/request-keepalive-expected.txt: Added.
+        * web-platform-tests/fetch/api/request/request-keepalive.html: Added.
+
+2017-08-03  Youenn Fablet  <[email protected]>
+
         Import WPT service worker tests
         https://bugs.webkit.org/show_bug.cgi?id=175053
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt (220243 => 220244)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt	2017-08-04 00:20:37 UTC (rev 220243)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt	2017-08-04 01:00:13 UTC (rev 220244)
@@ -16,6 +16,7 @@
 PASS Request interface: attribute cache 
 PASS Request interface: attribute redirect 
 PASS Request interface: attribute integrity 
+PASS Request interface: attribute keepalive 
 PASS Request interface: operation clone() 
 FAIL Request interface: attribute body assert_true: The prototype object must have a property "body" expected true got false
 PASS Request interface: attribute bodyUsed 
@@ -36,12 +37,13 @@
 PASS Request interface: new Request("") must inherit property "cache" with the proper type (9) 
 PASS Request interface: new Request("") must inherit property "redirect" with the proper type (10) 
 PASS Request interface: new Request("") must inherit property "integrity" with the proper type (11) 
-PASS Request interface: new Request("") must inherit property "clone" with the proper type (12) 
-FAIL Request interface: new Request("") must inherit property "body" with the proper type (13) assert_inherits: property "body" not found in prototype chain
-PASS Request interface: new Request("") must inherit property "bodyUsed" with the proper type (14) 
-PASS Request interface: new Request("") must inherit property "arrayBuffer" with the proper type (15) 
-PASS Request interface: new Request("") must inherit property "blob" with the proper type (16) 
-FAIL Request interface: new Request("") must inherit property "formData" with the proper type (17) assert_inherits: property "formData" not found in prototype chain
-PASS Request interface: new Request("") must inherit property "json" with the proper type (18) 
-PASS Request interface: new Request("") must inherit property "text" with the proper type (19) 
+PASS Request interface: new Request("") must inherit property "keepalive" with the proper type (12) 
+PASS Request interface: new Request("") must inherit property "clone" with the proper type (13) 
+FAIL Request interface: new Request("") must inherit property "body" with the proper type (14) assert_inherits: property "body" not found in prototype chain
+PASS Request interface: new Request("") must inherit property "bodyUsed" with the proper type (15) 
+PASS Request interface: new Request("") must inherit property "arrayBuffer" with the proper type (16) 
+PASS Request interface: new Request("") must inherit property "blob" with the proper type (17) 
+FAIL Request interface: new Request("") must inherit property "formData" with the proper type (18) assert_inherits: property "formData" not found in prototype chain
+PASS Request interface: new Request("") must inherit property "json" with the proper type (19) 
+PASS Request interface: new Request("") must inherit property "text" with the proper type (20) 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html (220243 => 220244)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html	2017-08-04 00:20:37 UTC (rev 220243)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html	2017-08-04 01:00:13 UTC (rev 220244)
@@ -46,6 +46,7 @@
         readonly attribute RequestCache cache;
         readonly attribute RequestRedirect redirect;
         readonly attribute DOMString integrity;
+        readonly attribute boolean keepalive;
 
         [NewObject] Request clone();
       };

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-expected.txt (0 => 220244)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-expected.txt	2017-08-04 01:00:13 UTC (rev 220244)
@@ -0,0 +1,7 @@
+
+PASS Create Request with keep alive values 
+PASS Clone Request with keep alive values 
+FAIL Request with keep alive and ReadableStream body assert_throws: function "() => {
+            new Request("", {keepalive: true, body: new ReadableStream(), method: "POST"});
+          }" did not throw
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive.html (0 => 220244)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive.html	2017-08-04 01:00:13 UTC (rev 220244)
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Request init: keep alive</title>
+    <script src=""
+    <script src=""
+  </head>
+  <body>
+    <script>
+      test(function() {
+          var requestBody = "body";
+          assert_true(new Request("", {keepalive: true, body: requestBody, method: "POST"}).keepalive, "set keep alive to true");
+          assert_false(new Request("", {keepalive: false, body: requestBody, method: "POST"}).keepalive, "set keep alive to false");
+          assert_false(new Request("", {body: requestBody, method: "POST"}).keepalive, "keep alive default value");
+      }, "Create Request with keep alive values");
+
+      test(function() {
+          var requestBody = "body";
+          assert_true(new Request("", {keepalive: true, body: requestBody, method: "POST"}).clone().keepalive, "set keep alive to true");
+          assert_false(new Request("", {keepalive: false, body: requestBody, method: "POST"}).clone().keepalive, "set keep alive to false");
+          assert_false(new Request("", {body: requestBody, method: "POST"}).clone().keepalive, "keep alive default value");
+      }, "Clone Request with keep alive values");
+
+      test(function() {
+          assert_throws(new TypeError(), () => {
+            new Request("", {keepalive: true, body: new ReadableStream(), method: "POST"});
+          });
+      }, "Request with keep alive and ReadableStream body");
+    </script>
+  </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (220243 => 220244)


--- trunk/Source/WebCore/ChangeLog	2017-08-04 00:20:37 UTC (rev 220243)
+++ trunk/Source/WebCore/ChangeLog	2017-08-04 01:00:13 UTC (rev 220244)
@@ -1,3 +1,21 @@
+2017-08-03  Youenn Fablet  <[email protected]>
+
+        [Fetch API] Add support for Request keepalive getter
+        https://bugs.webkit.org/show_bug.cgi?id=175151
+
+        Reviewed by Chris Dumez.
+
+        Test: imported/w3c/web-platform-tests/fetch/api/request/request-keepalive.html
+
+        Adding keepalive as a fetch option.
+        Adding initialization and getter of keepalive into FetchRequest.
+
+        * Modules/fetch/FetchRequest.cpp:
+        (WebCore::buildOptions):
+        * Modules/fetch/FetchRequest.h:
+        * Modules/fetch/FetchRequest.idl:
+        * loader/FetchOptions.h:
+
 2017-08-03  Yoshiaki Jitsukawa  <[email protected]>
 
         [PAL] Move spi/cf directory into PAL

Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp (220243 => 220244)


--- trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp	2017-08-04 00:20:37 UTC (rev 220243)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp	2017-08-04 01:00:13 UTC (rev 220244)
@@ -104,6 +104,9 @@
     if (!init.integrity.isNull())
         request.options.integrity = init.integrity;
 
+    if (init.keepalive && init.keepalive.value())
+        request.options.keepAlive = true;
+
     if (!init.method.isNull()) {
         if (auto exception = setMethod(request.request, init.method))
             return exception;

Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.h (220243 => 220244)


--- trunk/Source/WebCore/Modules/fetch/FetchRequest.h	2017-08-04 00:20:37 UTC (rev 220243)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.h	2017-08-04 01:00:13 UTC (rev 220244)
@@ -67,6 +67,7 @@
     Credentials credentials() const;
     Cache cache() const;
     Redirect redirect() const;
+    bool keepalive() const { return m_internalRequest.options.keepAlive; };
 
     const String& integrity() const { return m_internalRequest.options.integrity; }
 

Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.idl (220243 => 220244)


--- trunk/Source/WebCore/Modules/fetch/FetchRequest.idl	2017-08-04 00:20:37 UTC (rev 220243)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.idl	2017-08-04 01:00:13 UTC (rev 220244)
@@ -56,8 +56,7 @@
     readonly attribute FetchRequestCache cache;
     readonly attribute FetchRequestRedirect redirect;
     readonly attribute DOMString integrity;
-    // FIXME: Add support for keepalive.
-    // readonly attribute boolean keepalive;
+    readonly attribute boolean keepalive;
 
     [CallWith=ScriptExecutionContext, MayThrowException, NewObject] FetchRequest clone();
 };

Modified: trunk/Source/WebCore/loader/FetchOptions.h (220243 => 220244)


--- trunk/Source/WebCore/loader/FetchOptions.h	2017-08-04 00:20:37 UTC (rev 220243)
+++ trunk/Source/WebCore/loader/FetchOptions.h	2017-08-04 01:00:13 UTC (rev 220244)
@@ -55,6 +55,8 @@
     ReferrerPolicy referrerPolicy { ReferrerPolicy::EmptyString };
 
     String integrity;
+
+    bool keepAlive { false };
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to