Diff
Modified: trunk/LayoutTests/ChangeLog (230223 => 230224)
--- trunk/LayoutTests/ChangeLog 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/LayoutTests/ChangeLog 2018-04-03 22:20:21 UTC (rev 230224)
@@ -1,3 +1,17 @@
+2018-04-03 Youenn Fablet <[email protected]>
+
+ NetworkResourceLoader does not need to expose all redirect response headers
+ https://bugs.webkit.org/show_bug.cgi?id=184114
+ <rdar://problem/39010557>
+
+ Reviewed by Ryosuke Niwa.
+
+ New test verifies that headers are filtered. Witout filtering, 9 headers would be visible to the injected bundle, while 6 headers reamin after filtering.
+
+ * http/wpt/loading/redirect-headers-expected.txt: Added.
+ * http/wpt/loading/redirect-headers.html: Added.
+ * platform/mac-wk1/TestExpectations: Skipped new test for WK1.
+
2018-04-03 Ryan Haddad <[email protected]>
Mark http/tests/appcache/interrupted-update.html as flaky.
Added: trunk/LayoutTests/http/wpt/loading/redirect-headers-expected.txt (0 => 230224)
--- trunk/LayoutTests/http/wpt/loading/redirect-headers-expected.txt (rev 0)
+++ trunk/LayoutTests/http/wpt/loading/redirect-headers-expected.txt 2018-04-03 22:20:21 UTC (rev 230224)
@@ -0,0 +1,11 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+http://localhost:8800/WebKit/beacon/resources/redirect.py?status=302&location=/ - willSendRequest <NSURLRequest URL http://localhost:8800/WebKit/beacon/resources/redirect.py?status=302&location=/, main document URL http://localhost:8800/WebKit/loading/redirect-headers.html, http method GET> redirectResponse (null)
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+http://localhost:8800/WebKit/loading/redirect-headers.html - didFinishLoading
+http://localhost:8800/WebKit/beacon/resources/redirect.py?status=302&location=/ - willSendRequest <NSURLRequest URL http://localhost:8800/?status=302&location=%2F&count=1, main document URL http://localhost:8800/WebKit/loading/redirect-headers.html, http method GET> redirectResponse <NSURLResponse http://localhost:8800/WebKit/beacon/resources/redirect.py?status=302&location=/, http status code 302, 6 headers>
+http://localhost:8800/WebKit/beacon/resources/redirect.py?status=302&location=/ - didReceiveResponse <NSURLResponse http://localhost:8800/?status=302&location=%2F&count=1, http status code 200>
+http://localhost:8800/WebKit/beacon/resources/redirect.py?status=302&location=/ - didFinishLoading
+
Added: trunk/LayoutTests/http/wpt/loading/redirect-headers.html (0 => 230224)
--- trunk/LayoutTests/http/wpt/loading/redirect-headers.html (rev 0)
+++ trunk/LayoutTests/http/wpt/loading/redirect-headers.html 2018-04-03 22:20:21 UTC (rev 230224)
@@ -0,0 +1,18 @@
+<html>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.dumpResourceLoadCallbacks();
+ testRunner.dumpAllHTTPRedirectedResponseHeaders();
+ testRunner.waitUntilDone();
+}
+
+async function doTest()
+{
+ await fetch("../beacon/resources/redirect.py?status=302&location=/");
+ testRunner.notifyDone();
+}
+</script>
+<body _onload_="doTest();">
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (230223 => 230224)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2018-04-03 22:20:21 UTC (rev 230224)
@@ -133,6 +133,9 @@
http/tests/media/media-stream
http/tests/ssl/media-stream
+# WK1 does not filter response headers.
+http/wpt/loading/redirect-headers.html [ Skip ]
+
# No service worker implementation for WK1
imported/w3c/web-platform-tests/service-workers [ Skip ]
http/wpt/service-workers [ Skip ]
Modified: trunk/LayoutTests/platform/win/TestExpectations (230223 => 230224)
--- trunk/LayoutTests/platform/win/TestExpectations 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/LayoutTests/platform/win/TestExpectations 2018-04-03 22:20:21 UTC (rev 230224)
@@ -3722,6 +3722,8 @@
http/wpt/cache-storage [ Skip ]
http/tests/appcache/main-resource-redirect-with-sw.html [ Skip ]
+# No header filtering for WK1
+http/wpt/loading/redirect-headers.html [ Skip ]
# Flaky tests on Windows:
webkit.org/b/176564 http/tests/misc/delete-frame-during-readystatechange.html [ Pass Crash ]
Modified: trunk/Source/WebCore/ChangeLog (230223 => 230224)
--- trunk/Source/WebCore/ChangeLog 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebCore/ChangeLog 2018-04-03 22:20:21 UTC (rev 230224)
@@ -1,3 +1,25 @@
+2018-04-03 Youenn Fablet <[email protected]>
+
+ NetworkResourceLoader does not need to expose all redirect response headers
+ https://bugs.webkit.org/show_bug.cgi?id=184114
+ <rdar://problem/39010557>
+
+ Reviewed by Ryosuke Niwa.
+
+ No JS observable change of behavior.
+ Behavior change is observable for injected bundles since they will no longer get access to the full response.
+ List of response headers correspond to the one currently being used/exposed for redirections.
+
+ Test: http/wpt/loading/redirect-headers.html
+
+ * page/RuntimeEnabledFeatures.h:
+ (WebCore::RuntimeEnabledFeatures::setRestrictedHTTPResponseAccess):
+ (WebCore::RuntimeEnabledFeatures::restrictedHTTPResponseAccess const):
+ * platform/network/ResourceResponseBase.cpp:
+ (WebCore::isSafeToKeepRedirectionHeader):
+ (WebCore::ResourceResponseBase::sanitizeRedirectionHTTPHeaderFields):
+ * platform/network/ResourceResponseBase.h:
+
2018-04-03 Andy Estes <[email protected]>
[Mac] Prioritize file promises over filenames during drag and drop
Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (230223 => 230224)
--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2018-04-03 22:20:21 UTC (rev 230224)
@@ -245,6 +245,9 @@
void setResourceLoadStatisticsDebugMode(bool isEnabled) { m_resourceLoadStatisticsDebugMode = isEnabled; }
bool resourceLoadStatisticsDebugMode() const { return m_resourceLoadStatisticsDebugMode; }
+ void setRestrictedHTTPResponseAccess(bool isEnabled) { m_isRestrictedHTTPResponseAccess = isEnabled; }
+ bool restrictedHTTPResponseAccess() const { return m_isRestrictedHTTPResponseAccess; }
+
WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
private:
@@ -375,6 +378,8 @@
bool m_mediaCapabilitiesEnabled { false };
bool m_resourceLoadStatisticsDebugMode { false };
+
+ bool m_isRestrictedHTTPResponseAccess { false };
friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
};
Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp (230223 => 230224)
--- trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp 2018-04-03 22:20:21 UTC (rev 230224)
@@ -317,6 +317,42 @@
// FIXME: Should invalidate or update platform response if present.
}
+static bool isSafeToKeepRedirectionHeader(HTTPHeaderName name)
+{
+ // WebCore needs to keep location and cache related headers as it does caching.
+ // We also keep CORS/ReferrerPolicy headers until CORS checks/Referrer computation are done in NetworkProcess.
+ return name == HTTPHeaderName::Location
+ || name == HTTPHeaderName::ReferrerPolicy
+ || name == HTTPHeaderName::CacheControl
+ || name == HTTPHeaderName::Date
+ || name == HTTPHeaderName::Expires
+ || name == HTTPHeaderName::ETag
+ || name == HTTPHeaderName::LastModified
+ || name == HTTPHeaderName::Age
+ || name == HTTPHeaderName::Pragma
+ || name == HTTPHeaderName::Refresh
+ || name == HTTPHeaderName::Vary
+ || name == HTTPHeaderName::AccessControlAllowCredentials
+ || name == HTTPHeaderName::AccessControlAllowHeaders
+ || name == HTTPHeaderName::AccessControlAllowMethods
+ || name == HTTPHeaderName::AccessControlAllowOrigin
+ || name == HTTPHeaderName::AccessControlExposeHeaders
+ || name == HTTPHeaderName::AccessControlMaxAge
+ || name == HTTPHeaderName::TimingAllowOrigin;
+}
+
+void ResourceResponseBase::sanitizeRedirectionHTTPHeaderFields()
+{
+ lazyInit(AllFields);
+
+ auto commonHeaders = WTFMove(m_httpHeaderFields.commonHeaders());
+ for (auto& header : commonHeaders) {
+ if (isSafeToKeepRedirectionHeader(header.key))
+ m_httpHeaderFields.add(header.key, WTFMove(header.value));
+ }
+ m_httpHeaderFields.uncommonHeaders().clear();
+}
+
bool ResourceResponseBase::isHTTP09() const
{
lazyInit(AllFields);
Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (230223 => 230224)
--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h 2018-04-03 22:20:21 UTC (rev 230224)
@@ -102,6 +102,7 @@
WEBCORE_EXPORT const HTTPHeaderMap& httpHeaderFields() const;
void setHTTPHeaderFields(HTTPHeaderMap&&);
+ WEBCORE_EXPORT void sanitizeRedirectionHTTPHeaderFields();
String httpHeaderField(const String& name) const;
WEBCORE_EXPORT String httpHeaderField(HTTPHeaderName) const;
Modified: trunk/Source/WebKit/ChangeLog (230223 => 230224)
--- trunk/Source/WebKit/ChangeLog 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebKit/ChangeLog 2018-04-03 22:20:21 UTC (rev 230224)
@@ -1,5 +1,37 @@
2018-04-03 Youenn Fablet <[email protected]>
+ NetworkResourceLoader does not need to expose all redirect response headers
+ https://bugs.webkit.org/show_bug.cgi?id=184114
+ <rdar://problem/39010557>
+
+ Reviewed by Ryosuke Niwa.
+
+ WebProcess instructs NetworkProcess whether to sanitize response headers based on a runtime flag.
+ We sanitize redirection response headers in case this is not related to a navigation load.
+ Navigation loads may currently require the full response for content blockers.
+
+ * NetworkProcess/NetworkResourceLoadParameters.cpp:
+ (WebKit::NetworkResourceLoadParameters::encode const):
+ (WebKit::NetworkResourceLoadParameters::decode):
+ * NetworkProcess/NetworkResourceLoadParameters.h:
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
+ (WebKit::NetworkResourceLoader::sanitizeRedirectResponseIfPossible):
+ (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
+ * NetworkProcess/NetworkResourceLoader.h:
+ * Shared/WebPreferences.yaml:
+ * UIProcess/API/C/WKPreferences.cpp:
+ (WKPreferencesSetRestrictedHTTPResponseAccess):
+ (WKPreferencesGetRestrictedHTTPResponseAccess):
+ * UIProcess/API/C/WKPreferencesRef.h:
+ * WebProcess/Network/WebLoaderStrategy.cpp:
+ (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
+ (WebKit::WebLoaderStrategy::loadResourceSynchronously):
+ (WebKit::WebLoaderStrategy::startPingLoad):
+ (WebKit::WebLoaderStrategy::preconnectTo):
+
+2018-04-03 Youenn Fablet <[email protected]>
+
Make NetworkProcess get ContentBlocker information from UIProcess
https://bugs.webkit.org/show_bug.cgi?id=184205
Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp (230223 => 230224)
--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp 2018-04-03 22:20:21 UTC (rev 230224)
@@ -95,6 +95,8 @@
encoder << mainDocumentURL;
encoder << userContentControllerIdentifier;
#endif
+
+ encoder << shouldRestrictHTTPResponseAccess;
}
bool NetworkResourceLoadParameters::decode(IPC::Decoder& decoder, NetworkResourceLoadParameters& result)
@@ -191,6 +193,12 @@
result.userContentControllerIdentifier = *userContentControllerIdentifier;
#endif
+ std::optional<bool> shouldRestrictHTTPResponseAccess;
+ decoder >> shouldRestrictHTTPResponseAccess;
+ if (!shouldRestrictHTTPResponseAccess)
+ return false;
+ result.shouldRestrictHTTPResponseAccess = *shouldRestrictHTTPResponseAccess;
+
return true;
}
Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h (230223 => 230224)
--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h 2018-04-03 22:20:21 UTC (rev 230224)
@@ -58,6 +58,7 @@
RefPtr<WebCore::SecurityOrigin> sourceOrigin;
WebCore::FetchOptions::Mode mode;
std::optional<WebCore::ContentSecurityPolicyResponseHeaders> cspResponseHeaders;
+ bool shouldRestrictHTTPResponseAccess { false };
#if ENABLE(CONTENT_EXTENSIONS)
WebCore::URL mainDocumentURL;
Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (230223 => 230224)
--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2018-04-03 22:20:21 UTC (rev 230224)
@@ -456,12 +456,19 @@
continueWillSendRequest(WTFMove(overridenRequest), false);
return;
}
- send(Messages::WebResourceLoader::WillSendRequest(redirectRequest, redirectResponse));
-
if (canUseCachedRedirect(request))
m_cache->storeRedirect(request, redirectResponse, redirectRequest);
+
+ send(Messages::WebResourceLoader::WillSendRequest(redirectRequest, sanitizeRedirectResponseIfPossible(WTFMove(redirectResponse))));
}
+ResourceResponse NetworkResourceLoader::sanitizeRedirectResponseIfPossible(ResourceResponse&& response)
+{
+ if (m_parameters.shouldRestrictHTTPResponseAccess)
+ response.sanitizeRedirectionHTTPHeaderFields();
+ return WTFMove(response);
+}
+
void NetworkResourceLoader::continueWillSendRequest(ResourceRequest&& newRequest, bool isAllowedToAskUserForCredentials)
{
RELEASE_LOG_IF_ALLOWED("continueWillSendRequest: (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", m_parameters.webPageID, m_parameters.webFrameID, m_parameters.identifier);
@@ -665,7 +672,7 @@
LOG(NetworkCache, "(NetworkProcess) Executing cached redirect");
++m_redirectCount;
- send(Messages::WebResourceLoader::WillSendRequest(*entry->redirectRequest(), entry->response()));
+ send(Messages::WebResourceLoader::WillSendRequest { *entry->redirectRequest(), sanitizeRedirectResponseIfPossible(ResourceResponse { entry->response() }) });
m_isWaitingContinueWillSendRequestForCachedRedirect = true;
}
Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.h (230223 => 230224)
--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.h 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.h 2018-04-03 22:20:21 UTC (rev 230224)
@@ -146,6 +146,8 @@
void logCookieInformation() const;
#endif
+ WebCore::ResourceResponse sanitizeRedirectResponseIfPossible(WebCore::ResourceResponse&&);
+
const NetworkResourceLoadParameters m_parameters;
Ref<NetworkConnectionToWebProcess> m_connection;
Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (230223 => 230224)
--- trunk/Source/WebKit/Shared/WebPreferences.yaml 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml 2018-04-03 22:20:21 UTC (rev 230224)
@@ -1213,3 +1213,10 @@
category: experimental
webcoreBinding: RuntimeEnabledFeatures
+RestrictedHTTPResponseAccess:
+ type: bool
+ defaultValue: true
+ humanReadableName: "Restricted HTTP Response Access to Web Process"
+ humanReadableDescription: "Restricted HTTP Response Access to Web Process"
+ category: experimental
+ webcoreBinding: RuntimeEnabledFeatures
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp (230223 => 230224)
--- trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp 2018-04-03 22:20:21 UTC (rev 230224)
@@ -1953,3 +1953,13 @@
{
return toImpl(preferencesRef)->allowCrossOriginSubresourcesToAskForCredentials();
}
+
+void WKPreferencesSetRestrictedHTTPResponseAccess(WKPreferencesRef preferencesRef, bool flag)
+{
+ toImpl(preferencesRef)->setRestrictedHTTPResponseAccess(flag);
+}
+
+bool WKPreferencesGetRestrictedHTTPResponseAccess(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->restrictedHTTPResponseAccess();
+}
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRef.h (230223 => 230224)
--- trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRef.h 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRef.h 2018-04-03 22:20:21 UTC (rev 230224)
@@ -307,6 +307,10 @@
WK_EXPORT bool WKPreferencesGetMediaCapabilitiesEnabled(WKPreferencesRef preferencesRef);
WK_EXPORT void WKPreferencesSetMediaCapabilitiesEnabled(WKPreferencesRef preferencesRef, bool enabled);
+// Defaults to false.
+WK_EXPORT bool WKPreferencesGetRestrictedHTTPResponseAccess(WKPreferencesRef preferencesRef);
+WK_EXPORT void WKPreferencesSetRestrictedHTTPResponseAccess(WKPreferencesRef preferencesRef, bool allow);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp (230223 => 230224)
--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2018-04-03 22:20:21 UTC (rev 230224)
@@ -59,6 +59,7 @@
#include <WebCore/PlatformStrategies.h>
#include <WebCore/ReferrerPolicy.h>
#include <WebCore/ResourceLoader.h>
+#include <WebCore/RuntimeEnabledFeatures.h>
#include <WebCore/SecurityOrigin.h>
#include <WebCore/Settings.h>
#include <WebCore/SubresourceLoader.h>
@@ -273,6 +274,9 @@
loadParameters.maximumBufferingTime = maximumBufferingTime;
loadParameters.derivedCachedDataTypesToRetrieve = resourceLoader.options().derivedCachedDataTypesToRetrieve;
+ // FIXME: We should also sanitize redirect response for navigations.
+ loadParameters.shouldRestrictHTTPResponseAccess = RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess() && resourceLoader.options().mode != FetchOptions::Mode::Navigate;
+
ASSERT((loadParameters.webPageID && loadParameters.webFrameID) || loadParameters.clientCredentialPolicy == ClientCredentialPolicy::CannotAskClientForCredentials);
RELEASE_LOG_IF_ALLOWED(resourceLoader, "scheduleLoad: Resource is being scheduled with the NetworkProcess (frame = %p, priority = %d, pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", resourceLoader.frame(), static_cast<int>(resourceLoader.request().priority()), loadParameters.webPageID, loadParameters.webFrameID, loadParameters.identifier);
@@ -427,6 +431,7 @@
loadParameters.storedCredentialsPolicy = storedCredentialsPolicy;
loadParameters.clientCredentialPolicy = clientCredentialPolicy;
loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = shouldClearReferrerOnHTTPSToHTTPRedirect(webFrame ? webFrame->coreFrame() : nullptr);
+ loadParameters.shouldRestrictHTTPResponseAccess = RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess();
data.shrink(0);
@@ -465,6 +470,7 @@
loadParameters.mode = options.mode;
loadParameters.shouldFollowRedirects = options.redirect == FetchOptions::Redirect::Follow;
loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = shouldClearReferrerOnHTTPSToHTTPRedirect(&frame);
+ loadParameters.shouldRestrictHTTPResponseAccess = RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess();
if (!document->shouldBypassMainWorldContentSecurityPolicy()) {
if (auto * contentSecurityPolicy = document->contentSecurityPolicy())
loadParameters.cspResponseHeaders = contentSecurityPolicy->responseHeaders();
@@ -521,6 +527,7 @@
parameters.sessionID = webPage ? webPage->sessionID() : PAL::SessionID::defaultSessionID();
parameters.storedCredentialsPolicy = storedCredentialsPolicy;
parameters.shouldPreconnectOnly = PreconnectOnly::Yes;
+ parameters.shouldRestrictHTTPResponseAccess = RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess();
WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::PreconnectTo(preconnectionIdentifier, WTFMove(parameters)), 0);
}
Modified: trunk/Tools/ChangeLog (230223 => 230224)
--- trunk/Tools/ChangeLog 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Tools/ChangeLog 2018-04-03 22:20:21 UTC (rev 230224)
@@ -1,3 +1,28 @@
+2018-04-03 Youenn Fablet <[email protected]>
+
+ NetworkResourceLoader does not need to expose all redirect response headers
+ https://bugs.webkit.org/show_bug.cgi?id=184114
+ <rdar://problem/39010557>
+
+ Reviewed by Ryosuke Niwa.
+
+ Add an option to dump the number of headers in a response.
+ This allows validating that filtering does happen or not.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::dumpResponseDescriptionSuitableForTestResult):
+ (WTR::InjectedBundlePage::responseHeaderCount):
+ (WTR::InjectedBundlePage::willSendRequestForFrame):
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ (WTR::TestRunner::dumpAllHTTPRedirectedResponseHeaders):
+ (WTR::TestRunner::shouldDumpAllHTTPRedirectedResponseHeaders const):
+ * WebKitTestRunner/InjectedBundle/cocoa/InjectedBundlePageCocoa.mm:
+ (WTR::InjectedBundlePage::responseHeaderCount):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::resetPreferencesToConsistentValues):
+
2018-04-03 Andy Estes <[email protected]>
[Mac] Prioritize file promises over filenames during drag and drop
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (230223 => 230224)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2018-04-03 22:20:21 UTC (rev 230224)
@@ -116,6 +116,8 @@
// Printing
boolean isPageBoxVisible(long pageIndex);
+ void dumpAllHTTPRedirectedResponseHeaders();
+
[PassContext] void setValueForUser(object element, DOMString value);
// UserContent testing.
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (230223 => 230224)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2018-04-03 22:20:21 UTC (rev 230224)
@@ -499,7 +499,7 @@
stringBuilder.append('>');
}
-static inline void dumpResponseDescriptionSuitableForTestResult(WKURLResponseRef response, StringBuilder& stringBuilder)
+static inline void dumpResponseDescriptionSuitableForTestResult(WKURLResponseRef response, StringBuilder& stringBuilder, bool shouldDumpResponseHeaders = false)
{
WKRetainPtr<WKURLRef> url = ""
if (!url) {
@@ -510,9 +510,23 @@
stringBuilder.append(pathSuitableForTestResult(url.get()));
stringBuilder.appendLiteral(", http status code ");
stringBuilder.appendNumber(WKURLResponseHTTPStatusCode(response));
+
+ if (shouldDumpResponseHeaders) {
+ stringBuilder.appendLiteral(", ");
+ stringBuilder.appendNumber(InjectedBundlePage::responseHeaderCount(response));
+ stringBuilder.appendLiteral(" headers");
+ }
stringBuilder.append('>');
}
+#if !PLATFORM(COCOA)
+// FIXME: Implement this for non cocoa ports.
+uint64_t InjectedBundlePage::responseHeaderCount(WKURLResponseRef response)
+{
+ return 0;
+}
+#endif
+
static inline void dumpErrorDescriptionSuitableForTestResult(WKErrorRef error, StringBuilder& stringBuilder)
{
WKRetainPtr<WKStringRef> errorDomain = adoptWK(WKErrorCopyDomain(error));
@@ -1133,7 +1147,7 @@
stringBuilder.appendLiteral(" - willSendRequest ");
dumpRequestDescriptionSuitableForTestResult(request, stringBuilder);
stringBuilder.appendLiteral(" redirectResponse ");
- dumpResponseDescriptionSuitableForTestResult(response, stringBuilder);
+ dumpResponseDescriptionSuitableForTestResult(response, stringBuilder, injectedBundle.testRunner()->shouldDumpAllHTTPRedirectedResponseHeaders());
stringBuilder.append('\n');
injectedBundle.outputText(stringBuilder.toString());
}
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h (230223 => 230224)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h 2018-04-03 22:20:21 UTC (rev 230224)
@@ -49,6 +49,8 @@
void dumpBackForwardList(WTF::StringBuilder&);
+ static uint64_t responseHeaderCount(WKURLResponseRef);
+
private:
// Loader Client
static void didStartProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (230223 => 230224)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2018-04-03 22:20:21 UTC (rev 230224)
@@ -431,6 +431,9 @@
void installFakeHelvetica(JSStringRef configuration);
+ void dumpAllHTTPRedirectedResponseHeaders() { m_dumpAllHTTPRedirectedResponseHeaders = true; }
+ bool shouldDumpAllHTTPRedirectedResponseHeaders() const { return m_dumpAllHTTPRedirectedResponseHeaders; }
+
private:
TestRunner();
@@ -495,6 +498,8 @@
size_t m_userMediaPermissionRequestCount { 0 };
PlatformTimerRef m_waitToDumpWatchdogTimer;
+
+ bool m_dumpAllHTTPRedirectedResponseHeaders { false };
};
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/InjectedBundlePageCocoa.mm (230223 => 230224)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/InjectedBundlePageCocoa.mm 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/InjectedBundlePageCocoa.mm 2018-04-03 22:20:21 UTC (rev 230224)
@@ -53,4 +53,14 @@
return [nsURLResponse.get() MIMEType];
}
+uint64_t InjectedBundlePage::responseHeaderCount(WKURLResponseRef response)
+{
+ RetainPtr<NSURLResponse> nsURLResponse = adoptNS(WKURLResponseCopyNSURLResponse(response));
+ if (![nsURLResponse isKindOfClass:[NSHTTPURLResponse class]])
+ return { };
+
+ NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)nsURLResponse.get();
+ return [[httpResponse allHeaderFields] count];
+}
+
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (230223 => 230224)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2018-04-03 21:33:54 UTC (rev 230223)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2018-04-03 22:20:21 UTC (rev 230224)
@@ -751,6 +751,8 @@
WKPreferencesSetAccessibilityObjectModelEnabled(preferences, true);
WKPreferencesSetMediaCapabilitiesEnabled(preferences, true);
+ WKPreferencesSetRestrictedHTTPResponseAccess(preferences, true);
+
platformResetPreferencesToConsistentValues();
}