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

Unified Diff: chrome/browser/extensions/extension_host.cc

Issue 23007021: Report Javascript Runtime Errors to the Error Console (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dc_ec_feldman
Patch Set: Created 7 years, 4 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 | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/extensions/tab_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_host.cc
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index d7cd52829ab2171c9ea3e3db3d92d946e0fbc095..bd439288bb516a74e933d5a50b9d3a7bd87ca7eb 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -7,6 +7,7 @@
#include <list>
#include "base/bind.h"
+#include "base/logging.h"
#include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
@@ -15,6 +16,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/extensions/error_console/error_console.h"
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -48,7 +50,9 @@
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
+#include "extensions/browser/extension_error.h"
#include "extensions/browser/view_type_utils.h"
+#include "extensions/common/extension_urls.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -539,6 +543,8 @@ bool ExtensionHost::OnMessageReceived(const IPC::Message& message) {
OnIncrementLazyKeepaliveCount)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_DecrementLazyKeepaliveCount,
OnDecrementLazyKeepaliveCount)
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DetailedConsoleMessageAdded,
+ OnDetailedConsoleMessageAdded)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -568,6 +574,25 @@ void ExtensionHost::OnDecrementLazyKeepaliveCount() {
pm->DecrementLazyKeepaliveCount(extension());
}
+void ExtensionHost::OnDetailedConsoleMessageAdded(
+ const base::string16& message,
+ const base::string16& source,
+ const StackTrace& stack_trace,
+ int32 severity_level) {
+ if (IsSourceFromAnExtension(source)) {
+ ErrorConsole::Get(profile_)->ReportError(
+ scoped_ptr<ExtensionError>(new RuntimeError(
+ profile_->IsOffTheRecord(),
+ source,
+ message,
+ stack_trace,
+ associated_web_contents_ ?
+ associated_web_contents_->GetLastCommittedURL() :
+ GURL::EmptyGURL(),
+ static_cast<logging::LogSeverity>(severity_level))));
+ }
+}
+
void ExtensionHost::UnhandledKeyboardEvent(
WebContents* source,
const content::NativeWebKeyboardEvent& event) {
« no previous file with comments | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/extensions/tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698