Title: [218542] releases/WebKitGTK/webkit-2.16/Source/WebCore
Revision
218542
Author
[email protected]
Date
2017-06-19 23:41:48 -0700 (Mon, 19 Jun 2017)

Log Message

Merge r217494 - Minor clean-up related to DocumentThreadableLoader redirections
https://bugs.webkit.org/show_bug.cgi?id=172647

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

No change of behavior.

Decrementing m_options redirect count directly instead of using an
additional counter.

To compare whether two URLs are same-origin, use scheme+host+port check
as per the spec.
This is fine as only the initial origin may have specific rules and we
are using the scheme+host+port checks when already being gone to
another origin.

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::redirectReceived):
* loader/DocumentThreadableLoader.h:
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog (218541 => 218542)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-06-20 06:37:27 UTC (rev 218541)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-06-20 06:41:48 UTC (rev 218542)
@@ -1,3 +1,27 @@
+2017-05-26  Youenn Fablet  <[email protected]>
+
+        Minor clean-up related to DocumentThreadableLoader redirections
+        https://bugs.webkit.org/show_bug.cgi?id=172647
+
+        Reviewed by Chris Dumez.
+
+        No change of behavior.
+
+        Decrementing m_options redirect count directly instead of using an
+        additional counter.
+
+        To compare whether two URLs are same-origin, use scheme+host+port check
+        as per the spec.
+        This is fine as only the initial origin may have specific rules and we
+        are using the scheme+host+port checks when already being gone to
+        another origin.
+
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::redirectReceived):
+        * loader/DocumentThreadableLoader.h:
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
+
 2017-05-25  Chris Dumez  <[email protected]>
 
         imported/w3c/web-platform-tests/html/semantics/forms/form-control-infrastructure/form_owner_and_table_2.html is crashing

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/DocumentThreadableLoader.cpp (218541 => 218542)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/DocumentThreadableLoader.cpp	2017-06-20 06:37:27 UTC (rev 218541)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/DocumentThreadableLoader.cpp	2017-06-20 06:41:48 UTC (rev 218542)
@@ -226,7 +226,7 @@
     ASSERT_UNUSED(resource, &resource == m_resource);
 
     Ref<DocumentThreadableLoader> protectedThis(*this);
-    ++m_redirectCount;
+    --m_options.maxRedirectCount;
 
     // FIXME: We restrict this check to Fetch API for the moment, as this might disrupt WorkerScriptLoader.
     // Reassess this check based on https://github.com/whatwg/fetch/issues/393 discussions.
@@ -256,7 +256,7 @@
     // Use a unique for subsequent loads if needed.
     // https://fetch.spec.whatwg.org/#concept-http-redirect-fetch (Step 10).
     ASSERT(m_options.mode == FetchOptions::Mode::Cors);
-    if (!securityOrigin().canRequest(redirectResponse.url()) && !SecurityOrigin::create(redirectResponse.url())->canRequest(request.url()))
+    if (!securityOrigin().canRequest(redirectResponse.url()) && !protocolHostAndPortAreEqual(redirectResponse.url(), request.url()))
         m_origin = SecurityOrigin::createUnique();
 
     // Except in case where preflight is needed, loading should be able to continue on its own.
@@ -265,8 +265,6 @@
         return;
 
     m_options.allowCredentials = DoNotAllowStoredCredentials;
-    m_options.maxRedirectCount -= m_redirectCount;
-    m_redirectCount = 0;
 
     clearResource();
 

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/DocumentThreadableLoader.h (218541 => 218542)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/DocumentThreadableLoader.h	2017-06-20 06:37:27 UTC (rev 218541)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/DocumentThreadableLoader.h	2017-06-20 06:41:48 UTC (rev 218542)
@@ -132,7 +132,6 @@
         std::unique_ptr<ContentSecurityPolicy> m_contentSecurityPolicy;
         std::optional<CrossOriginPreflightChecker> m_preflightChecker;
         std::optional<HTTPHeaderMap> m_originalHeaders;
-        unsigned m_redirectCount { 0 };
 
         ShouldLogError m_shouldLogError;
     };

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/SubresourceLoader.cpp (218541 => 218542)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/SubresourceLoader.cpp	2017-06-20 06:37:27 UTC (rev 218541)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/SubresourceLoader.cpp	2017-06-20 06:41:48 UTC (rev 218542)
@@ -495,7 +495,7 @@
         if (!crossOriginFlag && isNextRequestCrossOrigin)
             redirectingToNewOrigin = true;
         else
-            redirectingToNewOrigin = !SecurityOrigin::create(previousRequest.url())->canRequest(newRequest.url());
+            redirectingToNewOrigin = !protocolHostAndPortAreEqual(previousRequest.url(), newRequest.url());
     }
 
     // Implementing https://fetch.spec.whatwg.org/#concept-http-redirect-fetch step 10.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to