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

Unified Diff: third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp

Issue 2891453005: Pipe the FirstPartyForCookies to WorkerFetchContext for off-main-thread-fetch (Closed)
Patch Set: rebase Created 3 years, 7 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: third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
index 2c1fe8191064b80ef3d77d6117bb376b97d99649..93e5c20c9dad3406d10710f9f56e476a1f11926f 100644
--- a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
@@ -93,6 +93,10 @@ ResourceFetcher* WorkerFetchContext::GetResourceFetcher() {
return resource_fetcher_;
}
+KURL WorkerFetchContext::FirstPartyForCookies() const {
+ return web_context_->FirstPartyForCookies();
+}
+
ContentSettingsClient* WorkerFetchContext::GetContentSettingsClient() const {
// TODO(horo): Implement this.
return nullptr;
@@ -191,6 +195,28 @@ void WorkerFetchContext::AddResourceTiming(const ResourceTimingInfo& info) {
->AddResourceTiming(info);
}
+void WorkerFetchContext::PopulateResourceRequest(
+ const KURL& url,
+ Resource::Type type,
+ const ClientHintsPreferences& hints_preferences,
+ const FetchParameters::ResourceWidth& resource_width,
+ const ResourceLoaderOptions& options,
+ SecurityViolationReportingPolicy reporting_policy,
+ ResourceRequest& out_request) {
+ SetFirstPartyCookieAndRequestorOrigin(out_request);
+}
+
+void WorkerFetchContext::SetFirstPartyCookieAndRequestorOrigin(
+ ResourceRequest& out_request) {
+ if (out_request.FirstPartyForCookies().IsNull())
+ out_request.SetFirstPartyForCookies(FirstPartyForCookies());
+ // TODO(mkwst): It would be cleaner to adjust blink::ResourceRequest to
+ // initialize itself with a `nullptr` initiator so that this can be a simple
+ // `isNull()` check. https://crbug.com/625969
+ if (out_request.RequestorOrigin()->IsUnique())
+ out_request.SetRequestorOrigin(GetSecurityOrigin());
+}
+
DEFINE_TRACE(WorkerFetchContext) {
visitor->Trace(worker_global_scope_);
visitor->Trace(resource_fetcher_);
« no previous file with comments | « third_party/WebKit/Source/core/loader/WorkerFetchContext.h ('k') | third_party/WebKit/public/platform/WebWorkerFetchContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698