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

Unified Diff: third_party/WebKit/Source/core/fetch/Resource.cpp

Issue 1418003006: Simplify starting a navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enum-ify Created 5 years, 1 month 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/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index aade7d714ec9492a3d1384bb3df6da8705d75448..de290b6cc35a6645888f99249d5ea2ed02d9bfd0 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -175,13 +175,8 @@ Resource::Resource(const ResourceRequest& request, Type type)
if (m_resourceRequest.url().protocolIsInHTTPFamily())
m_cacheHandler = CacheHandler::create(this);
- if (!m_resourceRequest.url().hasFragmentIdentifier())
- return;
- KURL urlForCache = MemoryCache::removeFragmentIdentifierIfNeeded(m_resourceRequest.url());
- if (urlForCache.hasFragmentIdentifier())
- return;
- m_fragmentIdentifierForRequest = m_resourceRequest.url().fragmentIdentifier();
- m_resourceRequest.setURL(urlForCache);
+ if (!accept().isEmpty())
+ m_resourceRequest.setHTTPAccept(accept());
}
Resource::~Resource()
@@ -213,28 +208,23 @@ void Resource::load(ResourceFetcher* fetcher, const ResourceLoaderOptions& optio
{
m_options = options;
m_loading = true;
-
- ResourceRequest request(m_revalidatingRequest.isNull() ? m_resourceRequest : m_revalidatingRequest);
- if (!accept().isEmpty())
- request.setHTTPAccept(accept());
-
- // FIXME: It's unfortunate that the cache layer and below get to know anything about fragment identifiers.
- // We should look into removing the expectation of that knowledge from the platform network stacks.
- if (!m_fragmentIdentifierForRequest.isNull()) {
- KURL url = request.url();
- url.setFragmentIdentifier(m_fragmentIdentifierForRequest);
- request.setURL(url);
- m_fragmentIdentifierForRequest = String();
- }
m_status = Pending;
+
if (m_loader) {
ASSERT(m_revalidatingRequest.isNull());
RELEASE_ASSERT(m_options.synchronousPolicy == RequestSynchronously);
m_loader->changeToSynchronous();
return;
}
- m_loader = ResourceLoader::create(fetcher, this, request, options);
+
+ ResourceRequest& request(m_revalidatingRequest.isNull() ? m_resourceRequest : m_revalidatingRequest);
+ ResourceRequest requestCopy(m_revalidatingRequest.isNull() ? m_resourceRequest : m_revalidatingRequest);
+ m_loader = ResourceLoader::create(fetcher, this, requestCopy, options);
m_loader->start();
+
+ // Headers might have been modified during load start. Copy them over so long as the url didn't change.
+ if (request.url() == requestCopy.url())
+ request = requestCopy;
}
void Resource::checkNotify()
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698