Chromium Code Reviews| Index: Source/bindings/v8/V8ScriptRunner.cpp |
| diff --git a/Source/bindings/v8/V8ScriptRunner.cpp b/Source/bindings/v8/V8ScriptRunner.cpp |
| index c4ddf18073efa8e4b7a8f09c38325c19449bc3a1..dde773e7bb184467e4d48aca2765bdd9d2d907c5 100644 |
| --- a/Source/bindings/v8/V8ScriptRunner.cpp |
| +++ b/Source/bindings/v8/V8ScriptRunner.cpp |
| @@ -26,6 +26,7 @@ |
| #include "config.h" |
| #include "bindings/v8/V8ScriptRunner.h" |
| +#include "bindings/v8/ScopedPersistent.h" |
|
abarth-chromium
2013/05/20 04:23:36
This include probably isn't needed anymore.
|
| #include "bindings/v8/V8Binding.h" |
| #include "bindings/v8/V8GCController.h" |
| #include "bindings/v8/V8RecursionScope.h" |
| @@ -62,4 +63,25 @@ v8::Local<v8::Value> V8ScriptRunner::runCompiledScript(v8::Handle<v8::Script> sc |
| return result; |
| } |
| +v8::Local<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Handle<v8::String> source, v8::Isolate* isolate) |
| +{ |
| + v8::Local<v8::Context> context = v8::Context::New(isolate); |
| + if (context.IsEmpty()) |
| + return result; |
| + v8::Local<v8::Value> result; |
|
abarth-chromium
2013/05/20 04:23:21
I think you'll need to move this line up a bit in
|
| + { |
| + v8::Context::Scope scope(context.get()); |
| + v8::TryCatch tryCatch; |
| + v8::Handle<v8::Script> script = v8::Script::Compile(source); |
| + if (script.IsEmpty() || tryCatch.HasCaught()) |
| + return result; |
| + |
| + V8RecursionScope::MicrotaskSuppression recursionScope; |
| + result = script->Run(); |
| + if (tryCatch.HasCaught()) |
| + return result; |
| + } |
| + return result; |
| +} |
| + |
| } // namespace WebCore |