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

Unified Diff: Source/modules/fetch/Request.cpp

Issue 1060033002: Implement Request.context for Fetch API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « Source/modules/fetch/Request.h ('k') | Source/modules/fetch/Request.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/fetch/Request.cpp
diff --git a/Source/modules/fetch/Request.cpp b/Source/modules/fetch/Request.cpp
index 45c8ff4c458bd82f7e4cabf34647f422db959e30..af5c233853618bd09bcbf419ab42ad59049365c9 100644
--- a/Source/modules/fetch/Request.cpp
+++ b/Source/modules/fetch/Request.cpp
@@ -34,7 +34,6 @@ FetchRequestData* createCopyOfFetchRequestDataForFetch(ExecutionContext* context
// FIXME: Set ForceOriginHeaderFlag.
request->setSameOriginDataURLFlag(true);
request->mutableReferrer()->setClient();
- request->setContext(WebURLRequest::RequestContextFetch);
request->setMode(original->mode());
request->setCredentials(original->credentials());
// FIXME: Set cache mode.
@@ -294,6 +293,83 @@ KURL Request::url() const
return url;
}
+String Request::context() const
+{
+ // "The context attribute's getter must return request's context"
+ switch (m_request->context()) {
+ case WebURLRequest::RequestContextUnspecified:
+ return "";
+ case WebURLRequest::RequestContextAudio:
+ return "audio";
+ case WebURLRequest::RequestContextBeacon:
+ return "beacon";
+ case WebURLRequest::RequestContextCSPReport:
+ return "cspreport";
+ case WebURLRequest::RequestContextDownload:
+ return "download";
+ case WebURLRequest::RequestContextEmbed:
+ return "embed";
+ case WebURLRequest::RequestContextEventSource:
+ return "eventsource";
+ case WebURLRequest::RequestContextFavicon:
+ return "favicon";
+ case WebURLRequest::RequestContextFetch:
+ return "fetch";
+ case WebURLRequest::RequestContextFont:
+ return "font";
+ case WebURLRequest::RequestContextForm:
+ return "form";
+ case WebURLRequest::RequestContextFrame:
+ return "frame";
+ case WebURLRequest::RequestContextHyperlink:
+ return "hyperlink";
+ case WebURLRequest::RequestContextIframe:
+ return "iframe";
+ case WebURLRequest::RequestContextImage:
+ return "image";
+ case WebURLRequest::RequestContextImageSet:
+ return "imageset";
+ case WebURLRequest::RequestContextImport:
+ return "import";
+ case WebURLRequest::RequestContextInternal:
+ return "internal";
+ case WebURLRequest::RequestContextLocation:
+ return "location";
+ case WebURLRequest::RequestContextManifest:
+ return "manifest";
+ case WebURLRequest::RequestContextObject:
+ return "object";
+ case WebURLRequest::RequestContextPing:
+ return "ping";
+ case WebURLRequest::RequestContextPlugin:
+ return "plugin";
+ case WebURLRequest::RequestContextPrefetch:
+ return "prefetch";
+ case WebURLRequest::RequestContextScript:
+ return "script";
+ case WebURLRequest::RequestContextServiceWorker:
+ return "serviceworker";
+ case WebURLRequest::RequestContextSharedWorker:
+ return "sharedworker";
+ case WebURLRequest::RequestContextSubresource:
+ return "subresource";
+ case WebURLRequest::RequestContextStyle:
+ return "style";
+ case WebURLRequest::RequestContextTrack:
+ return "track";
+ case WebURLRequest::RequestContextVideo:
+ return "video";
+ case WebURLRequest::RequestContextWorker:
+ return "worker";
+ case WebURLRequest::RequestContextXMLHttpRequest:
+ return "xmlhttprequest";
+ case WebURLRequest::RequestContextXSLT:
+ return "xslt";
+ }
+ ASSERT_NOT_REACHED();
+ return "";
+}
+
String Request::referrer() const
{
// "The referrer attribute's getter must return the empty string if
@@ -376,6 +452,7 @@ FetchRequestData* Request::passRequestData()
void Request::populateWebServiceWorkerRequest(WebServiceWorkerRequest& webRequest) const
{
webRequest.setMethod(method());
+ webRequest.setRequestContext(m_request->context());
// This strips off the fragment part.
webRequest.setURL(url());
« no previous file with comments | « Source/modules/fetch/Request.h ('k') | Source/modules/fetch/Request.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698