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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 v8::TryCatch block; | 46 v8::TryCatch block; |
47 String sourceString(source, size); | 47 String sourceString(source, size); |
48 String fileName = scriptClassName + ".js"; | 48 String fileName = scriptClassName + ".js"; |
49 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(v8String(isola
te, sourceString), fileName, TextPosition::minimumPosition(), 0, 0, isolate, Not
SharableCrossOrigin, V8CacheOptionsOff); | 49 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(v8String(isola
te, sourceString), fileName, TextPosition::minimumPosition(), 0, 0, isolate, Not
SharableCrossOrigin, V8CacheOptionsOff); |
50 if (block.HasCaught()) { | 50 if (block.HasCaught()) { |
51 fprintf(stderr, "Private script error: Compile failed. (Class name = %s)
\n", scriptClassName.utf8().data()); | 51 fprintf(stderr, "Private script error: Compile failed. (Class name = %s)
\n", scriptClassName.utf8().data()); |
52 dumpV8Message(block.Message()); | 52 dumpV8Message(block.Message()); |
53 RELEASE_ASSERT_NOT_REACHED(); | 53 RELEASE_ASSERT_NOT_REACHED(); |
54 } | 54 } |
55 | 55 |
56 v8::Handle<v8::Value> result = V8ScriptRunner::runCompiledInternalScript(scr
ipt, isolate); | 56 v8::Handle<v8::Value> result = V8ScriptRunner::runCompiledInternalScript(iso
late, script); |
57 if (block.HasCaught()) { | 57 if (block.HasCaught()) { |
58 fprintf(stderr, "Private script error: installClass() failed. (Class nam
e = %s)\n", scriptClassName.utf8().data()); | 58 fprintf(stderr, "Private script error: installClass() failed. (Class nam
e = %s)\n", scriptClassName.utf8().data()); |
59 dumpV8Message(block.Message()); | 59 dumpV8Message(block.Message()); |
60 RELEASE_ASSERT_NOT_REACHED(); | 60 RELEASE_ASSERT_NOT_REACHED(); |
61 } | 61 } |
62 return result; | 62 return result; |
63 } | 63 } |
64 | 64 |
65 // FIXME: If we have X.js, XPartial-1.js and XPartial-2.js, currently all of the
JS files | 65 // FIXME: If we have X.js, XPartial-1.js and XPartial-2.js, currently all of the
JS files |
66 // are compiled when any of the JS files is requested. Ideally we should avoid c
ompiling | 66 // are compiled when any of the JS files is requested. Ideally we should avoid c
ompiling |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 v8::Handle<v8::Value> result = V8ScriptRunner::callFunction(v8::Handle<v8::F
unction>::Cast(method), scriptState->executionContext(), holder, argc, argv, scr
iptState->isolate()); | 294 v8::Handle<v8::Value> result = V8ScriptRunner::callFunction(v8::Handle<v8::F
unction>::Cast(method), scriptState->executionContext(), holder, argc, argv, scr
iptState->isolate()); |
295 if (block.HasCaught()) { | 295 if (block.HasCaught()) { |
296 rethrowExceptionInPrivateScript(scriptState->isolate(), block, scriptSta
teInUserScript, ExceptionState::ExecutionContext, methodName, className); | 296 rethrowExceptionInPrivateScript(scriptState->isolate(), block, scriptSta
teInUserScript, ExceptionState::ExecutionContext, methodName, className); |
297 block.ReThrow(); | 297 block.ReThrow(); |
298 return v8::Handle<v8::Value>(); | 298 return v8::Handle<v8::Value>(); |
299 } | 299 } |
300 return result; | 300 return result; |
301 } | 301 } |
302 | 302 |
303 } // namespace blink | 303 } // namespace blink |
OLD | NEW |