OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "bindings/core/v8/PrivateScriptRunner.h" | 6 #include "bindings/core/v8/PrivateScriptRunner.h" |
7 | 7 |
8 #include "bindings/core/v8/DOMWrapperWorld.h" | 8 #include "bindings/core/v8/DOMWrapperWorld.h" |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 v8::Handle<v8::Object> global = isolate->GetCurrentContext()->Global(); | 52 v8::Handle<v8::Object> global = isolate->GetCurrentContext()->Global(); |
53 v8::Handle<v8::Value> privateScriptController = global->Get(v8String(isolate
, "privateScriptController")); | 53 v8::Handle<v8::Value> privateScriptController = global->Get(v8String(isolate
, "privateScriptController")); |
54 RELEASE_ASSERT(privateScriptController->IsUndefined() || privateScriptContro
ller->IsObject()); | 54 RELEASE_ASSERT(privateScriptController->IsUndefined() || privateScriptContro
ller->IsObject()); |
55 if (privateScriptController->IsObject()) { | 55 if (privateScriptController->IsObject()) { |
56 v8::Handle<v8::Object> privateScriptControllerObject = privateScriptCont
roller->ToObject(isolate); | 56 v8::Handle<v8::Object> privateScriptControllerObject = privateScriptCont
roller->ToObject(isolate); |
57 v8::Handle<v8::Value> importFunctionValue = privateScriptControllerObjec
t->Get(v8String(isolate, "import")); | 57 v8::Handle<v8::Value> importFunctionValue = privateScriptControllerObjec
t->Get(v8String(isolate, "import")); |
58 if (importFunctionValue->IsUndefined()) | 58 if (importFunctionValue->IsUndefined()) |
59 privateScriptControllerObject->Set(v8String(isolate, "import"), v8::
FunctionTemplate::New(isolate, importFunction)->GetFunction()); | 59 privateScriptControllerObject->Set(v8String(isolate, "import"), v8::
FunctionTemplate::New(isolate, importFunction)->GetFunction()); |
60 } | 60 } |
61 | 61 |
62 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(v8String(isola
te, sourceString), fileName, TextPosition::minimumPosition(), 0, 0, isolate, Not
SharableCrossOrigin); | 62 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(v8String(isola
te, sourceString), fileName, TextPosition::minimumPosition(), isolate, nullptr,
nullptr, nullptr, NotSharableCrossOrigin); |
63 if (block.HasCaught()) { | 63 if (block.HasCaught()) { |
64 fprintf(stderr, "Private script error: Compile failed. (Class name = %s)
\n", scriptClassName.utf8().data()); | 64 fprintf(stderr, "Private script error: Compile failed. (Class name = %s)
\n", scriptClassName.utf8().data()); |
65 dumpV8Message(block.Message()); | 65 dumpV8Message(block.Message()); |
66 RELEASE_ASSERT_NOT_REACHED(); | 66 RELEASE_ASSERT_NOT_REACHED(); |
67 } | 67 } |
68 | 68 |
69 v8::Handle<v8::Value> result = V8ScriptRunner::runCompiledInternalScript(iso
late, script); | 69 v8::Handle<v8::Value> result = V8ScriptRunner::runCompiledInternalScript(iso
late, script); |
70 if (block.HasCaught()) { | 70 if (block.HasCaught()) { |
71 fprintf(stderr, "Private script error: installClass() failed. (Class nam
e = %s)\n", scriptClassName.utf8().data()); | 71 fprintf(stderr, "Private script error: installClass() failed. (Class nam
e = %s)\n", scriptClassName.utf8().data()); |
72 dumpV8Message(block.Message()); | 72 dumpV8Message(block.Message()); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 v8::Handle<v8::Value> result = V8ScriptRunner::callFunction(v8::Handle<v8::F
unction>::Cast(method), scriptState->executionContext(), holder, argc, argv, scr
iptState->isolate()); | 328 v8::Handle<v8::Value> result = V8ScriptRunner::callFunction(v8::Handle<v8::F
unction>::Cast(method), scriptState->executionContext(), holder, argc, argv, scr
iptState->isolate()); |
329 if (block.HasCaught()) { | 329 if (block.HasCaught()) { |
330 rethrowExceptionInPrivateScript(scriptState->isolate(), block, scriptSta
teInUserScript, ExceptionState::ExecutionContext, methodName, className); | 330 rethrowExceptionInPrivateScript(scriptState->isolate(), block, scriptSta
teInUserScript, ExceptionState::ExecutionContext, methodName, className); |
331 block.ReThrow(); | 331 block.ReThrow(); |
332 return v8::Handle<v8::Value>(); | 332 return v8::Handle<v8::Value>(); |
333 } | 333 } |
334 return result; | 334 return result; |
335 } | 335 } |
336 | 336 |
337 } // namespace blink | 337 } // namespace blink |
OLD | NEW |