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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr <ErrorEvent>* errorEvent) | 182 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr <ErrorEvent>* errorEvent) |
183 { | 183 { |
184 if (isExecutionForbidden()) | 184 if (isExecutionForbidden()) |
185 return; | 185 return; |
186 | 186 |
187 WorkerGlobalScopeExecutionState state; | 187 WorkerGlobalScopeExecutionState state; |
188 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos ition(), &state); | 188 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos ition(), &state); |
189 if (state.hadException) { | 189 if (state.hadException) { |
190 if (errorEvent) { | 190 if (errorEvent) { |
191 *errorEvent = m_workerGlobalScope->shouldSanitizeScriptError(state.s ourceURL, NotSharableCrossOrigin) ? | 191 *errorEvent = m_workerGlobalScope->shouldSanitizeScriptError(state.s ourceURL, NotSharableCrossOrigin) ? |
192 ErrorEvent::createSanitizedError() : ErrorEvent::create(state.er rorMessage, state.sourceURL, state.lineNumber, state.columnNumber); | 192 ErrorEvent::createSanitizedError() : ErrorEvent::create(state.er rorMessage, state.sourceURL, state.lineNumber, state.columnNumber, 0); |
adamk
2013/09/05 19:24:20
The magic-ness of "workers don't have worlds" is b
| |
193 V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(), state.exception.v8Value(), m_isolate); | 193 V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(), state.exception.v8Value(), m_isolate); |
194 } else { | 194 } else { |
195 ASSERT(!m_workerGlobalScope->shouldSanitizeScriptError(state.sourceU RL, NotSharableCrossOrigin)); | 195 ASSERT(!m_workerGlobalScope->shouldSanitizeScriptError(state.sourceU RL, NotSharableCrossOrigin)); |
196 RefPtr<ErrorEvent> event = m_errorEventFromImportedScript ? m_errorE ventFromImportedScript.release() : ErrorEvent::create(state.errorMessage, state. sourceURL, state.lineNumber, state.columnNumber); | 196 RefPtr<ErrorEvent> event = m_errorEventFromImportedScript ? m_errorE ventFromImportedScript.release() : ErrorEvent::create(state.errorMessage, state. sourceURL, state.lineNumber, state.columnNumber, 0); |
197 m_workerGlobalScope->reportException(event, 0, NotSharableCrossOrigi n); | 197 m_workerGlobalScope->reportException(event, 0, NotSharableCrossOrigi n); |
198 } | 198 } |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
202 void WorkerScriptController::scheduleExecutionTermination() | 202 void WorkerScriptController::scheduleExecutionTermination() |
203 { | 203 { |
204 // The mutex provides a memory barrier to ensure that once | 204 // The mutex provides a memory barrier to ensure that once |
205 // termination is scheduled, isExecutionTerminating will | 205 // termination is scheduled, isExecutionTerminating will |
206 // accurately reflect that state when called from another thread. | 206 // accurately reflect that state when called from another thread. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 v8::Handle<v8::Object> global = context->Global(); | 250 v8::Handle<v8::Object> global = context->Global(); |
251 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::GetTempla te(context->GetIsolate(), WorkerWorld)); | 251 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::GetTempla te(context->GetIsolate(), WorkerWorld)); |
252 // Return 0 if the current executing context is not the worker context. | 252 // Return 0 if the current executing context is not the worker context. |
253 if (global.IsEmpty()) | 253 if (global.IsEmpty()) |
254 return 0; | 254 return 0; |
255 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global) ; | 255 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global) ; |
256 return workerGlobalScope->script(); | 256 return workerGlobalScope->script(); |
257 } | 257 } |
258 | 258 |
259 } // namespace WebCore | 259 } // namespace WebCore |
OLD | NEW |