diff options
author | ager@chromium.org <ager@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-02 11:30:40 +0000 |
---|---|---|
committer | ager@chromium.org <ager@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-02 11:30:40 +0000 |
commit | edbdfe94b323561f16666496c78e975512938196 (patch) | |
tree | 13e18b1ddaaa6733c9752fafe4c9877d0dff2120 /webkit/port | |
parent | 42b4c09d80d9962c9b373b02ad00ec307732822b (diff) | |
download | chromium_src-edbdfe94b323561f16666496c78e975512938196.zip chromium_src-edbdfe94b323561f16666496c78e975512938196.tar.gz chromium_src-edbdfe94b323561f16666496c78e975512938196.tar.bz2 |
Isolate exceptions when evaluating javascript code from C++.
Evaluating a script that throws an uncaught exception should not
interfere with evaluating other code from C++ when the call to
evaluate returns.
I put indentical code in the V8Bridge a while ago and it seems to have
been lost in the unforking process.
BUG=4336
BUG=7773
BUG=8007
R=kasperl@chromium.org
Review URL: http://codereview.chromium.org/27326
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10697 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp index 20c6ccf..3ef9c9e 100644 --- a/webkit/port/bindings/v8/v8_proxy.cpp +++ b/webkit/port/bindings/v8/v8_proxy.cpp @@ -1372,7 +1372,15 @@ v8::Local<v8::Value> V8Proxy::Evaluate(const String& fileName, int baseLine, // and false for <script>doSomething</script>. For some reason, fileName // gives us this information. ChromiumBridge::traceEventBegin("v8.run", n, ""); - v8::Local<v8::Value> result = RunScript(script, fileName.isNull()); + v8::Local<v8::Value> result; + { + // Isolate exceptions that occur when executing the code. These + // exceptions should not interfere with javascript code we might + // evaluate from C++ when returning from here + v8::TryCatch try_catch; + try_catch.SetVerbose(true); + result = RunScript(script, fileName.isNull()); + } ChromiumBridge::traceEventEnd("v8.run", n, ""); return result; } |