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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 block.Reset(); | 194 block.Reset(); |
195 } else | 195 } else |
196 state->hadException = false; | 196 state->hadException = false; |
197 | 197 |
198 if (result.IsEmpty() || result->IsUndefined()) | 198 if (result.IsEmpty() || result->IsUndefined()) |
199 return ScriptValue(); | 199 return ScriptValue(); |
200 | 200 |
201 return ScriptValue(result, m_isolate); | 201 return ScriptValue(result, m_isolate); |
202 } | 202 } |
203 | 203 |
204 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr
<ErrorEvent>* errorEvent) | 204 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr
WillBeRawPtr<ErrorEvent>* errorEvent) |
205 { | 205 { |
206 if (isExecutionForbidden()) | 206 if (isExecutionForbidden()) |
207 return; | 207 return; |
208 | 208 |
209 WorkerGlobalScopeExecutionState state; | 209 WorkerGlobalScopeExecutionState state; |
210 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos
ition(), &state); | 210 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos
ition(), &state); |
211 if (state.hadException) { | 211 if (state.hadException) { |
212 if (errorEvent) { | 212 if (errorEvent) { |
213 *errorEvent = m_workerGlobalScope.shouldSanitizeScriptError(state.so
urceURL, NotSharableCrossOrigin) ? | 213 *errorEvent = m_workerGlobalScope.shouldSanitizeScriptError(state.so
urceURL, NotSharableCrossOrigin) ? |
214 ErrorEvent::createSanitizedError(m_world.get()) : ErrorEvent::cr
eate(state.errorMessage, state.sourceURL, state.lineNumber, state.columnNumber,
m_world.get()); | 214 ErrorEvent::createSanitizedError(m_world.get()) : ErrorEvent::cr
eate(state.errorMessage, state.sourceURL, state.lineNumber, state.columnNumber,
m_world.get()); |
215 V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(),
state.exception.v8Value(), m_isolate); | 215 V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(),
state.exception.v8Value(), m_isolate); |
216 } else { | 216 } else { |
217 ASSERT(!m_workerGlobalScope.shouldSanitizeScriptError(state.sourceUR
L, NotSharableCrossOrigin)); | 217 ASSERT(!m_workerGlobalScope.shouldSanitizeScriptError(state.sourceUR
L, NotSharableCrossOrigin)); |
218 RefPtr<ErrorEvent> event = m_errorEventFromImportedScript ? m_errorE
ventFromImportedScript.release() : ErrorEvent::create(state.errorMessage, state.
sourceURL, state.lineNumber, state.columnNumber, m_world.get()); | 218 RefPtrWillBeRawPtr<ErrorEvent> event = m_errorEventFromImportedScrip
t ? m_errorEventFromImportedScript.release() : ErrorEvent::create(state.errorMes
sage, state.sourceURL, state.lineNumber, state.columnNumber, m_world.get()); |
219 m_workerGlobalScope.reportException(event, nullptr, NotSharableCross
Origin); | 219 m_workerGlobalScope.reportException(event, nullptr, NotSharableCross
Origin); |
220 } | 220 } |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 void WorkerScriptController::scheduleExecutionTermination() | 224 void WorkerScriptController::scheduleExecutionTermination() |
225 { | 225 { |
226 // The mutex provides a memory barrier to ensure that once | 226 // The mutex provides a memory barrier to ensure that once |
227 // termination is scheduled, isExecutionTerminating will | 227 // termination is scheduled, isExecutionTerminating will |
228 // accurately reflect that state when called from another thread. | 228 // accurately reflect that state when called from another thread. |
(...skipping 21 matching lines...) Expand all Loading... |
250 { | 250 { |
251 ASSERT(m_workerGlobalScope.isContextThread()); | 251 ASSERT(m_workerGlobalScope.isContextThread()); |
252 return m_executionForbidden; | 252 return m_executionForbidden; |
253 } | 253 } |
254 | 254 |
255 void WorkerScriptController::disableEval(const String& errorMessage) | 255 void WorkerScriptController::disableEval(const String& errorMessage) |
256 { | 256 { |
257 m_disableEvalPending = errorMessage; | 257 m_disableEvalPending = errorMessage; |
258 } | 258 } |
259 | 259 |
260 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtr<Error
Event> errorEvent) | 260 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe
RawPtr<ErrorEvent> errorEvent) |
261 { | 261 { |
262 m_errorEventFromImportedScript = errorEvent; | 262 m_errorEventFromImportedScript = errorEvent; |
263 throwError(V8ThrowException::createError(v8GeneralError, m_errorEventFromImp
ortedScript->message(), m_isolate), m_isolate); | 263 throwError(V8ThrowException::createError(v8GeneralError, m_errorEventFromImp
ortedScript->message(), m_isolate), m_isolate); |
264 } | 264 } |
265 | 265 |
266 } // namespace WebCore | 266 } // namespace WebCore |
OLD | NEW |