diff options
author | rdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-01 00:36:01 +0000 |
---|---|---|
committer | rdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-01 00:36:01 +0000 |
commit | c934c3813489dab3f349210de396198c6f6ae99a (patch) | |
tree | b1b3443012c807ef70347778ba83429094de102a /extensions | |
parent | 2a82cd4eeda3e5bdfe2cfab495ddd98f71249b6e (diff) | |
download | chromium_src-c934c3813489dab3f349210de396198c6f6ae99a.zip chromium_src-c934c3813489dab3f349210de396198c6f6ae99a.tar.gz chromium_src-c934c3813489dab3f349210de396198c6f6ae99a.tar.bz2 |
Add 'Inspect' Links for views in the Extension Error Console
Add the option to inspect a resource or render view in the error console,
opening the developer tools for that resource/view.
Goes with: https://codereview.chromium.org/23816005
BUG=21734
TBR=yoshiki@chromium.org (task_manager)
TBR=ben@chromium.org (ui [refactor only])
Review URL: https://codereview.chromium.org/23459008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232246 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/browser/extension_error.cc | 14 | ||||
-rw-r--r-- | extensions/browser/extension_error.h | 13 |
2 files changed, 23 insertions, 4 deletions
diff --git a/extensions/browser/extension_error.cc b/extensions/browser/extension_error.cc index 071dbc2..ee6b47e 100644 --- a/extensions/browser/extension_error.cc +++ b/extensions/browser/extension_error.cc @@ -130,6 +130,8 @@ const char RuntimeError::kFunctionNameKey[] = "functionName"; const char RuntimeError::kLineNumberKey[] = "lineNumber"; const char RuntimeError::kStackTraceKey[] = "stackTrace"; const char RuntimeError::kUrlKey[] = "url"; +const char RuntimeError::kRenderProcessIdKey[] = "renderProcessId"; +const char RuntimeError::kRenderViewIdKey[] = "renderViewId"; RuntimeError::RuntimeError(const std::string& extension_id, bool from_incognito, @@ -137,7 +139,9 @@ RuntimeError::RuntimeError(const std::string& extension_id, const string16& message, const StackTrace& stack_trace, const GURL& context_url, - logging::LogSeverity level) + logging::LogSeverity level, + int render_view_id, + int render_process_id) : ExtensionError(ExtensionError::RUNTIME_ERROR, !extension_id.empty() ? extension_id : GURL(source).host(), from_incognito, @@ -145,7 +149,9 @@ RuntimeError::RuntimeError(const std::string& extension_id, source, message), context_url_(context_url), - stack_trace_(stack_trace) { + stack_trace_(stack_trace), + render_view_id_(render_view_id), + render_process_id_(render_process_id) { CleanUpInit(); } @@ -155,8 +161,10 @@ RuntimeError::~RuntimeError() { scoped_ptr<DictionaryValue> RuntimeError::ToValue() const { scoped_ptr<DictionaryValue> value = ExtensionError::ToValue(); value->SetString(kContextUrlKey, context_url_.spec()); + value->SetInteger(kRenderViewIdKey, render_view_id_); + value->SetInteger(kRenderProcessIdKey, render_process_id_); - ListValue* trace_value = new ListValue; + base::ListValue* trace_value = new base::ListValue; for (StackTrace::const_iterator iter = stack_trace_.begin(); iter != stack_trace_.end(); ++iter) { DictionaryValue* frame_value = new DictionaryValue; diff --git a/extensions/browser/extension_error.h b/extensions/browser/extension_error.h index 60e3b90..e905549 100644 --- a/extensions/browser/extension_error.h +++ b/extensions/browser/extension_error.h @@ -126,7 +126,9 @@ class RuntimeError : public ExtensionError { const base::string16& message, const StackTrace& stack_trace, const GURL& context_url, - logging::LogSeverity level); + logging::LogSeverity level, + int render_view_id, + int render_process_id); virtual ~RuntimeError(); virtual scoped_ptr<base::DictionaryValue> ToValue() const OVERRIDE; @@ -135,6 +137,8 @@ class RuntimeError : public ExtensionError { const GURL& context_url() const { return context_url_; } const StackTrace& stack_trace() const { return stack_trace_; } + int render_view_id() const { return render_view_id_; } + int render_process_id() const { return render_process_id_; } // Keys used for retrieving JSON values. static const char kColumnNumberKey[]; @@ -143,6 +147,8 @@ class RuntimeError : public ExtensionError { static const char kLineNumberKey[]; static const char kStackTraceKey[]; static const char kUrlKey[]; + static const char kRenderProcessIdKey[]; + static const char kRenderViewIdKey[]; private: virtual bool IsEqualImpl(const ExtensionError* rhs) const OVERRIDE; @@ -155,6 +161,11 @@ class RuntimeError : public ExtensionError { GURL context_url_; StackTrace stack_trace_; + // Keep track of the render process which caused the error in order to + // inspect the view later, if possible. + int render_view_id_; + int render_process_id_; + DISALLOW_COPY_AND_ASSIGN(RuntimeError); }; |