Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Unified Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2254693002: Delay generation of User-Agent header to URLRequestHttpJob and accept custom User-Agent from XHR/Fe… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed Android test Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
index 59a785d26076b83b3a40b3a0fa379acbf84017d2..d981525093f2c5f69628c219a0d8d2cf9957d138 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -180,8 +180,7 @@ LocalFrame* FrameFetchContext::frame() const
void FrameFetchContext::addAdditionalRequestHeaders(ResourceRequest& request, FetchResourceType type)
{
- bool isMainResource = type == FetchMainResource;
- if (!isMainResource) {
+ if (type != FetchMainResource) {
RefPtr<SecurityOrigin> outgoingOrigin;
if (!request.didSetHTTPReferrer()) {
ASSERT(m_document);
@@ -208,7 +207,7 @@ void FrameFetchContext::addAdditionalRequestHeaders(ResourceRequest& request, Fe
if (frame()->settings() && frame()->settings()->dataSaverEnabled())
request.setHTTPHeaderField("Save-Data", "on");
- frame()->loader().applyUserAgent(request);
+ request.setDefaultHTTPUserAgent(AtomicString(frame()->loader().userAgent()));
}
CachePolicy FrameFetchContext::getCachePolicy() const
@@ -322,7 +321,7 @@ void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi
void FrameFetchContext::prepareRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
- frame()->loader().applyUserAgent(request);
+ request.setDefaultHTTPUserAgent(AtomicString(frame()->loader().userAgent()));
frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identifier, request, redirectResponse);
}

Powered by Google App Engine
This is Rietveld 408576698