Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1574)

Unified Diff: extensions/renderer/native_extension_bindings_system.cc

Issue 2819683002: [Extenisons Bindings] Don't throw unchecked errors; add console errors (Closed)
Patch Set: jbroman's Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/renderer/module_system.cc ('k') | extensions/renderer/object_backed_native_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/native_extension_bindings_system.cc
diff --git a/extensions/renderer/native_extension_bindings_system.cc b/extensions/renderer/native_extension_bindings_system.cc
index 9924a14e59e5d381e66c604b9b5ec04c55417973..3e84d281af8f2d984f6766736fb56e3c1ba8996a 100644
--- a/extensions/renderer/native_extension_bindings_system.cc
+++ b/extensions/renderer/native_extension_bindings_system.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
+#include "content/public/common/console_message_level.h"
#include "content/public/common/content_switches.h"
#include "extensions/common/constants.h"
#include "extensions/common/event_filtering_info.h"
@@ -16,6 +17,7 @@
#include "extensions/renderer/api_binding_hooks.h"
#include "extensions/renderer/api_binding_js_util.h"
#include "extensions/renderer/chrome_setting.h"
+#include "extensions/renderer/console.h"
#include "extensions/renderer/module_system.h"
#include "extensions/renderer/script_context.h"
#include "extensions/renderer/script_context_set.h"
@@ -164,6 +166,14 @@ v8::Global<v8::Value> CallJsFunctionSync(v8::Local<v8::Function> function,
return result;
}
+void AddConsoleError(v8::Local<v8::Context> context, const std::string& error) {
+ ScriptContext* script_context =
+ ScriptContextSet::GetContextByV8Context(context);
+ CHECK(script_context);
+ console::AddMessage(script_context, content::CONSOLE_MESSAGE_LEVEL_ERROR,
+ error);
+}
+
// Returns the API schema indicated by |api_name|.
const base::DictionaryValue& GetAPISchema(const std::string& api_name) {
const base::DictionaryValue* schema =
@@ -335,7 +345,7 @@ NativeExtensionBindingsSystem::NativeExtensionBindingsSystem(
base::Unretained(this)),
base::Bind(&NativeExtensionBindingsSystem::OnEventListenerChanged,
base::Unretained(this)),
- APILastError(base::Bind(&GetRuntime))),
+ APILastError(base::Bind(&GetRuntime), base::Bind(&AddConsoleError))),
weak_factory_(this) {
api_system_.RegisterCustomType("storage.StorageArea",
base::Bind(&StorageArea::CreateStorageArea));
« no previous file with comments | « extensions/renderer/module_system.cc ('k') | extensions/renderer/object_backed_native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698