From edbdfe94b323561f16666496c78e975512938196 Mon Sep 17 00:00:00 2001 From: "ager@chromium.org" Date: Mon, 2 Mar 2009 11:30:40 +0000 Subject: 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 --- webkit/port/bindings/v8/v8_proxy.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'webkit/port') 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 V8Proxy::Evaluate(const String& fileName, int baseLine, // and false for . For some reason, fileName // gives us this information. ChromiumBridge::traceEventBegin("v8.run", n, ""); - v8::Local result = RunScript(script, fileName.isNull()); + v8::Local 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; } -- cgit v1.1