Title: [227531] trunk
Revision
227531
Author
commit-qu...@webkit.org
Date
2018-01-24 10:10:29 -0800 (Wed, 24 Jan 2018)

Log Message

Fetch response should copy its url from the request if null
https://bugs.webkit.org/show_bug.cgi?id=182048

Patch by Youenn Fablet <you...@apple.com> on 2018-01-24
Reviewed by Chris Dumez.

Source/WebCore:

No change of behavior.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived): Add assertion to check that the response URL is not null.

Source/WebKit:

* WebProcess/Storage/ServiceWorkerClientFetch.cpp:
(WebKit::ServiceWorkerClientFetch::didReceiveResponse):

LayoutTests:

* http/tests/workers/service/basic-fetch.https-expected.txt:
* http/tests/workers/service/resources/basic-fetch.js:
(async.test):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (227530 => 227531)


--- trunk/LayoutTests/ChangeLog	2018-01-24 18:08:02 UTC (rev 227530)
+++ trunk/LayoutTests/ChangeLog	2018-01-24 18:10:29 UTC (rev 227531)
@@ -1,3 +1,14 @@
+2018-01-24  Youenn Fablet  <you...@apple.com>
+
+        Fetch response should copy its url from the request if null
+        https://bugs.webkit.org/show_bug.cgi?id=182048
+
+        Reviewed by Chris Dumez.
+
+        * http/tests/workers/service/basic-fetch.https-expected.txt:
+        * http/tests/workers/service/resources/basic-fetch.js:
+        (async.test):
+
 2018-01-24  Ms2ger  <ms2...@igalia.com>
 
         WPE-focused test gardening.

Modified: trunk/LayoutTests/http/tests/workers/service/basic-fetch.https-expected.txt (227530 => 227531)


--- trunk/LayoutTests/http/tests/workers/service/basic-fetch.https-expected.txt	2018-01-24 18:08:02 UTC (rev 227530)
+++ trunk/LayoutTests/http/tests/workers/service/basic-fetch.https-expected.txt	2018-01-24 18:10:29 UTC (rev 227531)
@@ -1,12 +1,15 @@
 
+test1 url: https://127.0.0.1:8443/workers/service/resources/test1
 test1 status code: 200
 test1 status text: Hello from service worker
 test1 header Hello: World
 test1 source: Service worker
+test2 url: https://127.0.0.1:8443/workers/service/resources/test2
 test2 status code: 500
 test2 status text: Error from service worker
 test2 source: Service worker
 PASS: test3 fetch failed as expected
+test4 url: https://127.0.0.1:8443/workers/service/resources/test4
 test4 status code: 404
 PASS: test5 fetch failed as expected
 PASS: / fetch failed as expected

Modified: trunk/LayoutTests/http/tests/workers/service/resources/basic-fetch.js (227530 => 227531)


--- trunk/LayoutTests/http/tests/workers/service/resources/basic-fetch.js	2018-01-24 18:08:02 UTC (rev 227530)
+++ trunk/LayoutTests/http/tests/workers/service/resources/basic-fetch.js	2018-01-24 18:10:29 UTC (rev 227531)
@@ -5,6 +5,7 @@
         var fetch = frame.contentWindow.fetch;
 
         var response = await fetch("test1");
+        log("test1 url: " + response.url);
         log("test1 status code: " + response.status);
         log("test1 status text: " + response.statusText);
         log("test1 header Hello: " + response.headers.get("hello"));
@@ -13,6 +14,7 @@
             log("test1 source: " + internals.fetchResponseSource(response));
 
         var response = await fetch("test2");
+        log("test2 url: " + response.url);
         log("test2 status code: " + response.status);
         log("test2 status text: " + response.statusText);
 
@@ -30,6 +32,7 @@
         }
 
         var response = await fetch("test4");
+        log("test4 url: " + response.url);
         log("test4 status code: " + response.status);
 
         try {

Modified: trunk/Source/WebCore/ChangeLog (227530 => 227531)


--- trunk/Source/WebCore/ChangeLog	2018-01-24 18:08:02 UTC (rev 227530)
+++ trunk/Source/WebCore/ChangeLog	2018-01-24 18:10:29 UTC (rev 227531)
@@ -1,5 +1,17 @@
 2018-01-24  Youenn Fablet  <you...@apple.com>
 
+        Fetch response should copy its url from the request if null
+        https://bugs.webkit.org/show_bug.cgi?id=182048
+
+        Reviewed by Chris Dumez.
+
+        No change of behavior.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::responseReceived): Add assertion to check that the response URL is not null.
+
+2018-01-24  Youenn Fablet  <you...@apple.com>
+
         Account for memory cache in DocumentThreadableLoader::didReceiveResponse assertion
         https://bugs.webkit.org/show_bug.cgi?id=182049
 

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (227530 => 227531)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2018-01-24 18:08:02 UTC (rev 227530)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2018-01-24 18:10:29 UTC (rev 227531)
@@ -751,6 +751,7 @@
     } else if (response.isMultipart())
         m_isLoadingMultipartContent = true;
 
+    ASSERT(!response.url().isNull());
     m_response = response;
 
     if (m_identifierForLoadWithoutResourceLoader) {

Modified: trunk/Source/WebKit/ChangeLog (227530 => 227531)


--- trunk/Source/WebKit/ChangeLog	2018-01-24 18:08:02 UTC (rev 227530)
+++ trunk/Source/WebKit/ChangeLog	2018-01-24 18:10:29 UTC (rev 227531)
@@ -1,3 +1,13 @@
+2018-01-24  Youenn Fablet  <you...@apple.com>
+
+        Fetch response should copy its url from the request if null
+        https://bugs.webkit.org/show_bug.cgi?id=182048
+
+        Reviewed by Chris Dumez.
+
+        * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
+        (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
+
 2018-01-24  Sergio Villar Senin  <svil...@igalia.com>
 
         Unreviewed build fix after r227518. I forgot to add the function declarations to the WPE

Modified: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp (227530 => 227531)


--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp	2018-01-24 18:08:02 UTC (rev 227530)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp	2018-01-24 18:10:29 UTC (rev 227531)
@@ -136,6 +136,10 @@
     }
     response.setSource(ResourceResponse::Source::ServiceWorker);
 
+    // As per https://fetch.spec.whatwg.org/#main-fetch step 9, copy request's url list in response's url list if empty.
+    if (response.url().isNull())
+        response.setURL(m_loader->request().url());
+
     m_loader->didReceiveResponse(response);
     if (auto callback = WTFMove(m_callback))
         callback(Result::Succeeded);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to