OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 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 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 | 32 |
33 #include "bindings/v8/WorkerScriptController.h" | 33 #include "bindings/core/v8/WorkerScriptController.h" |
34 | 34 |
| 35 #include "bindings/core/v8/ScriptSourceCode.h" |
| 36 #include "bindings/core/v8/ScriptValue.h" |
35 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h" | 37 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h" |
| 38 #include "bindings/core/v8/V8ErrorHandler.h" |
| 39 #include "bindings/core/v8/V8GCController.h" |
| 40 #include "bindings/core/v8/V8Initializer.h" |
| 41 #include "bindings/core/v8/V8ObjectConstructor.h" |
| 42 #include "bindings/core/v8/V8ScriptRunner.h" |
36 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h" | 43 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h" |
37 #include "bindings/core/v8/V8WorkerGlobalScope.h" | 44 #include "bindings/core/v8/V8WorkerGlobalScope.h" |
| 45 #include "bindings/core/v8/WrapperTypeInfo.h" |
38 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" | 46 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" |
39 #include "bindings/v8/ScriptSourceCode.h" | |
40 #include "bindings/v8/ScriptValue.h" | |
41 #include "bindings/v8/V8ErrorHandler.h" | |
42 #include "bindings/v8/V8GCController.h" | |
43 #include "bindings/v8/V8Initializer.h" | |
44 #include "bindings/v8/V8ObjectConstructor.h" | |
45 #include "bindings/v8/V8ScriptRunner.h" | |
46 #include "bindings/v8/WrapperTypeInfo.h" | |
47 #include "core/events/ErrorEvent.h" | 47 #include "core/events/ErrorEvent.h" |
48 #include "core/frame/DOMTimer.h" | 48 #include "core/frame/DOMTimer.h" |
49 #include "core/inspector/ScriptCallStack.h" | 49 #include "core/inspector/ScriptCallStack.h" |
50 #include "core/workers/SharedWorkerGlobalScope.h" | 50 #include "core/workers/SharedWorkerGlobalScope.h" |
51 #include "core/workers/WorkerGlobalScope.h" | 51 #include "core/workers/WorkerGlobalScope.h" |
52 #include "core/workers/WorkerObjectProxy.h" | 52 #include "core/workers/WorkerObjectProxy.h" |
53 #include "core/workers/WorkerThread.h" | 53 #include "core/workers/WorkerThread.h" |
54 #include "platform/heap/ThreadState.h" | 54 #include "platform/heap/ThreadState.h" |
55 #include <v8.h> | |
56 | |
57 #include "public/platform/Platform.h" | 55 #include "public/platform/Platform.h" |
58 #include "public/platform/WebWorkerRunLoop.h" | 56 #include "public/platform/WebWorkerRunLoop.h" |
| 57 #include <v8.h> |
59 | 58 |
60 namespace WebCore { | 59 namespace WebCore { |
61 | 60 |
62 WorkerScriptController::WorkerScriptController(WorkerGlobalScope& workerGlobalSc
ope) | 61 WorkerScriptController::WorkerScriptController(WorkerGlobalScope& workerGlobalSc
ope) |
63 : m_isolate(v8::Isolate::New()) | 62 : m_isolate(v8::Isolate::New()) |
64 , m_workerGlobalScope(workerGlobalScope) | 63 , m_workerGlobalScope(workerGlobalScope) |
65 , m_executionForbidden(false) | 64 , m_executionForbidden(false) |
66 , m_executionScheduledToTerminate(false) | 65 , m_executionScheduledToTerminate(false) |
67 { | 66 { |
68 m_isolate->Enter(); | 67 m_isolate->Enter(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 if (block.HasCaught()) { | 180 if (block.HasCaught()) { |
182 v8::Local<v8::Message> message = block.Message(); | 181 v8::Local<v8::Message> message = block.Message(); |
183 state->hadException = true; | 182 state->hadException = true; |
184 state->errorMessage = toCoreString(message->Get()); | 183 state->errorMessage = toCoreString(message->Get()); |
185 state->lineNumber = message->GetLineNumber(); | 184 state->lineNumber = message->GetLineNumber(); |
186 state->columnNumber = message->GetStartColumn() + 1; | 185 state->columnNumber = message->GetStartColumn() + 1; |
187 TOSTRING_DEFAULT(V8StringResource<>, sourceURL, message->GetScriptOrigin
().ResourceName(), ScriptValue()); | 186 TOSTRING_DEFAULT(V8StringResource<>, sourceURL, message->GetScriptOrigin
().ResourceName(), ScriptValue()); |
188 state->sourceURL = sourceURL; | 187 state->sourceURL = sourceURL; |
189 state->exception = ScriptValue(m_scriptState.get(), block.Exception()); | 188 state->exception = ScriptValue(m_scriptState.get(), block.Exception()); |
190 block.Reset(); | 189 block.Reset(); |
191 } else | 190 } else { |
192 state->hadException = false; | 191 state->hadException = false; |
| 192 } |
193 | 193 |
194 if (result.IsEmpty() || result->IsUndefined()) | 194 if (result.IsEmpty() || result->IsUndefined()) |
195 return ScriptValue(); | 195 return ScriptValue(); |
196 | 196 |
197 return ScriptValue(m_scriptState.get(), result); | 197 return ScriptValue(m_scriptState.get(), result); |
198 } | 198 } |
199 | 199 |
200 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr
WillBeRawPtr<ErrorEvent>* errorEvent) | 200 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr
WillBeRawPtr<ErrorEvent>* errorEvent) |
201 { | 201 { |
202 if (isExecutionForbidden()) | 202 if (isExecutionForbidden()) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 m_disableEvalPending = errorMessage; | 258 m_disableEvalPending = errorMessage; |
259 } | 259 } |
260 | 260 |
261 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe
RawPtr<ErrorEvent> errorEvent) | 261 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe
RawPtr<ErrorEvent> errorEvent) |
262 { | 262 { |
263 m_errorEventFromImportedScript = errorEvent; | 263 m_errorEventFromImportedScript = errorEvent; |
264 throwError(V8ThrowException::createError(v8GeneralError, m_errorEventFromImp
ortedScript->message(), m_isolate), m_isolate); | 264 throwError(V8ThrowException::createError(v8GeneralError, m_errorEventFromImp
ortedScript->message(), m_isolate), m_isolate); |
265 } | 265 } |
266 | 266 |
267 } // namespace WebCore | 267 } // namespace WebCore |
OLD | NEW |