Title: [239594] trunk
Revision
239594
Author
[email protected]
Date
2019-01-03 09:44:55 -0800 (Thu, 03 Jan 2019)

Log Message

Remove logic handling DNT header during redirects
https://bugs.webkit.org/show_bug.cgi?id=193082
<rdar://problem/45555965>

Reviewed by Chris Dumez.

Source/WebKit:

Test: http/wpt/fetch/dnt-header-after-redirection.html.

Don't bother looking for (or passing along) DNT headers during redirects.

* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::check):
(WebKit::NetworkLoadChecker::prepareRedirectedRequest): Deleted.
* NetworkProcess/NetworkLoadChecker.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::restartNetworkLoad):
(WebKit::NetworkResourceLoader::continueWillSendRequest):
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::willPerformHTTPRedirection):

LayoutTests:

Revise test case to reflect fact that we no longer include the DNT
header in redirects.

* http/wpt/fetch/dnt-header-after-redirection-expected.txt:
* http/wpt/fetch/dnt-header-after-redirection.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239593 => 239594)


--- trunk/LayoutTests/ChangeLog	2019-01-03 17:03:44 UTC (rev 239593)
+++ trunk/LayoutTests/ChangeLog	2019-01-03 17:44:55 UTC (rev 239594)
@@ -1,3 +1,17 @@
+2019-01-03  Brent Fulgham  <[email protected]>
+
+        Remove logic handling DNT header during redirects
+        https://bugs.webkit.org/show_bug.cgi?id=193082
+        <rdar://problem/45555965>
+
+        Reviewed by Chris Dumez.
+
+        Revise test case to reflect fact that we no longer include the DNT
+        header in redirects.
+
+        * http/wpt/fetch/dnt-header-after-redirection-expected.txt:
+        * http/wpt/fetch/dnt-header-after-redirection.html:
+
 2019-01-02  Simon Fraser  <[email protected]>
 
         REGRESSION (r239306): Don't disable font smoothing in transparent layers on macOS Mojave and later

Modified: trunk/LayoutTests/http/wpt/fetch/dnt-header-after-redirection-expected.txt (239593 => 239594)


--- trunk/LayoutTests/http/wpt/fetch/dnt-header-after-redirection-expected.txt	2019-01-03 17:03:44 UTC (rev 239593)
+++ trunk/LayoutTests/http/wpt/fetch/dnt-header-after-redirection-expected.txt	2019-01-03 17:44:55 UTC (rev 239594)
@@ -1,6 +1,6 @@
 
 
-PASS video load with DNT 
-PASS Sync XHR with DNT 
-PASS Beacon with DNT 
+PASS video load without DNT 
+PASS Sync XHR without DNT 
+PASS Beacon without DNT 
 

Modified: trunk/LayoutTests/http/wpt/fetch/dnt-header-after-redirection.html (239593 => 239594)


--- trunk/LayoutTests/http/wpt/fetch/dnt-header-after-redirection.html	2019-01-03 17:03:44 UTC (rev 239593)
+++ trunk/LayoutTests/http/wpt/fetch/dnt-header-after-redirection.html	2019-01-03 17:44:55 UTC (rev 239594)
@@ -38,8 +38,8 @@
     const finalURL = "dnt-status.py?store&token=" + token;
     video.src = "" + encodeURIComponent(finalURL);
 
-    assert_true(await checkDNTHeader(test, token), "DNT header is there");
-}, "video load with DNT");
+    assert_false(await checkDNTHeader(test, token), "DNT header is not there");
+}, "video load without DNT");
 
 promise_test(async (test) => {
     const token = self.token();
@@ -50,8 +50,8 @@
     xhr.send();
 
     const response = await fetch("resources/dnt-status.py?read&token=" + token);
-    assert_equals(await response.text(), "1", "DNT header");
-}, "Sync XHR with DNT");
+    assert_equals(await response.text(), "-1", "DNT header");
+}, "Sync XHR without DNT");
 
 promise_test(async (test) => {
     const token = self.token();
@@ -59,8 +59,8 @@
 
     navigator.sendBeacon("resources/redirect.py?location=" + encodeURIComponent(finalURL), "");
 
-    assert_true(await checkDNTHeader(test, token), "DNT header is there");
-}, "Beacon with DNT");
+    assert_false(await checkDNTHeader(test, token), "DNT header is not there");
+}, "Beacon without DNT");
     </script>
 </body>
 </html>

Modified: trunk/Source/WebKit/ChangeLog (239593 => 239594)


--- trunk/Source/WebKit/ChangeLog	2019-01-03 17:03:44 UTC (rev 239593)
+++ trunk/Source/WebKit/ChangeLog	2019-01-03 17:44:55 UTC (rev 239594)
@@ -1,3 +1,25 @@
+2019-01-03  Brent Fulgham  <[email protected]>
+
+        Remove logic handling DNT header during redirects
+        https://bugs.webkit.org/show_bug.cgi?id=193082
+        <rdar://problem/45555965>
+
+        Reviewed by Chris Dumez.
+
+        Test: http/wpt/fetch/dnt-header-after-redirection.html.
+
+        Don't bother looking for (or passing along) DNT headers during redirects.
+
+        * NetworkProcess/NetworkLoadChecker.cpp:
+        (WebKit::NetworkLoadChecker::check):
+        (WebKit::NetworkLoadChecker::prepareRedirectedRequest): Deleted.
+        * NetworkProcess/NetworkLoadChecker.h:
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::restartNetworkLoad):
+        (WebKit::NetworkResourceLoader::continueWillSendRequest):
+        * NetworkProcess/PingLoad.cpp:
+        (WebKit::PingLoad::willPerformHTTPRedirection):
+
 2019-01-03  Chris Dumez  <[email protected]>
 
         Add release logging to help debug HTTPS upgrade issues

Modified: trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp (239593 => 239594)


--- trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp	2019-01-03 17:03:44 UTC (rev 239593)
+++ trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp	2019-01-03 17:44:55 UTC (rev 239594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -84,21 +84,9 @@
         m_loadInformation.request = request;
 
     m_firstRequestHeaders = request.httpHeaderFields();
-    // FIXME: We should not get this information from the request but directly from some NetworkProcess setting.
-    m_dntHeaderValue = m_firstRequestHeaders.get(HTTPHeaderName::DNT);
-    if (m_dntHeaderValue.isNull() && m_sessionID.isEphemeral()) {
-        m_dntHeaderValue = "1";
-        request.setHTTPHeaderField(HTTPHeaderName::DNT, m_dntHeaderValue);
-    }
     checkRequest(WTFMove(request), client, WTFMove(handler));
 }
 
-void NetworkLoadChecker::prepareRedirectedRequest(ResourceRequest& request)
-{
-    if (!m_dntHeaderValue.isNull())
-        request.setHTTPHeaderField(HTTPHeaderName::DNT, m_dntHeaderValue);
-}
-
 static inline NetworkLoadChecker::RedirectionRequestOrError redirectionError(const ResourceResponse& redirectResponse, String&& errorMessage)
 {
     return makeUnexpected(ResourceError { String { }, 0, redirectResponse.url(), WTFMove(errorMessage), ResourceError::Type::AccessControl });

Modified: trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.h (239593 => 239594)


--- trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.h	2019-01-03 17:03:44 UTC (rev 239593)
+++ trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.h	2019-01-03 17:44:55 UTC (rev 239594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -69,8 +69,6 @@
     using RedirectionValidationHandler = CompletionHandler<void(RedirectionRequestOrError&&)>;
     void checkRedirection(WebCore::ResourceRequest&& request, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&& redirectResponse, WebCore::ContentSecurityPolicyClient*, RedirectionValidationHandler&&);
 
-    void prepareRedirectedRequest(WebCore::ResourceRequest&);
-
     WebCore::ResourceError validateResponse(WebCore::ResourceResponse&);
 
     void setCSPResponseHeaders(WebCore::ContentSecurityPolicyResponseHeaders&& headers) { m_cspResponseHeaders = WTFMove(headers); }
@@ -143,7 +141,6 @@
     size_t m_redirectCount { 0 };
     URL m_previousURL;
     WebCore::PreflightPolicy m_preflightPolicy;
-    String m_dntHeaderValue;
     String m_referrer;
     bool m_checkContentExtensions { false };
     bool m_shouldCaptureExtraNetworkLoadMetrics { false };

Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (239593 => 239594)


--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2019-01-03 17:03:44 UTC (rev 239593)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2019-01-03 17:44:55 UTC (rev 239594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -693,8 +693,6 @@
 {
     if (m_networkLoad)
         m_networkLoad->cancel();
-    if (m_networkLoadChecker)
-        m_networkLoadChecker->prepareRedirectedRequest(newRequest);
 
     startNetworkLoad(WTFMove(newRequest), FirstLoad::No);
 }
@@ -717,9 +715,6 @@
 
     RELEASE_LOG_IF_ALLOWED("continueWillSendRequest: (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", m_parameters.webPageID, m_parameters.webFrameID, m_parameters.identifier);
 
-    if (m_networkLoadChecker)
-        m_networkLoadChecker->prepareRedirectedRequest(newRequest);
-
     m_isAllowedToAskUserForCredentials = isAllowedToAskUserForCredentials;
 
     // If there is a match in the network cache, we need to reuse the original cache policy and partition.

Modified: trunk/Source/WebKit/NetworkProcess/PingLoad.cpp (239593 => 239594)


--- trunk/Source/WebKit/NetworkProcess/PingLoad.cpp	2019-01-03 17:03:44 UTC (rev 239593)
+++ trunk/Source/WebKit/NetworkProcess/PingLoad.cpp	2019-01-03 17:44:55 UTC (rev 239594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -108,8 +108,6 @@
             return;
         }
         auto request = WTFMove(result->redirectRequest);
-        m_networkLoadChecker->prepareRedirectedRequest(request);
-
         if (!request.url().protocolIsInHTTPFamily()) {
             this->didFinish(ResourceError { String { }, 0, request.url(), "Redirection to URL with a scheme that is not HTTP(S)"_s, ResourceError::Type::AccessControl });
             return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to