OLD | NEW |
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Construct substitute data source for the 'shadow page'. We only need it | 161 // Construct substitute data source for the 'shadow page'. We only need it |
162 // to have same origin as the worker so the loading checks work correctly. | 162 // to have same origin as the worker so the loading checks work correctly. |
163 CString content(""); | 163 CString content(""); |
164 RefPtr<SharedBuffer> buffer( | 164 RefPtr<SharedBuffer> buffer( |
165 SharedBuffer::create(content.data(), content.length())); | 165 SharedBuffer::create(content.data(), content.length())); |
166 m_mainFrame->frame()->loader().load( | 166 m_mainFrame->frame()->loader().load( |
167 FrameLoadRequest(0, ResourceRequest(m_url), | 167 FrameLoadRequest(0, ResourceRequest(m_url), |
168 SubstituteData(buffer, "text/html", "UTF-8", KURL()))); | 168 SubstituteData(buffer, "text/html", "UTF-8", KURL()))); |
169 } | 169 } |
170 | 170 |
171 void WebSharedWorkerImpl::didFinishDocumentLoad(WebLocalFrame* frame) { | 171 void WebSharedWorkerImpl::didFinishDocumentLoad() { |
172 DCHECK_EQ(frame, m_mainFrame); | |
173 DCHECK(isMainThread()); | 172 DCHECK(isMainThread()); |
174 DCHECK(!m_loadingDocument); | 173 DCHECK(!m_loadingDocument); |
175 DCHECK(!m_mainScriptLoader); | 174 DCHECK(!m_mainScriptLoader); |
176 frame->dataSource()->setServiceWorkerNetworkProvider( | 175 m_mainFrame->dataSource()->setServiceWorkerNetworkProvider( |
177 WTF::wrapUnique(m_client->createServiceWorkerNetworkProvider())); | 176 WTF::wrapUnique(m_client->createServiceWorkerNetworkProvider())); |
178 m_mainScriptLoader = WorkerScriptLoader::create(); | 177 m_mainScriptLoader = WorkerScriptLoader::create(); |
179 m_mainScriptLoader->setRequestContext( | 178 m_mainScriptLoader->setRequestContext( |
180 WebURLRequest::RequestContextSharedWorker); | 179 WebURLRequest::RequestContextSharedWorker); |
181 m_loadingDocument = toWebLocalFrameImpl(frame)->frame()->document(); | 180 m_loadingDocument = m_mainFrame->frame()->document(); |
182 | 181 |
183 CrossOriginRequestPolicy crossOriginRequestPolicy = | 182 CrossOriginRequestPolicy crossOriginRequestPolicy = |
184 (static_cast<KURL>(m_url)).protocolIsData() ? AllowCrossOriginRequests | 183 (static_cast<KURL>(m_url)).protocolIsData() ? AllowCrossOriginRequests |
185 : DenyCrossOriginRequests; | 184 : DenyCrossOriginRequests; |
186 | 185 |
187 m_mainScriptLoader->loadAsynchronously( | 186 m_mainScriptLoader->loadAsynchronously( |
188 *m_loadingDocument.get(), m_url, crossOriginRequestPolicy, | 187 *m_loadingDocument.get(), m_url, crossOriginRequestPolicy, |
189 m_creationAddressSpace, | 188 m_creationAddressSpace, |
190 bind(&WebSharedWorkerImpl::didReceiveScriptLoaderResponse, | 189 bind(&WebSharedWorkerImpl::didReceiveScriptLoaderResponse, |
191 WTF::unretained(this)), | 190 WTF::unretained(this)), |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 if (devtoolsAgent) | 419 if (devtoolsAgent) |
421 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, | 420 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, |
422 message); | 421 message); |
423 } | 422 } |
424 | 423 |
425 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) { | 424 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) { |
426 return new WebSharedWorkerImpl(client); | 425 return new WebSharedWorkerImpl(client); |
427 } | 426 } |
428 | 427 |
429 } // namespace blink | 428 } // namespace blink |
OLD | NEW |