OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/loader/WorkerFetchContext.h" | 5 #include "core/loader/WorkerFetchContext.h" |
6 | 6 |
7 #include "core/frame/Deprecation.h" | 7 #include "core/frame/Deprecation.h" |
8 #include "core/frame/UseCounter.h" | 8 #include "core/frame/UseCounter.h" |
9 #include "core/loader/MixedContentChecker.h" | 9 #include "core/loader/MixedContentChecker.h" |
10 #include "core/timing/WorkerGlobalScopePerformance.h" | 10 #include "core/timing/WorkerGlobalScopePerformance.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 const ResourceLoaderOptions& options, | 256 const ResourceLoaderOptions& options, |
257 SecurityViolationReportingPolicy reporting_policy, | 257 SecurityViolationReportingPolicy reporting_policy, |
258 ResourceRequest& out_request) { | 258 ResourceRequest& out_request) { |
259 SetFirstPartyCookieAndRequestorOrigin(out_request); | 259 SetFirstPartyCookieAndRequestorOrigin(out_request); |
260 } | 260 } |
261 | 261 |
262 void WorkerFetchContext::SetFirstPartyCookieAndRequestorOrigin( | 262 void WorkerFetchContext::SetFirstPartyCookieAndRequestorOrigin( |
263 ResourceRequest& out_request) { | 263 ResourceRequest& out_request) { |
264 if (out_request.FirstPartyForCookies().IsNull()) | 264 if (out_request.FirstPartyForCookies().IsNull()) |
265 out_request.SetFirstPartyForCookies(FirstPartyForCookies()); | 265 out_request.SetFirstPartyForCookies(FirstPartyForCookies()); |
266 // TODO(mkwst): It would be cleaner to adjust blink::ResourceRequest to | 266 if (!out_request.RequestorOrigin()) |
267 // initialize itself with a `nullptr` initiator so that this can be a simple | |
268 // `isNull()` check. https://crbug.com/625969 | |
269 if (out_request.RequestorOrigin()->IsUnique()) | |
270 out_request.SetRequestorOrigin(GetSecurityOrigin()); | 267 out_request.SetRequestorOrigin(GetSecurityOrigin()); |
271 } | 268 } |
272 | 269 |
273 DEFINE_TRACE(WorkerFetchContext) { | 270 DEFINE_TRACE(WorkerFetchContext) { |
274 visitor->Trace(worker_global_scope_); | 271 visitor->Trace(worker_global_scope_); |
275 visitor->Trace(resource_fetcher_); | 272 visitor->Trace(resource_fetcher_); |
276 BaseFetchContext::Trace(visitor); | 273 BaseFetchContext::Trace(visitor); |
277 } | 274 } |
278 | 275 |
279 void ProvideWorkerFetchContextToWorker( | 276 void ProvideWorkerFetchContextToWorker( |
280 WorkerClients* clients, | 277 WorkerClients* clients, |
281 std::unique_ptr<WebWorkerFetchContext> web_context) { | 278 std::unique_ptr<WebWorkerFetchContext> web_context) { |
282 DCHECK(clients); | 279 DCHECK(clients); |
283 WorkerFetchContextHolder::ProvideTo( | 280 WorkerFetchContextHolder::ProvideTo( |
284 *clients, WorkerFetchContextHolder::SupplementName(), | 281 *clients, WorkerFetchContextHolder::SupplementName(), |
285 new WorkerFetchContextHolder(std::move(web_context))); | 282 new WorkerFetchContextHolder(std::move(web_context))); |
286 } | 283 } |
287 | 284 |
288 } // namespace blink | 285 } // namespace blink |
OLD | NEW |