Title: [205081] trunk
Revision
205081
Author
[email protected]
Date
2016-08-27 11:43:32 -0700 (Sat, 27 Aug 2016)

Log Message

[Fetch API] opaqueredirect responses should have their URL set to the original URL
https://bugs.webkit.org/show_bug.cgi?id=161194

Patch by Youenn Fablet <[email protected]> on 2016-08-27
Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/redirect/redirect-mode.html:
* web-platform-tests/fetch/api/redirect/redirect-mode.js:
(redirectMode): Updating test to ease the computation of the absolute URL.

Source/WebCore:

Covered by updated tests.

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::didReceiveResponse):
* loader/SubresourceLoader.cpp: Removing isNull ASSERT since we now set the response URL.
(WebCore::SubresourceLoader::willSendRequestInternal): Setting opaqueredirect response URL to the original URL.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (205080 => 205081)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-08-27 18:07:52 UTC (rev 205080)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-08-27 18:43:32 UTC (rev 205081)
@@ -1,3 +1,14 @@
+2016-08-27  Youenn Fablet  <[email protected]>
+
+        [Fetch API] opaqueredirect responses should have their URL set to the original URL
+        https://bugs.webkit.org/show_bug.cgi?id=161194
+
+        Reviewed by Sam Weinig.
+
+        * web-platform-tests/fetch/api/redirect/redirect-mode.html:
+        * web-platform-tests/fetch/api/redirect/redirect-mode.js:
+        (redirectMode): Updating test to ease the computation of the absolute URL.
+
 2016-08-27  Andreas Kling  <[email protected]>
 
         script.text should behave like script.textContent on setting

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.html (205080 => 205081)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.html	2016-08-27 18:07:52 UTC (rev 205080)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.html	2016-08-27 18:43:32 UTC (rev 205081)
@@ -10,7 +10,7 @@
     <script src=""
   </head>
   <body>
-    <script src=""
+    <script src=""
     <script src=""
   </body>
-</html>
\ No newline at end of file
+</html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.js (205080 => 205081)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.js	2016-08-27 18:07:52 UTC (rev 205080)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.js	2016-08-27 18:43:32 UTC (rev 205081)
@@ -1,6 +1,6 @@
 if (this.document === undefined) {
   importScripts("/resources/testharness.js");
-  importScripts("../resources/utils.js");
+  importScripts("../resources/get-host-info.sub.js")
 }
 
 function redirectMode(desc, redirectUrl, redirectLocation, redirectStatus, redirectMode) {
@@ -18,6 +18,7 @@
         assert_equals(resp.status, 0, "Response's status is 0");
         assert_equals(resp.type, "opaqueredirect", "Response's type is opaqueredirect");
         assert_equals(resp.statusText, "", "Response's statusText is \"\"");
+        assert_equals(resp.url, url + urlParameters, "Response URL should be the original one");
       });
     if (redirectMode === "follow")
       return fetch(url + urlParameters, requestInit).then(function(resp) {
@@ -28,7 +29,7 @@
   }, desc);
 }
 
-var redirUrl = RESOURCES_DIR + "redirect.py";
+var redirUrl = get_host_info().HTTP_ORIGIN + "/fetch/api/resources/redirect.py";
 var locationUrl = "top.txt";
 
 for (var statusCode of [301, 302, 303, 307, 308]) {

Modified: trunk/Source/WebCore/ChangeLog (205080 => 205081)


--- trunk/Source/WebCore/ChangeLog	2016-08-27 18:07:52 UTC (rev 205080)
+++ trunk/Source/WebCore/ChangeLog	2016-08-27 18:43:32 UTC (rev 205081)
@@ -1,3 +1,17 @@
+2016-08-27  Youenn Fablet  <[email protected]>
+
+        [Fetch API] opaqueredirect responses should have their URL set to the original URL
+        https://bugs.webkit.org/show_bug.cgi?id=161194
+
+        Reviewed by Sam Weinig.
+
+        Covered by updated tests.
+
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::didReceiveResponse):
+        * loader/SubresourceLoader.cpp: Removing isNull ASSERT since we now set the response URL.
+        (WebCore::SubresourceLoader::willSendRequestInternal): Setting opaqueredirect response URL to the original URL.
+
 2016-08-27  Andreas Kling  <[email protected]>
 
         script.text should behave like script.textContent on setting

Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (205080 => 205081)


--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2016-08-27 18:07:52 UTC (rev 205080)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2016-08-27 18:43:32 UTC (rev 205081)
@@ -284,7 +284,7 @@
     if (response.type() == ResourceResponse::Type::Default)
         m_client->didReceiveResponse(identifier, ResourceResponse::filterResponse(response, tainting));
     else {
-        ASSERT(response.isNull() && response.type() == ResourceResponse::Type::Opaqueredirect);
+        ASSERT(response.type() == ResourceResponse::Type::Opaqueredirect);
         m_client->didReceiveResponse(identifier, response);
     }
 }

Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (205080 => 205081)


--- trunk/Source/WebCore/loader/SubresourceLoader.cpp	2016-08-27 18:07:52 UTC (rev 205080)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp	2016-08-27 18:43:32 UTC (rev 205081)
@@ -182,6 +182,7 @@
             }
 
             ResourceResponse opaqueRedirectedResponse;
+            opaqueRedirectedResponse.setURL(redirectResponse.url());
             opaqueRedirectedResponse.setType(ResourceResponse::Type::Opaqueredirect);
             m_resource->responseReceived(opaqueRedirectedResponse);
             didFinishLoading(currentTime());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to