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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 return ScriptValue(); | 161 return ScriptValue(); |
162 } | 162 } |
163 | 163 |
164 if (block.HasCaught()) { | 164 if (block.HasCaught()) { |
165 v8::Local<v8::Message> message = block.Message(); | 165 v8::Local<v8::Message> message = block.Message(); |
166 state->hadException = true; | 166 state->hadException = true; |
167 state->errorMessage = toWebCoreString(message->Get()); | 167 state->errorMessage = toWebCoreString(message->Get()); |
168 state->lineNumber = message->GetLineNumber(); | 168 state->lineNumber = message->GetLineNumber(); |
169 state->columnNumber = message->GetStartColumn(); | 169 state->columnNumber = message->GetStartColumn(); |
170 state->sourceURL = toWebCoreString(message->GetScriptResourceName()); | 170 state->sourceURL = toWebCoreString(message->GetScriptResourceName()); |
171 state->exception = ScriptValue(block.Exception()); | 171 state->exception = ScriptValue(block.Exception(), m_isolate); |
172 block.Reset(); | 172 block.Reset(); |
173 } else | 173 } else |
174 state->hadException = false; | 174 state->hadException = false; |
175 | 175 |
176 if (result.IsEmpty() || result->IsUndefined()) | 176 if (result.IsEmpty() || result->IsUndefined()) |
177 return ScriptValue(); | 177 return ScriptValue(); |
178 | 178 |
179 return ScriptValue(result); | 179 return ScriptValue(result, m_isolate); |
180 } | 180 } |
181 | 181 |
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) { |
(...skipping 60 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 |