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