Commit c80b8ee2 authored by aa@chromium.org's avatar aa@chromium.org

Silently swallow exceptions in extension bindings callbacks.

There are better ways to handle this, but I want a really
simple patch for merge.

BUG=106201
TEST=http://code.google.com/p/chromium/issues/detail?id=100401#c18

Review URL: http://codereview.chromium.org/8786008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112869 0039d316-1c4b-4281-b951-d872f2087c98
parent fd4f2300
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Contains holistic tests of the bindings infrastructure
#include "chrome/browser/extensions/extension_apitest.h"
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ExceptionInHandlerShouldNotCrash) {
ASSERT_TRUE(RunExtensionSubtest(
"bindings/exception_in_handler_should_not_crash",
"page.html")) << message_;
}
...@@ -2498,6 +2498,7 @@ ...@@ -2498,6 +2498,7 @@
'browser/extensions/extension_apitest.cc', 'browser/extensions/extension_apitest.cc',
'browser/extensions/extension_apitest.h', 'browser/extensions/extension_apitest.h',
'browser/extensions/extension_apitest_apitest.cc', 'browser/extensions/extension_apitest_apitest.cc',
'browser/extensions/extension_bindings_apitest.cc',
'browser/extensions/extension_browsertest.cc', 'browser/extensions/extension_browsertest.cc',
'browser/extensions/extension_browsertest.h', 'browser/extensions/extension_browsertest.h',
'browser/extensions/extension_browsertests_misc.cc', 'browser/extensions/extension_browsertests_misc.cc',
......
...@@ -83,7 +83,6 @@ bool ChromeV8Context::CallChromeHiddenMethod( ...@@ -83,7 +83,6 @@ bool ChromeV8Context::CallChromeHiddenMethod(
v8::Handle<v8::Value>* argv, v8::Handle<v8::Value>* argv,
v8::Handle<v8::Value>* result) const { v8::Handle<v8::Value>* result) const {
v8::Context::Scope context_scope(v8_context_); v8::Context::Scope context_scope(v8_context_);
v8::TryCatch try_catch;
// Look up the function name, which may be a sub-property like // Look up the function name, which may be a sub-property like
// "Port.dispatchOnMessage" in the hidden global variable. // "Port.dispatchOnMessage" in the hidden global variable.
...@@ -97,10 +96,6 @@ bool ChromeV8Context::CallChromeHiddenMethod( ...@@ -97,10 +96,6 @@ bool ChromeV8Context::CallChromeHiddenMethod(
if (!value.IsEmpty() && value->IsObject()) { if (!value.IsEmpty() && value->IsObject()) {
value = v8::Local<v8::Object>::Cast(value)->Get( value = v8::Local<v8::Object>::Cast(value)->Get(
v8::String::New(components[i].c_str())); v8::String::New(components[i].c_str()));
if (try_catch.HasCaught()) {
NOTREACHED() << *v8::String::AsciiValue(try_catch.Exception());
return false;
}
} }
} }
...@@ -111,10 +106,6 @@ bool ChromeV8Context::CallChromeHiddenMethod( ...@@ -111,10 +106,6 @@ bool ChromeV8Context::CallChromeHiddenMethod(
v8::Handle<v8::Value> result_temp = v8::Handle<v8::Value> result_temp =
v8::Local<v8::Function>::Cast(value)->Call(v8::Object::New(), argc, argv); v8::Local<v8::Function>::Cast(value)->Call(v8::Object::New(), argc, argv);
if (try_catch.HasCaught()) {
NOTREACHED() << *v8::String::AsciiValue(try_catch.Exception());
return false;
}
if (result) if (result)
*result = result_temp; *result = result_temp;
return true; return true;
......
<script>
chrome.tabs.create({}, function() {
throw new Error("tada");
});
chrome.tabs.create({}, function() {
chrome.test.notifyPass();
});
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment