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

Unified Diff: Source/modules/fetch/FetchManager.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
Index: Source/modules/fetch/FetchManager.cpp
diff --git a/Source/modules/fetch/FetchManager.cpp b/Source/modules/fetch/FetchManager.cpp
index 4f0650c0000189d77c29dfb5ff630218d65a5c28..29b2f61ea1404304127a1d3fe565bbd53ff39aa9 100644
--- a/Source/modules/fetch/FetchManager.cpp
+++ b/Source/modules/fetch/FetchManager.cpp
@@ -360,7 +360,7 @@ void FetchManager::Loader::performHTTPFetch(bool corsFlag, bool corsPreflightFla
// We use ResourceRequest class for HTTPRequest.
// FIXME: Support body.
ResourceRequest request(m_request->url());
- request.setRequestContext(WebURLRequest::RequestContextFetch);
+ request.setRequestContext(m_request->context());
request.setHTTPMethod(m_request->method());
const Vector<OwnPtr<FetchHeaderList::Header>>& list = m_request->headerList()->list();
for (size_t i = 0; i < list.size(); ++i) {
@@ -469,6 +469,8 @@ ScriptPromise FetchManager::fetch(ScriptState* scriptState, FetchRequestData* re
RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
+ request->setContext(WebURLRequest::RequestContextFetch);
+
OwnPtrWillBeRawPtr<Loader> ownLoader = Loader::create(m_executionContext, this, resolver.release(), request);
Loader* loader = m_loaders.add(ownLoader.release()).storedValue->get();
loader->start();

Powered by Google App Engine
This is Rietveld 408576698