| 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 14 matching lines...) Expand all Loading... |
| 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 */ | 31 */ |
| 32 | 32 |
| 33 #include "bindings/core/v8/ScriptController.h" | 33 #include "bindings/core/v8/ScriptController.h" |
| 34 | 34 |
| 35 #include "bindings/core/v8/ScriptModule.h" |
| 35 #include "bindings/core/v8/ScriptSourceCode.h" | 36 #include "bindings/core/v8/ScriptSourceCode.h" |
| 36 #include "bindings/core/v8/ScriptValue.h" | 37 #include "bindings/core/v8/ScriptValue.h" |
| 37 #include "bindings/core/v8/V8Binding.h" | 38 #include "bindings/core/v8/V8Binding.h" |
| 38 #include "bindings/core/v8/V8Event.h" | 39 #include "bindings/core/v8/V8Event.h" |
| 39 #include "bindings/core/v8/V8GCController.h" | 40 #include "bindings/core/v8/V8GCController.h" |
| 40 #include "bindings/core/v8/V8HTMLElement.h" | 41 #include "bindings/core/v8/V8HTMLElement.h" |
| 41 #include "bindings/core/v8/V8PerContextData.h" | 42 #include "bindings/core/v8/V8PerContextData.h" |
| 42 #include "bindings/core/v8/V8ScriptRunner.h" | 43 #include "bindings/core/v8/V8ScriptRunner.h" |
| 43 #include "bindings/core/v8/V8Window.h" | 44 #include "bindings/core/v8/V8Window.h" |
| 44 #include "bindings/core/v8/WindowProxy.h" | 45 #include "bindings/core/v8/WindowProxy.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 if (results) { | 435 if (results) { |
| 435 for (size_t i = 0; i < resultArray->Length(); ++i) { | 436 for (size_t i = 0; i < resultArray->Length(); ++i) { |
| 436 v8::Local<v8::Value> value; | 437 v8::Local<v8::Value> value; |
| 437 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) | 438 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) |
| 438 return; | 439 return; |
| 439 results->push_back(value); | 440 results->push_back(value); |
| 440 } | 441 } |
| 441 } | 442 } |
| 442 } | 443 } |
| 443 | 444 |
| 445 ScriptModule ScriptController::compileModule(const String& script, |
| 446 const String& urlStr) { |
| 447 v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate(); |
| 448 v8::HandleScope handleScope(isolate); |
| 449 |
| 450 ScriptState* scriptState = ScriptState::forMainWorld(frame()); |
| 451 if (!scriptState) { |
| 452 printf("Failed to get ScriptState forMainWorld\n"); |
| 453 return ScriptModule(); |
| 454 } |
| 455 |
| 456 ScriptState::Scope scope(scriptState); |
| 457 return ScriptModule::compile(isolate, script, urlStr); |
| 458 } |
| 459 |
| 444 } // namespace blink | 460 } // namespace blink |
| OLD | NEW |