diff options
author | ager@google.com <ager@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-21 12:19:51 +0000 |
---|---|---|
committer | ager@google.com <ager@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-21 12:19:51 +0000 |
commit | bcc682fc4f5050ac911635ab649fbd30002fc2b4 (patch) | |
tree | 1693fd0dad17aae8b046e0ed04461c11dcb3b370 /webkit/port | |
parent | 8e4e18052ac86ebc929048f0f6b2aeb750620320 (diff) | |
download | chromium_src-bcc682fc4f5050ac911635ab649fbd30002fc2b4.zip chromium_src-bcc682fc4f5050ac911635ab649fbd30002fc2b4.tar.gz chromium_src-bcc682fc4f5050ac911635ab649fbd30002fc2b4.tar.bz2 |
Make sure that javascript exceptions thrown while evaluating the code
in script blocks and while evaluating code in a javascript URL are
isolated. Before this change, an exception thrown while evaluating
the code from a script block could propagate into unrelated event
code.
BUG=1334013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1152 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-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; |