summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit
diff options
context:
space:
mode:
authormkwst@chromium.org <mkwst@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2014-07-16 09:55:32 +0000
committermkwst@chromium.org <mkwst@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2014-07-16 09:55:32 +0000
commit034c3651ff621b8fc535ab72552fd7597bfd0efe (patch)
tree69be033e8e3ce9469a0b7b0dd3aad8fbe6bd0212 /third_party/WebKit
parent8df1c83f9b64edb83bc99773655242f9f5bb36a3 (diff)
downloadchromium_src-034c3651ff621b8fc535ab72552fd7597bfd0efe.zip
chromium_src-034c3651ff621b8fc535ab72552fd7597bfd0efe.tar.gz
chromium_src-034c3651ff621b8fc535ab72552fd7597bfd0efe.tar.bz2
Ensure correct state for resources fetched via fetch???Resource.
This CL asserts that resources fetched via the various 'ResourceFetcher::fetch???Resource' methods have a frame-type of 'none' and sets the request context as appropriate. BUG=390497 Review URL: https://codereview.chromium.org/390833002 git-svn-id: svn://svn.chromium.org/blink/trunk@178260 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit')
-rw-r--r--third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index c0f8ac0..4bdb123 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -318,21 +318,29 @@ void ResourceFetcher::preCacheDataURIImage(const FetchRequest& request)
ResourcePtr<FontResource> ResourceFetcher::fetchFont(FetchRequest& request)
{
+ ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone);
+ request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestContextFont);
return toFontResource(requestResource(Resource::Font, request));
}
ResourcePtr<RawResource> ResourceFetcher::fetchImport(FetchRequest& request)
{
+ ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone);
+ request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestContextScript);
return toRawResource(requestResource(Resource::ImportResource, request));
}
ResourcePtr<CSSStyleSheetResource> ResourceFetcher::fetchCSSStyleSheet(FetchRequest& request)
{
+ ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone);
+ request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestContextStyle);
return toCSSStyleSheetResource(requestResource(Resource::CSSStyleSheet, request));
}
ResourcePtr<CSSStyleSheetResource> ResourceFetcher::fetchUserCSSStyleSheet(FetchRequest& request)
{
+ ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone);
+ request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestContextStyle);
KURL url = MemoryCache::removeFragmentIdentifierIfNeeded(request.resourceRequest().url());
if (Resource* existing = memoryCache()->resourceForURL(url)) {
@@ -347,17 +355,22 @@ ResourcePtr<CSSStyleSheetResource> ResourceFetcher::fetchUserCSSStyleSheet(Fetch
ResourcePtr<ScriptResource> ResourceFetcher::fetchScript(FetchRequest& request)
{
+ ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone);
+ request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestContextScript);
return toScriptResource(requestResource(Resource::Script, request));
}
ResourcePtr<XSLStyleSheetResource> ResourceFetcher::fetchXSLStyleSheet(FetchRequest& request)
{
ASSERT(RuntimeEnabledFeatures::xsltEnabled());
+ request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestContextXSLT);
return toXSLStyleSheetResource(requestResource(Resource::XSLStyleSheet, request));
}
ResourcePtr<DocumentResource> ResourceFetcher::fetchSVGDocument(FetchRequest& request)
{
+ ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone);
+ request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestContextImage);
return toDocumentResource(requestResource(Resource::SVGDocument, request));
}
@@ -365,11 +378,14 @@ ResourcePtr<Resource> ResourceFetcher::fetchLinkResource(Resource::Type type, Fe
{
ASSERT(frame());
ASSERT(type == Resource::LinkPrefetch || type == Resource::LinkSubresource);
+ ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone);
+ request.mutableResourceRequest().setRequestContext(type == Resource::LinkPrefetch ? WebURLRequest::RequestContextPrefetch : WebURLRequest::RequestContextSubresource);
return requestResource(type, request);
}
ResourcePtr<RawResource> ResourceFetcher::fetchRawResource(FetchRequest& request)
{
+ ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone);
ASSERT(request.resourceRequest().requestContext() != WebURLRequest::RequestContextUnspecified);
return toRawResource(requestResource(Resource::Raw, request));
}
@@ -384,11 +400,16 @@ ResourcePtr<RawResource> ResourceFetcher::fetchMainResource(FetchRequest& reques
ResourcePtr<RawResource> ResourceFetcher::fetchMedia(FetchRequest& request)
{
+ ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone);
+ // FIXME: Split this into audio and video.
+ request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestContextVideo);
return toRawResource(requestResource(Resource::Media, request));
}
ResourcePtr<RawResource> ResourceFetcher::fetchTextTrack(FetchRequest& request)
{
+ ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone);
+ request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestContextTrack);
return toRawResource(requestResource(Resource::TextTrack, request));
}