diff options
-rw-r--r-- | third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp | 2 | ||||
-rw-r--r-- | third_party/WebKit/Source/core/loader/DocumentLoader.cpp | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp index 1834568..c086449 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp +++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp @@ -440,6 +440,7 @@ PassRefPtrWillBeRawPtr<Resource> ResourceFetcher::requestResource(FetchRequest& updateMemoryCacheStats(resource.get(), policy, request, factory, isStaticData); + initializeResourceRequest(request.mutableResourceRequest(), factory.type()); switch (policy) { case Reload: memoryCache()->remove(resource.get()); @@ -592,7 +593,6 @@ PassRefPtrWillBeRawPtr<Resource> ResourceFetcher::createResourceForLoading(Fetch WTF_LOG(ResourceLoading, "Loading Resource for '%s'.", request.resourceRequest().url().elidedString().latin1().data()); - initializeResourceRequest(request.mutableResourceRequest(), factory.type()); RefPtrWillBeRawPtr<Resource> resource = factory.create(request.resourceRequest(), charset); resource->setLinkPreload(request.isLinkPreload()); resource->setCacheIdentifier(cacheIdentifier); diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp index ec8cd68..d86e4554 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp @@ -707,16 +707,21 @@ void DocumentLoader::startLoadingMainResource() maybeLoadEmpty(); return; } - m_mainResource->addClient(this); - - // A bunch of headers are set when the underlying ResourceLoader is created, and m_request needs to include those. - if (mainResourceLoader()) + if (mainResourceLoader()) { + // A bunch of headers are set when the underlying ResourceLoader + // is created, and m_request needs to include those. request = mainResourceLoader()->originalRequest(); + } else { + // Even when using a cached resource, we may make some modification + // to the request, e.g. adding the referer header. + request = cachedResourceRequest.resourceRequest(); + } // If there was a fragment identifier on m_request, the cache will have stripped it. m_request should include // the fragment identifier, so add that back in. if (equalIgnoringFragmentIdentifier(m_request.url(), request.url())) request.setURL(m_request.url()); m_request = request; + m_mainResource->addClient(this); } void DocumentLoader::cancelMainResourceLoad(const ResourceError& resourceError) |