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/dom/TaskRunnerHelper.h" | 7 #include "core/dom/TaskRunnerHelper.h" |
8 #include "core/frame/Deprecation.h" | 8 #include "core/frame/Deprecation.h" |
9 #include "core/frame/UseCounter.h" | 9 #include "core/frame/UseCounter.h" |
10 #include "core/loader/MixedContentChecker.h" | 10 #include "core/loader/MixedContentChecker.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 const ResourceLoaderOptions& options, | 255 const ResourceLoaderOptions& options, |
256 SecurityViolationReportingPolicy reporting_policy, | 256 SecurityViolationReportingPolicy reporting_policy, |
257 ResourceRequest& out_request) { | 257 ResourceRequest& out_request) { |
258 SetFirstPartyCookieAndRequestorOrigin(out_request); | 258 SetFirstPartyCookieAndRequestorOrigin(out_request); |
259 } | 259 } |
260 | 260 |
261 void WorkerFetchContext::SetFirstPartyCookieAndRequestorOrigin( | 261 void WorkerFetchContext::SetFirstPartyCookieAndRequestorOrigin( |
262 ResourceRequest& out_request) { | 262 ResourceRequest& out_request) { |
263 if (out_request.FirstPartyForCookies().IsNull()) | 263 if (out_request.FirstPartyForCookies().IsNull()) |
264 out_request.SetFirstPartyForCookies(FirstPartyForCookies()); | 264 out_request.SetFirstPartyForCookies(FirstPartyForCookies()); |
265 // TODO(mkwst): It would be cleaner to adjust blink::ResourceRequest to | 265 if (!out_request.RequestorOrigin()) |
266 // initialize itself with a `nullptr` initiator so that this can be a simple | |
267 // `isNull()` check. https://crbug.com/625969 | |
268 if (out_request.RequestorOrigin()->IsUnique()) | |
269 out_request.SetRequestorOrigin(GetSecurityOrigin()); | 266 out_request.SetRequestorOrigin(GetSecurityOrigin()); |
270 } | 267 } |
271 | 268 |
272 DEFINE_TRACE(WorkerFetchContext) { | 269 DEFINE_TRACE(WorkerFetchContext) { |
273 visitor->Trace(global_scope_); | 270 visitor->Trace(global_scope_); |
274 visitor->Trace(resource_fetcher_); | 271 visitor->Trace(resource_fetcher_); |
275 BaseFetchContext::Trace(visitor); | 272 BaseFetchContext::Trace(visitor); |
276 } | 273 } |
277 | 274 |
278 void ProvideWorkerFetchContextToWorker( | 275 void ProvideWorkerFetchContextToWorker( |
279 WorkerClients* clients, | 276 WorkerClients* clients, |
280 std::unique_ptr<WebWorkerFetchContext> web_context) { | 277 std::unique_ptr<WebWorkerFetchContext> web_context) { |
281 DCHECK(clients); | 278 DCHECK(clients); |
282 WorkerFetchContextHolder::ProvideTo( | 279 WorkerFetchContextHolder::ProvideTo( |
283 *clients, WorkerFetchContextHolder::SupplementName(), | 280 *clients, WorkerFetchContextHolder::SupplementName(), |
284 new WorkerFetchContextHolder(std::move(web_context))); | 281 new WorkerFetchContextHolder(std::move(web_context))); |
285 } | 282 } |
286 | 283 |
287 } // namespace blink | 284 } // namespace blink |
OLD | NEW |