OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/workers/InProcessWorkerBase.h" | 5 #include "core/workers/InProcessWorkerBase.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "core/events/MessageEvent.h" | 8 #include "core/events/MessageEvent.h" |
9 #include "core/fetch/ResourceFetcher.h" | 9 #include "core/fetch/ResourceFetcher.h" |
10 #include "core/frame/LocalDOMWindow.h" | 10 #include "core/frame/LocalDOMWindow.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(con
text, ports, exceptionState); | 39 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(con
text, ports, exceptionState); |
40 if (exceptionState.hadException()) | 40 if (exceptionState.hadException()) |
41 return; | 41 return; |
42 m_contextProxy->postMessageToWorkerGlobalScope(message, std::move(channels))
; | 42 m_contextProxy->postMessageToWorkerGlobalScope(message, std::move(channels))
; |
43 } | 43 } |
44 | 44 |
45 bool InProcessWorkerBase::initialize(ExecutionContext* context, const String& ur
l, ExceptionState& exceptionState) | 45 bool InProcessWorkerBase::initialize(ExecutionContext* context, const String& ur
l, ExceptionState& exceptionState) |
46 { | 46 { |
47 suspendIfNeeded(); | 47 suspendIfNeeded(); |
48 | 48 |
49 KURL scriptURL = resolveURL(url, exceptionState); | 49 // TODO(mkwst): Revisit the context as https://drafts.css-houdini.org/workle
ts/ evolves. |
| 50 KURL scriptURL = resolveURL(url, exceptionState, WebURLRequest::RequestConte
xtScript); |
50 if (scriptURL.isEmpty()) | 51 if (scriptURL.isEmpty()) |
51 return false; | 52 return false; |
52 | 53 |
53 m_scriptLoader = WorkerScriptLoader::create(); | 54 m_scriptLoader = WorkerScriptLoader::create(); |
54 m_scriptLoader->loadAsynchronously( | 55 m_scriptLoader->loadAsynchronously( |
55 *context, | 56 *context, |
56 scriptURL, | 57 scriptURL, |
57 DenyCrossOriginRequests, | 58 DenyCrossOriginRequests, |
58 context->securityContext().addressSpace(), | 59 context->securityContext().addressSpace(), |
59 bind(&InProcessWorkerBase::onResponse, this), | 60 bind(&InProcessWorkerBase::onResponse, this), |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 m_scriptLoader = nullptr; | 107 m_scriptLoader = nullptr; |
107 } | 108 } |
108 | 109 |
109 DEFINE_TRACE(InProcessWorkerBase) | 110 DEFINE_TRACE(InProcessWorkerBase) |
110 { | 111 { |
111 visitor->trace(m_contentSecurityPolicy); | 112 visitor->trace(m_contentSecurityPolicy); |
112 AbstractWorker::trace(visitor); | 113 AbstractWorker::trace(visitor); |
113 } | 114 } |
114 | 115 |
115 } // namespace blink | 116 } // namespace blink |
OLD | NEW |