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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr
<ErrorEvent>* errorEvent) | 206 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr
<ErrorEvent>* errorEvent) |
207 { | 207 { |
208 if (isExecutionForbidden()) | 208 if (isExecutionForbidden()) |
209 return; | 209 return; |
210 | 210 |
211 WorkerGlobalScopeExecutionState state; | 211 WorkerGlobalScopeExecutionState state; |
212 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos
ition(), &state); | 212 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos
ition(), &state); |
213 if (state.hadException) { | 213 if (state.hadException) { |
214 if (errorEvent) { | 214 if (errorEvent) { |
215 *errorEvent = m_workerGlobalScope.shouldSanitizeScriptError(state.so
urceURL, NotSharableCrossOrigin) ? | 215 *errorEvent = m_workerGlobalScope.shouldSanitizeScriptError(state.so
urceURL, NotSharableCrossOrigin) ? |
216 ErrorEvent::createSanitizedError(nullptr) : ErrorEvent::create(s
tate.errorMessage, state.sourceURL, state.lineNumber, state.columnNumber, nullpt
r); | 216 ErrorEvent::createSanitizedError(0) : ErrorEvent::create(state.e
rrorMessage, state.sourceURL, state.lineNumber, state.columnNumber, 0); |
217 V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(),
state.exception.v8Value(), m_isolate); | 217 V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(),
state.exception.v8Value(), m_isolate); |
218 } else { | 218 } else { |
219 ASSERT(!m_workerGlobalScope.shouldSanitizeScriptError(state.sourceUR
L, NotSharableCrossOrigin)); | 219 ASSERT(!m_workerGlobalScope.shouldSanitizeScriptError(state.sourceUR
L, NotSharableCrossOrigin)); |
220 RefPtr<ErrorEvent> event = m_errorEventFromImportedScript ? m_errorE
ventFromImportedScript.release() : ErrorEvent::create(state.errorMessage, state.
sourceURL, state.lineNumber, state.columnNumber, nullptr); | 220 RefPtr<ErrorEvent> event = m_errorEventFromImportedScript ? m_errorE
ventFromImportedScript.release() : ErrorEvent::create(state.errorMessage, state.
sourceURL, state.lineNumber, state.columnNumber, 0); |
221 m_workerGlobalScope.reportException(event, nullptr, NotSharableCross
Origin); | 221 m_workerGlobalScope.reportException(event, nullptr, NotSharableCross
Origin); |
222 } | 222 } |
223 } | 223 } |
224 } | 224 } |
225 | 225 |
226 void WorkerScriptController::scheduleExecutionTermination() | 226 void WorkerScriptController::scheduleExecutionTermination() |
227 { | 227 { |
228 // The mutex provides a memory barrier to ensure that once | 228 // The mutex provides a memory barrier to ensure that once |
229 // termination is scheduled, isExecutionTerminating will | 229 // termination is scheduled, isExecutionTerminating will |
230 // accurately reflect that state when called from another thread. | 230 // accurately reflect that state when called from another thread. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); | 273 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); |
274 v8::Handle<v8::Object> global = V8WorkerGlobalScope::findInstanceInPrototype
Chain(context->Global(), isolate); | 274 v8::Handle<v8::Object> global = V8WorkerGlobalScope::findInstanceInPrototype
Chain(context->Global(), isolate); |
275 // Return 0 if the current executing context is not the worker context. | 275 // Return 0 if the current executing context is not the worker context. |
276 if (global.IsEmpty()) | 276 if (global.IsEmpty()) |
277 return 0; | 277 return 0; |
278 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global)
; | 278 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global)
; |
279 return workerGlobalScope->script(); | 279 return workerGlobalScope->script(); |
280 } | 280 } |
281 | 281 |
282 } // namespace WebCore | 282 } // namespace WebCore |
OLD | NEW |