Index: third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp |
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp |
index 626956c7ecc84603cab1db5d46b7f5b7bff3f99a..2c70a201e9154470227aaf278aff07d9372fa47d 100644 |
--- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp |
+++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp |
@@ -38,6 +38,7 @@ |
#include "core/inspector/ConsoleMessage.h" |
#include "core/loader/FrameLoadRequest.h" |
#include "core/loader/ThreadableLoadingContext.h" |
+#include "core/loader/WorkerFetchContext.h" |
#include "core/probe/CoreProbes.h" |
#include "core/workers/ParentFrameTaskRunners.h" |
#include "core/workers/WorkerClients.h" |
@@ -333,6 +334,7 @@ void WebEmbeddedWorkerImpl::loadShadowPage() { |
void WebEmbeddedWorkerImpl::didFinishDocumentLoad(WebLocalFrame* frame) { |
DCHECK_EQ(frame, m_mainFrame); |
DCHECK(!m_mainScriptLoader); |
+ DCHECK(!m_webWorkerFetchContextInfo); |
DCHECK(m_mainFrame); |
DCHECK(m_workerContextClient); |
DCHECK(m_loadingShadowPage); |
@@ -340,6 +342,8 @@ void WebEmbeddedWorkerImpl::didFinishDocumentLoad(WebLocalFrame* frame) { |
m_loadingShadowPage = false; |
frame->dataSource()->setServiceWorkerNetworkProvider(WTF::wrapUnique( |
m_workerContextClient->createServiceWorkerNetworkProvider())); |
+ m_webWorkerFetchContextInfo = WTF::wrapUnique( |
+ m_workerContextClient->createServiceWorkerFetchContextInfo()); |
m_mainScriptLoader = WorkerScriptLoader::create(); |
m_mainScriptLoader->setRequestContext( |
WebURLRequest::RequestContextServiceWorker); |
@@ -430,6 +434,16 @@ void WebEmbeddedWorkerImpl::startWorkerThread() { |
workerClients, |
WTF::wrapUnique(m_workerContextClient->createServiceWorkerProvider())); |
+ // |m_webWorkerFetchContextInfo| is null if off-main-thread-fetch is disabled. |
+ if (m_webWorkerFetchContextInfo) { |
+ provideWorkerFetchContextInfoToWorker( |
+ workerClients, std::move(m_webWorkerFetchContextInfo)); |
+ WorkerFetchContextInfo* workerFetchContextInfo = |
+ WorkerFetchContextInfo::from(*workerClients); |
+ workerFetchContextInfo->setDataSaverEnabled( |
+ document->frame()->settings()->getDataSaverEnabled()); |
+ } |
+ |
// We need to set the CSP to both the shadow page's document and the |
// ServiceWorkerGlobalScope. |
document->initContentSecurityPolicy( |