diff options
-rw-r--r-- | webkit/port/bridge/JSBridge.h | 4 | ||||
-rw-r--r-- | webkit/port/bridge/KJSBridge.cpp | 4 | ||||
-rw-r--r-- | webkit/port/bridge/V8Bridge.cpp | 14 |
3 files changed, 18 insertions, 4 deletions
diff --git a/webkit/port/bridge/JSBridge.h b/webkit/port/bridge/JSBridge.h index d6e6090..878ef38 100644 --- a/webkit/port/bridge/JSBridge.h +++ b/webkit/port/bridge/JSBridge.h @@ -161,7 +161,9 @@ class JSBridge { virtual bool wasRunByUserGesture() = 0; - // Evaluate a script file in the environment of this proxy. + // Evaluate a script file in the environment of this proxy. Used for + // evaluating the code in script tags and for evaluating the code from + // javascript URLs. // If succeeded, 'succ' is set to true and result is returned // as a string. virtual String evaluate(const String& filename, int baseLine, diff --git a/webkit/port/bridge/KJSBridge.cpp b/webkit/port/bridge/KJSBridge.cpp index 4786b6c..ecbb19c 100644 --- a/webkit/port/bridge/KJSBridge.cpp +++ b/webkit/port/bridge/KJSBridge.cpp @@ -130,7 +130,9 @@ bool KJSBridge::wasRunByUserGesture() { } -// Evaluate a script file in the environment of this proxy. +// Evaluate a script file in the environment of this proxy. Used for +// evaluating the code in script tags and for evaluating the code from +// javascript URLs. String KJSBridge::evaluate(const String& filename, int baseLine, const String& code, Node* node, bool* succ) { *succ = false; diff --git a/webkit/port/bridge/V8Bridge.cpp b/webkit/port/bridge/V8Bridge.cpp index 4a32ec8..a3a51ae 100644 --- a/webkit/port/bridge/V8Bridge.cpp +++ b/webkit/port/bridge/V8Bridge.cpp @@ -204,7 +204,9 @@ bool V8Bridge::wasRunByUserGesture() { } -// Evaluate a script file in the environment of this proxy. +// Evaluate a script file in the environment of this proxy. Used for +// evaluating the code in script tags and for evaluating the code from +// javascript URLs. String V8Bridge::evaluate(const String& filename, int baseLine, const String& code, Node* node, bool* succ) { *succ = false; @@ -217,7 +219,15 @@ String V8Bridge::evaluate(const String& filename, int baseLine, v8::Context::Scope scope(context); - v8::Local<v8::Value> obj = m_proxy->Evaluate(filename, baseLine, code, node); + v8::Local<v8::Value> obj; + { + // 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 exception_block; + exception_block.SetVerbose(true); + obj = m_proxy->Evaluate(filename, baseLine, code, node); + } if (obj.IsEmpty() || obj->IsUndefined()) return result; |