| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 v8::Handle<v8::Context> context = v8::Context::GetEntered(); | 318 v8::Handle<v8::Context> context = v8::Context::GetEntered(); |
| 319 DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::isolatedWorld(context); | 319 DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::isolatedWorld(context); |
| 320 if (!isolatedWorld) | 320 if (!isolatedWorld) |
| 321 return contextForWorld(this, mainThreadNormalWorld()); | 321 return contextForWorld(this, mainThreadNormalWorld()); |
| 322 | 322 |
| 323 Frame* frame = toFrameIfNotDetached(context); | 323 Frame* frame = toFrameIfNotDetached(context); |
| 324 if (!m_frame) | 324 if (!m_frame) |
| 325 return v8::Local<v8::Context>(); | 325 return v8::Local<v8::Context>(); |
| 326 | 326 |
| 327 if (m_frame == frame) | 327 if (m_frame == frame) |
| 328 return v8::Local<v8::Context>::New(context); | 328 return v8::Local<v8::Context>::New(m_isolate, context); |
| 329 | 329 |
| 330 return contextForWorld(this, isolatedWorld); | 330 return contextForWorld(this, isolatedWorld); |
| 331 } | 331 } |
| 332 | 332 |
| 333 v8::Local<v8::Context> ScriptController::mainWorldContext() | 333 v8::Local<v8::Context> ScriptController::mainWorldContext() |
| 334 { | 334 { |
| 335 return contextForWorld(this, mainThreadNormalWorld()); | 335 return contextForWorld(this, mainThreadNormalWorld()); |
| 336 } | 336 } |
| 337 | 337 |
| 338 v8::Local<v8::Context> ScriptController::mainWorldContext(Frame* frame) | 338 v8::Local<v8::Context> ScriptController::mainWorldContext(Frame* frame) |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 if (!isolatedWorldShell->isContextInitialized()) | 700 if (!isolatedWorldShell->isContextInitialized()) |
| 701 return; | 701 return; |
| 702 | 702 |
| 703 v8::Local<v8::Context> context = isolatedWorldShell->context(); | 703 v8::Local<v8::Context> context = isolatedWorldShell->context(); |
| 704 v8::Context::Scope contextScope(context); | 704 v8::Context::Scope contextScope(context); |
| 705 v8::Local<v8::Array> resultArray = v8::Array::New(sources.size()); | 705 v8::Local<v8::Array> resultArray = v8::Array::New(sources.size()); |
| 706 | 706 |
| 707 for (size_t i = 0; i < sources.size(); ++i) { | 707 for (size_t i = 0; i < sources.size(); ++i) { |
| 708 v8::Local<v8::Value> evaluationResult = compileAndRunScript(sources[
i]); | 708 v8::Local<v8::Value> evaluationResult = compileAndRunScript(sources[
i]); |
| 709 if (evaluationResult.IsEmpty()) | 709 if (evaluationResult.IsEmpty()) |
| 710 evaluationResult = v8::Local<v8::Value>::New(v8::Undefined()); | 710 evaluationResult = v8::Local<v8::Value>::New(m_isolate, v8::Unde
fined(m_isolate)); |
| 711 resultArray->Set(i, evaluationResult); | 711 resultArray->Set(i, evaluationResult); |
| 712 } | 712 } |
| 713 | 713 |
| 714 v8Results = evaluateHandleScope.Close(resultArray); | 714 v8Results = evaluateHandleScope.Close(resultArray); |
| 715 } | 715 } |
| 716 | 716 |
| 717 if (results && !v8Results.IsEmpty()) { | 717 if (results && !v8Results.IsEmpty()) { |
| 718 for (size_t i = 0; i < v8Results->Length(); ++i) | 718 for (size_t i = 0; i < v8Results->Length(); ++i) |
| 719 results->append(ScriptValue(v8Results->Get(i))); | 719 results->append(ScriptValue(v8Results->Get(i))); |
| 720 } | 720 } |
| 721 } | 721 } |
| 722 | 722 |
| 723 } // namespace WebCore | 723 } // namespace WebCore |
| OLD | NEW |