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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 m_disableEvalPending = String(); | 209 m_disableEvalPending = String(); |
210 } | 210 } |
211 | 211 |
212 v8::TryCatch block; | 212 v8::TryCatch block; |
213 | 213 |
214 v8::Handle<v8::String> scriptString = v8String(m_isolate, script); | 214 v8::Handle<v8::String> scriptString = v8String(m_isolate, script); |
215 v8::Handle<v8::Script> compiledScript = V8ScriptRunner::compileScript(script
String, fileName, scriptStartPosition, m_isolate, nullptr, nullptr, cacheHandler
, SharableCrossOrigin, v8CacheOptions); | 215 v8::Handle<v8::Script> compiledScript = V8ScriptRunner::compileScript(script
String, fileName, scriptStartPosition, m_isolate, nullptr, nullptr, cacheHandler
, SharableCrossOrigin, v8CacheOptions); |
216 v8::Local<v8::Value> result = V8ScriptRunner::runCompiledScript(m_isolate, c
ompiledScript, &m_workerGlobalScope); | 216 v8::Local<v8::Value> result = V8ScriptRunner::runCompiledScript(m_isolate, c
ompiledScript, &m_workerGlobalScope); |
217 | 217 |
218 if (!block.CanContinue()) { | 218 if (!block.CanContinue()) { |
219 m_workerGlobalScope.script()->forbidExecution(); | 219 forbidExecution(); |
220 return ScriptValue(); | 220 return ScriptValue(); |
221 } | 221 } |
222 | 222 |
223 if (block.HasCaught()) { | 223 if (block.HasCaught()) { |
224 v8::Local<v8::Message> message = block.Message(); | 224 v8::Local<v8::Message> message = block.Message(); |
225 m_globalScopeExecutionState->hadException = true; | 225 m_globalScopeExecutionState->hadException = true; |
226 m_globalScopeExecutionState->errorMessage = toCoreString(message->Get())
; | 226 m_globalScopeExecutionState->errorMessage = toCoreString(message->Get())
; |
227 m_globalScopeExecutionState->lineNumber = message->GetLineNumber(); | 227 m_globalScopeExecutionState->lineNumber = message->GetLineNumber(); |
228 m_globalScopeExecutionState->columnNumber = message->GetStartColumn() +
1; | 228 m_globalScopeExecutionState->columnNumber = message->GetStartColumn() +
1; |
229 TOSTRING_DEFAULT(V8StringResource<>, sourceURL, message->GetScriptOrigin
().ResourceName(), ScriptValue()); | 229 TOSTRING_DEFAULT(V8StringResource<>, sourceURL, message->GetScriptOrigin
().ResourceName(), ScriptValue()); |
(...skipping 10 matching lines...) Expand all Loading... |
240 return ScriptValue(m_scriptState.get(), result); | 240 return ScriptValue(m_scriptState.get(), result); |
241 } | 241 } |
242 | 242 |
243 bool WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr
WillBeRawPtr<ErrorEvent>* errorEvent, CachedMetadataHandler* cacheHandler, V8Cac
heOptions v8CacheOptions) | 243 bool WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr
WillBeRawPtr<ErrorEvent>* errorEvent, CachedMetadataHandler* cacheHandler, V8Cac
heOptions v8CacheOptions) |
244 { | 244 { |
245 if (isExecutionForbidden()) | 245 if (isExecutionForbidden()) |
246 return false; | 246 return false; |
247 | 247 |
248 WorkerGlobalScopeExecutionState state(this); | 248 WorkerGlobalScopeExecutionState state(this); |
249 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos
ition(), cacheHandler, v8CacheOptions); | 249 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos
ition(), cacheHandler, v8CacheOptions); |
| 250 if (isExecutionForbidden()) |
| 251 return false; |
250 if (state.hadException) { | 252 if (state.hadException) { |
251 if (errorEvent) { | 253 if (errorEvent) { |
252 if (state.m_errorEventFromImportedScript) { | 254 if (state.m_errorEventFromImportedScript) { |
253 // Propagate inner error event outwards. | 255 // Propagate inner error event outwards. |
254 *errorEvent = state.m_errorEventFromImportedScript.release(); | 256 *errorEvent = state.m_errorEventFromImportedScript.release(); |
255 return false; | 257 return false; |
256 } | 258 } |
257 if (m_workerGlobalScope.shouldSanitizeScriptError(state.sourceURL, N
otSharableCrossOrigin)) | 259 if (m_workerGlobalScope.shouldSanitizeScriptError(state.sourceURL, N
otSharableCrossOrigin)) |
258 *errorEvent = ErrorEvent::createSanitizedError(m_world.get()); | 260 *errorEvent = ErrorEvent::createSanitizedError(m_world.get()); |
259 else | 261 else |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 313 |
312 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe
RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) | 314 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe
RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) |
313 { | 315 { |
314 const String& errorMessage = errorEvent->message(); | 316 const String& errorMessage = errorEvent->message(); |
315 if (m_globalScopeExecutionState) | 317 if (m_globalScopeExecutionState) |
316 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent
; | 318 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent
; |
317 exceptionState.rethrowV8Exception(V8ThrowException::createGeneralError(m_iso
late, errorMessage)); | 319 exceptionState.rethrowV8Exception(V8ThrowException::createGeneralError(m_iso
late, errorMessage)); |
318 } | 320 } |
319 | 321 |
320 } // namespace blink | 322 } // namespace blink |
OLD | NEW |