| 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 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
| 8 * met: | 8 * met: |
| 9 * | 9 * |
| 10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 if (object.IsEmpty()) | 624 if (object.IsEmpty()) |
| 625 return v8::Local<v8::Value>(); | 625 return v8::Local<v8::Value>(); |
| 626 | 626 |
| 627 return handleScope.Escape(object); | 627 return handleScope.Escape(object); |
| 628 } | 628 } |
| 629 | 629 |
| 630 void ScriptController::executeScriptInIsolatedWorld(int worldID, const Vector<Sc
riptSourceCode>& sources, int extensionGroup, Vector<v8::Local<v8::Value> >* res
ults) | 630 void ScriptController::executeScriptInIsolatedWorld(int worldID, const Vector<Sc
riptSourceCode>& sources, int extensionGroup, Vector<v8::Local<v8::Value> >* res
ults) |
| 631 { | 631 { |
| 632 ASSERT(worldID > 0); | 632 ASSERT(worldID > 0); |
| 633 | 633 |
| 634 RefPtr<DOMWrapperWorld> world = DOMWrapperWorld::ensureIsolatedWorld(worldID
, extensionGroup); | 634 RefPtr<DOMWrapperWorld> world = DOMWrapperWorld::ensureIsolatedWorld(m_isola
te, worldID, extensionGroup); |
| 635 WindowProxy* isolatedWorldWindowProxy = windowProxy(*world); | 635 WindowProxy* isolatedWorldWindowProxy = windowProxy(*world); |
| 636 if (!isolatedWorldWindowProxy->isContextInitialized()) | 636 if (!isolatedWorldWindowProxy->isContextInitialized()) |
| 637 return; | 637 return; |
| 638 | 638 |
| 639 ScriptState* scriptState = isolatedWorldWindowProxy->scriptState(); | 639 ScriptState* scriptState = isolatedWorldWindowProxy->scriptState(); |
| 640 v8::EscapableHandleScope handleScope(scriptState->isolate()); | 640 v8::EscapableHandleScope handleScope(scriptState->isolate()); |
| 641 ScriptState::Scope scope(scriptState); | 641 ScriptState::Scope scope(scriptState); |
| 642 v8::Local<v8::Array> resultArray = v8::Array::New(m_isolate, sources.size())
; | 642 v8::Local<v8::Array> resultArray = v8::Array::New(m_isolate, sources.size())
; |
| 643 | 643 |
| 644 for (size_t i = 0; i < sources.size(); ++i) { | 644 for (size_t i = 0; i < sources.size(); ++i) { |
| 645 v8::Local<v8::Value> evaluationResult = executeScriptAndReturnValue(scri
ptState->context(), sources[i]); | 645 v8::Local<v8::Value> evaluationResult = executeScriptAndReturnValue(scri
ptState->context(), sources[i]); |
| 646 if (evaluationResult.IsEmpty()) | 646 if (evaluationResult.IsEmpty()) |
| 647 evaluationResult = v8::Local<v8::Value>::New(m_isolate, v8::Undefine
d(m_isolate)); | 647 evaluationResult = v8::Local<v8::Value>::New(m_isolate, v8::Undefine
d(m_isolate)); |
| 648 resultArray->Set(i, evaluationResult); | 648 resultArray->Set(i, evaluationResult); |
| 649 } | 649 } |
| 650 | 650 |
| 651 if (results) { | 651 if (results) { |
| 652 for (size_t i = 0; i < resultArray->Length(); ++i) | 652 for (size_t i = 0; i < resultArray->Length(); ++i) |
| 653 results->append(handleScope.Escape(resultArray->Get(i))); | 653 results->append(handleScope.Escape(resultArray->Get(i))); |
| 654 } | 654 } |
| 655 } | 655 } |
| 656 | 656 |
| 657 } // namespace blink | 657 } // namespace blink |
| OLD | NEW |