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

Unified Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 711213002: ResourceFetcher::requestPreload should set its requestContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tyoshino@ suggestion Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/ResourceFetcher.cpp
diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp
index 81f56c4d602211d12db00e585140c541e7124199..a6e166eab8918ee201cc61a269f9fa817657a229 100644
--- a/Source/core/fetch/ResourceFetcher.cpp
+++ b/Source/core/fetch/ResourceFetcher.cpp
@@ -1242,10 +1242,16 @@ void ResourceFetcher::requestPreload(Resource::Type type, FetchRequest& request,
if (type == Resource::MainResource)
return;
+ ASSERT(type == Resource::Script || type == Resource::CSSStyleSheet || type == Resource::Image);
Mike West 2014/11/11 13:34:18 Is this an exhaustive list of what goes through th
+
String encoding;
- if (type == Resource::Script || type == Resource::CSSStyleSheet)
+ if (type == Resource::Script || type == Resource::CSSStyleSheet) {
encoding = charset.isEmpty() ? m_document->charset().string() : charset;
+ // RequestContext for Resource::Image is set in fetchImage below.
+ determineRequestContext(request.mutableResourceRequest(), type);
+ }
+
request.setCharset(encoding);
request.setForPreload(true);
@@ -1253,6 +1259,7 @@ void ResourceFetcher::requestPreload(Resource::Type type, FetchRequest& request,
// Loading images involves several special cases, so use dedicated fetch method instead.
if (type == Resource::Image)
resource = fetchImage(request);
+
if (!resource)
resource = requestResource(type, request);
if (!resource || (m_preloads && m_preloads->contains(resource.get())))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698