| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); | 405 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); |
| 406 | 406 |
| 407 WorkerClients* workerClients = WorkerClients::create(); | 407 WorkerClients* workerClients = WorkerClients::create(); |
| 408 provideContentSettingsClientToWorker(workerClients, std::move(m_contentSetti
ngsClient)); | 408 provideContentSettingsClientToWorker(workerClients, std::move(m_contentSetti
ngsClient)); |
| 409 provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create())
; | 409 provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create())
; |
| 410 provideServiceWorkerGlobalScopeClientToWorker(workerClients, ServiceWorkerGl
obalScopeClientImpl::create(*m_workerContextClient)); | 410 provideServiceWorkerGlobalScopeClientToWorker(workerClients, ServiceWorkerGl
obalScopeClientImpl::create(*m_workerContextClient)); |
| 411 provideServiceWorkerContainerClientToWorker(workerClients, wrapUnique(m_work
erContextClient->createServiceWorkerProvider())); | 411 provideServiceWorkerContainerClientToWorker(workerClients, wrapUnique(m_work
erContextClient->createServiceWorkerProvider())); |
| 412 | 412 |
| 413 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. | 413 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. |
| 414 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); | 414 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); |
| 415 if (!m_mainScriptLoader->referrerPolicy().isNull()) |
| 416 document->parseAndSetReferrerPolicy(m_mainScriptLoader->referrerPolicy()
); |
| 415 | 417 |
| 416 KURL scriptURL = m_mainScriptLoader->url(); | 418 KURL scriptURL = m_mainScriptLoader->url(); |
| 417 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do
cument); | 419 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do
cument); |
| 418 | 420 |
| 419 std::unique_ptr<WorkerThreadStartupData> startupData = WorkerThreadStartupDa
ta::create( | 421 std::unique_ptr<WorkerThreadStartupData> startupData = WorkerThreadStartupDa
ta::create( |
| 420 scriptURL, | 422 scriptURL, |
| 421 m_workerStartData.userAgent, | 423 m_workerStartData.userAgent, |
| 422 m_mainScriptLoader->script(), | 424 m_mainScriptLoader->script(), |
| 423 m_mainScriptLoader->releaseCachedMetadata(), | 425 m_mainScriptLoader->releaseCachedMetadata(), |
| 424 startMode, | 426 startMode, |
| 425 document->contentSecurityPolicy()->headers().get(), | 427 document->contentSecurityPolicy()->headers().get(), |
| 428 m_mainScriptLoader->referrerPolicy(), |
| 426 starterOrigin, | 429 starterOrigin, |
| 427 workerClients, | 430 workerClients, |
| 428 m_mainScriptLoader->responseAddressSpace(), | 431 m_mainScriptLoader->responseAddressSpace(), |
| 429 m_mainScriptLoader->originTrialTokens(), | 432 m_mainScriptLoader->originTrialTokens(), |
| 430 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions)); | 433 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions)); |
| 431 | 434 |
| 432 m_mainScriptLoader.clear(); | 435 m_mainScriptLoader.clear(); |
| 433 | 436 |
| 434 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); | 437 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); |
| 435 m_loaderProxy = WorkerLoaderProxy::create(this); | 438 m_loaderProxy = WorkerLoaderProxy::create(this); |
| 436 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); | 439 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); |
| 437 m_workerThread->start(std::move(startupData)); | 440 m_workerThread->start(std::move(startupData)); |
| 438 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); | 441 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); |
| 439 } | 442 } |
| 440 | 443 |
| 441 } // namespace blink | 444 } // namespace blink |
| OLD | NEW |