Title: [227770] trunk
Revision
227770
Author
[email protected]
Date
2018-01-29 18:15:14 -0800 (Mon, 29 Jan 2018)

Log Message

ServiceWorkerClientFetch should not consider responses without Location headers as redirection responses
https://bugs.webkit.org/show_bug.cgi?id=182134

Patch by Youenn Fablet <[email protected]> on 2018-01-29
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/service-workers/service-worker/navigation-redirect.https-expected.txt:

Source/WebKit:

As per fetch spec, a response with a redirection status code but no Location header should not be considered as a redirection.
This is also consistent with SubresourceLoader::didReceiveResponse.

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

LayoutTests:

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (227769 => 227770)


--- trunk/LayoutTests/ChangeLog	2018-01-30 02:04:09 UTC (rev 227769)
+++ trunk/LayoutTests/ChangeLog	2018-01-30 02:15:14 UTC (rev 227770)
@@ -1,5 +1,14 @@
 2018-01-29  Youenn Fablet  <[email protected]>
 
+        ServiceWorkerClientFetch should not consider responses without Location headers as redirection responses
+        https://bugs.webkit.org/show_bug.cgi?id=182134
+
+        Reviewed by Chris Dumez.
+
+        * TestExpectations:
+
+2018-01-29  Youenn Fablet  <[email protected]>
+
         Cache API should make sure to resolve caches.open promises in the same order as called
         https://bugs.webkit.org/show_bug.cgi?id=182193
         <rdar://problem/36930363>

Modified: trunk/LayoutTests/TestExpectations (227769 => 227770)


--- trunk/LayoutTests/TestExpectations	2018-01-30 02:04:09 UTC (rev 227769)
+++ trunk/LayoutTests/TestExpectations	2018-01-30 02:15:14 UTC (rev 227770)
@@ -153,7 +153,6 @@
 imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/http-to-https-redirect-and-register.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/respond-with-body-accessed-response.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html [ Skip ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (227769 => 227770)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-01-30 02:04:09 UTC (rev 227769)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-01-30 02:15:14 UTC (rev 227770)
@@ -1,3 +1,12 @@
+2018-01-29  Youenn Fablet  <[email protected]>
+
+        ServiceWorkerClientFetch should not consider responses without Location headers as redirection responses
+        https://bugs.webkit.org/show_bug.cgi?id=182134
+
+        Reviewed by Chris Dumez.
+
+        * web-platform-tests/service-workers/service-worker/navigation-redirect.https-expected.txt:
+
 2018-01-29  Oleksandr Skachkov  <[email protected]>
 
         FetchResponse should support ConsumeData callback on chunk data is received: handling ReadableStream bodies

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https-expected.txt (227769 => 227770)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https-expected.txt	2018-01-30 02:04:09 UTC (rev 227769)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https-expected.txt	2018-01-30 02:15:14 UTC (rev 227770)
@@ -1,6 +1,4 @@
-  
 
-Harness Error (TIMEOUT), message = null
 
 PASS Normal redirect to same-origin scope. 
 PASS Normal redirect to other-origin scope. 
@@ -24,11 +22,11 @@
 PASS Redirect to same-origin other-scope with opaque redirect response. 
 PASS Redirect to other-origin out-scope with opaque redirect response. 
 PASS Redirect to other-origin in-scope with opaque redirect response. 
-TIMEOUT No location redirect response. Test timed out
-NOTRUN Redirect to same-origin out-scope with opaque redirect response which is passed through Cache. 
-NOTRUN Redirect to same-origin same-scope with opaque redirect response which is passed through Cache. 
-NOTRUN Redirect to same-origin other-scope with opaque redirect response which is passed through Cache. 
-NOTRUN Redirect to other-origin out-scope with opaque redirect response which is passed through Cache. 
-NOTRUN Redirect to other-origin in-scope with opaque redirect response which is passed through Cache. 
-NOTRUN No location redirect response via Cache. 
+PASS No location redirect response. 
+PASS Redirect to same-origin out-scope with opaque redirect response which is passed through Cache. 
+PASS Redirect to same-origin same-scope with opaque redirect response which is passed through Cache. 
+PASS Redirect to same-origin other-scope with opaque redirect response which is passed through Cache. 
+PASS Redirect to other-origin out-scope with opaque redirect response which is passed through Cache. 
+PASS Redirect to other-origin in-scope with opaque redirect response which is passed through Cache. 
+PASS No location redirect response via Cache. 
 

Modified: trunk/Source/WebCore/platform/network/HTTPHeaderMap.h (227769 => 227770)


--- trunk/Source/WebCore/platform/network/HTTPHeaderMap.h	2018-01-30 02:04:09 UTC (rev 227769)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderMap.h	2018-01-30 02:15:14 UTC (rev 227770)
@@ -142,7 +142,7 @@
     void set(HTTPHeaderName, const String& value);
     void add(HTTPHeaderName, const String& value);
     bool addIfNotPresent(HTTPHeaderName, const String&);
-    bool contains(HTTPHeaderName) const;
+    WEBCORE_EXPORT bool contains(HTTPHeaderName) const;
     WEBCORE_EXPORT bool remove(HTTPHeaderName);
 
     // Instead of passing a string literal to any of these functions, just use a HTTPHeaderName instead.

Modified: trunk/Source/WebKit/ChangeLog (227769 => 227770)


--- trunk/Source/WebKit/ChangeLog	2018-01-30 02:04:09 UTC (rev 227769)
+++ trunk/Source/WebKit/ChangeLog	2018-01-30 02:15:14 UTC (rev 227770)
@@ -1,5 +1,18 @@
 2018-01-29  Youenn Fablet  <[email protected]>
 
+        ServiceWorkerClientFetch should not consider responses without Location headers as redirection responses
+        https://bugs.webkit.org/show_bug.cgi?id=182134
+
+        Reviewed by Chris Dumez.
+
+        As per fetch spec, a response with a redirection status code but no Location header should not be considered as a redirection.
+        This is also consistent with SubresourceLoader::didReceiveResponse.
+
+        * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
+        (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
+
+2018-01-29  Youenn Fablet  <[email protected]>
+
         Cache API should make sure to resolve caches.open promises in the same order as called
         https://bugs.webkit.org/show_bug.cgi?id=182193
         <rdar://problem/36930363>

Modified: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp (227769 => 227770)


--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp	2018-01-30 02:04:09 UTC (rev 227769)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp	2018-01-30 02:15:14 UTC (rev 227770)
@@ -110,9 +110,8 @@
     }
     response.setSource(ResourceResponse::Source::ServiceWorker);
 
-    if (response.isRedirection()) {
+    if (response.isRedirection() && response.httpHeaderFields().contains(HTTPHeaderName::Location)) {
         m_redirectionStatus = RedirectionStatus::Receiving;
-        // FIXME: Get shouldClearReferrerOnHTTPSToHTTPRedirect value from
         m_loader->willSendRequest(m_loader->request().redirectedRequest(response, m_shouldClearReferrerOnHTTPSToHTTPRedirect), response, [protectedThis = makeRef(*this), this](ResourceRequest&& request) {
             if (request.isNull() || !m_callback)
                 return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to