diff options
Diffstat (limited to 'chrome')
5 files changed, 26 insertions, 9 deletions
diff --git a/chrome/browser/extensions/extension_bindings_apitest.cc b/chrome/browser/extensions/extension_bindings_apitest.cc new file mode 100644 index 0000000..8d5bf0a --- /dev/null +++ b/chrome/browser/extensions/extension_bindings_apitest.cc @@ -0,0 +1,13 @@ +// 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_; +} diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index d02e960..89b904d 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2498,6 +2498,7 @@ 'browser/extensions/extension_apitest.cc', 'browser/extensions/extension_apitest.h', 'browser/extensions/extension_apitest_apitest.cc', + 'browser/extensions/extension_bindings_apitest.cc', 'browser/extensions/extension_browsertest.cc', 'browser/extensions/extension_browsertest.h', 'browser/extensions/extension_browsertests_misc.cc', diff --git a/chrome/renderer/extensions/chrome_v8_context.cc b/chrome/renderer/extensions/chrome_v8_context.cc index 3e4a709..525c51e 100644 --- a/chrome/renderer/extensions/chrome_v8_context.cc +++ b/chrome/renderer/extensions/chrome_v8_context.cc @@ -83,7 +83,6 @@ bool ChromeV8Context::CallChromeHiddenMethod( v8::Handle<v8::Value>* argv, v8::Handle<v8::Value>* result) const { v8::Context::Scope context_scope(v8_context_); - v8::TryCatch try_catch; // Look up the function name, which may be a sub-property like // "Port.dispatchOnMessage" in the hidden global variable. @@ -97,10 +96,6 @@ bool ChromeV8Context::CallChromeHiddenMethod( if (!value.IsEmpty() && value->IsObject()) { value = v8::Local<v8::Object>::Cast(value)->Get( 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( v8::Handle<v8::Value> result_temp = 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) *result = result_temp; return true; diff --git a/chrome/test/data/extensions/api_test/bindings/exception_in_handler_should_not_crash/manifest.json b/chrome/test/data/extensions/api_test/bindings/exception_in_handler_should_not_crash/manifest.json new file mode 100644 index 0000000..a0f125e --- /dev/null +++ b/chrome/test/data/extensions/api_test/bindings/exception_in_handler_should_not_crash/manifest.json @@ -0,0 +1,4 @@ +{ + "name": "bug106201", + "version": "1" +} diff --git a/chrome/test/data/extensions/api_test/bindings/exception_in_handler_should_not_crash/page.html b/chrome/test/data/extensions/api_test/bindings/exception_in_handler_should_not_crash/page.html new file mode 100644 index 0000000..4377e75 --- /dev/null +++ b/chrome/test/data/extensions/api_test/bindings/exception_in_handler_should_not_crash/page.html @@ -0,0 +1,8 @@ +<script> +chrome.tabs.create({}, function() { + throw new Error("tada"); +}); +chrome.tabs.create({}, function() { + chrome.test.notifyPass(); +}); +</script> |