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

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
Index: chrome/browser/extensions/extension_host.cc
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 7388727c046ae64fe26258ecb2618520be1f00e3..432a8ee3f3191a587bf2d6023876f0fe15d085db 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -15,6 +15,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"
@@ -47,7 +48,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/constants.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -423,6 +426,26 @@ void ExtensionHost::DocumentAvailableInMainFrame() {
}
}
+void ExtensionHost::OnMessageAddedToConsole(const base::string16& source,
+ const base::string16& message,
+ const base::string16& stack_trace,
+ int32 line_number,
+ logging::LogSeverity level) {
+ if (IsSourceFromAnExtension(source)) {
Yoyo Zhou 2013/08/23 22:54:54 Do we still want this test here? I'm thinking abou
Devlin 2013/08/23 23:44:30 While that's true, the bigger problem is that they
Yoyo Zhou 2013/08/23 23:55:04 Ok. I was thinking we'd only get extension errors
+ ErrorConsole::Get(profile_)->ReportError(
+ scoped_ptr<const ExtensionError>(new JavascriptRuntimeError(
+ profile_->IsOffTheRecord(),
+ source,
+ message,
+ stack_trace,
+ line_number,
+ associated_web_contents_ ?
+ associated_web_contents_->GetLastCommittedURL() :
+ GURL::EmptyGURL(),
+ level)));
+ }
+}
+
void ExtensionHost::CloseContents(WebContents* contents) {
// TODO(mpcomplete): is this check really necessary?
if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP ||

Powered by Google App Engine
This is Rietveld 408576698