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

Side by Side Diff: third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp

Issue 1775933002: CORS-RFC1918: Pipe creator address space through SharedWorker creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // possible. 80 // possible.
81 81
82 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client) 82 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client)
83 : m_webView(nullptr) 83 : m_webView(nullptr)
84 , m_mainFrame(nullptr) 84 , m_mainFrame(nullptr)
85 , m_askedToTerminate(false) 85 , m_askedToTerminate(false)
86 , m_workerInspectorProxy(WorkerInspectorProxy::create()) 86 , m_workerInspectorProxy(WorkerInspectorProxy::create())
87 , m_client(client) 87 , m_client(client)
88 , m_pauseWorkerContextOnStart(false) 88 , m_pauseWorkerContextOnStart(false)
89 , m_isPausedOnStart(false) 89 , m_isPausedOnStart(false)
90 , m_creationAddressSpace(WebAddressSpacePublic)
90 { 91 {
91 } 92 }
92 93
93 WebSharedWorkerImpl::~WebSharedWorkerImpl() 94 WebSharedWorkerImpl::~WebSharedWorkerImpl()
94 { 95 {
95 ASSERT(m_webView); 96 ASSERT(m_webView);
96 // Detach the client before closing the view to avoid getting called back. 97 // Detach the client before closing the view to avoid getting called back.
97 m_mainFrame->setClient(0); 98 m_mainFrame->setClient(0);
98 99
99 m_webView->close(); 100 m_webView->close();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 ASSERT(!m_loadingDocument); 172 ASSERT(!m_loadingDocument);
172 ASSERT(!m_mainScriptLoader); 173 ASSERT(!m_mainScriptLoader);
173 m_networkProvider = adoptPtr(m_client->createServiceWorkerNetworkProvider(fr ame->dataSource())); 174 m_networkProvider = adoptPtr(m_client->createServiceWorkerNetworkProvider(fr ame->dataSource()));
174 m_mainScriptLoader = WorkerScriptLoader::create(); 175 m_mainScriptLoader = WorkerScriptLoader::create();
175 m_mainScriptLoader->setRequestContext(WebURLRequest::RequestContextSharedWor ker); 176 m_mainScriptLoader->setRequestContext(WebURLRequest::RequestContextSharedWor ker);
176 m_loadingDocument = toWebLocalFrameImpl(frame)->frame()->document(); 177 m_loadingDocument = toWebLocalFrameImpl(frame)->frame()->document();
177 m_mainScriptLoader->loadAsynchronously( 178 m_mainScriptLoader->loadAsynchronously(
178 *m_loadingDocument.get(), 179 *m_loadingDocument.get(),
179 m_url, 180 m_url,
180 DenyCrossOriginRequests, 181 DenyCrossOriginRequests,
182 m_creationAddressSpace,
181 bind(&WebSharedWorkerImpl::didReceiveScriptLoaderResponse, this), 183 bind(&WebSharedWorkerImpl::didReceiveScriptLoaderResponse, this),
182 bind(&WebSharedWorkerImpl::onScriptLoaderFinished, this)); 184 bind(&WebSharedWorkerImpl::onScriptLoaderFinished, this));
183 // Do nothing here since onScriptLoaderFinished() might have been already 185 // Do nothing here since onScriptLoaderFinished() might have been already
184 // invoked and |this| might have been deleted at this point. 186 // invoked and |this| might have been deleted at this point.
185 } 187 }
186 188
187 bool WebSharedWorkerImpl::isControlledByServiceWorker(WebDataSource& dataSource) 189 bool WebSharedWorkerImpl::isControlledByServiceWorker(WebDataSource& dataSource)
188 { 190 {
189 return m_networkProvider && m_networkProvider->isControlledByServiceWorker(d ataSource); 191 return m_networkProvider && m_networkProvider->isControlledByServiceWorker(d ataSource);
190 } 192 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 void WebSharedWorkerImpl::connectTask(PassOwnPtr<WebMessagePortChannel> channel, ExecutionContext* context) 287 void WebSharedWorkerImpl::connectTask(PassOwnPtr<WebMessagePortChannel> channel, ExecutionContext* context)
286 { 288 {
287 // Wrap the passed-in channel in a MessagePort, and send it off via a connec t event. 289 // Wrap the passed-in channel in a MessagePort, and send it off via a connec t event.
288 MessagePort* port = MessagePort::create(*context); 290 MessagePort* port = MessagePort::create(*context);
289 port->entangle(channel); 291 port->entangle(channel);
290 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); 292 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
291 ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScop e()); 293 ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScop e());
292 workerGlobalScope->dispatchEvent(createConnectEvent(port)); 294 workerGlobalScope->dispatchEvent(createConnectEvent(port));
293 } 295 }
294 296
295 void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType poli cyType) 297 void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType poli cyType, WebAddressSpace creationAddressSpace)
296 { 298 {
297 m_url = url; 299 m_url = url;
298 m_name = name; 300 m_name = name;
301 m_creationAddressSpace = creationAddressSpace;
299 initializeLoader(); 302 initializeLoader();
300 } 303 }
301 304
302 void WebSharedWorkerImpl::didReceiveScriptLoaderResponse() 305 void WebSharedWorkerImpl::didReceiveScriptLoaderResponse()
303 { 306 {
304 InspectorInstrumentation::didReceiveScriptResponse(m_loadingDocument.get(), m_mainScriptLoader->identifier()); 307 InspectorInstrumentation::didReceiveScriptResponse(m_loadingDocument.get(), m_mainScriptLoader->identifier());
305 m_client->selectAppCacheID(m_mainScriptLoader->appCacheID()); 308 m_client->selectAppCacheID(m_mainScriptLoader->appCacheID());
306 } 309 }
307 310
308 void WebSharedWorkerImpl::onScriptLoaderFinished() 311 void WebSharedWorkerImpl::onScriptLoaderFinished()
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 if (devtoolsAgent) 394 if (devtoolsAgent)
392 devtoolsAgent->dispatchOnInspectorBackend(sessionId, message); 395 devtoolsAgent->dispatchOnInspectorBackend(sessionId, message);
393 } 396 }
394 397
395 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) 398 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client)
396 { 399 {
397 return new WebSharedWorkerImpl(client); 400 return new WebSharedWorkerImpl(client);
398 } 401 }
399 402
400 } // namespace blink 403 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebSharedWorkerImpl.h ('k') | third_party/WebKit/public/blink_headers.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698