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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js

Issue 2139543002: [DevTools] Report console API calls through Runtime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 5 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: third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
index bf764a52096169df731f5bea8c61e9ae39a9b900..ba2ab8420ccbb2501dcbce5259aa6907508bfc44 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
@@ -412,6 +412,49 @@ WebInspector.RuntimeDispatcher.prototype = {
/**
* @override
+ * @param {string} type
+ * @param {!Array.<!RuntimeAgent.RemoteObject>} args
+ * @param {number} executionContextId
+ * @param {number} timestamp
+ * @param {!RuntimeAgent.StackTrace=} stackTrace
+ */
+ consoleAPICalled: function(type, args, executionContextId, timestamp, stackTrace)
+ {
+ var level = WebInspector.ConsoleMessage.MessageLevel.Log;
+ if (type === WebInspector.ConsoleMessage.MessageType.Debug)
+ level = WebInspector.ConsoleMessage.MessageLevel.Debug;
+ if (type === WebInspector.ConsoleMessage.MessageType.Error || type === WebInspector.ConsoleMessage.MessageType.Assert)
+ level = WebInspector.ConsoleMessage.MessageLevel.Error;
+ if (type === WebInspector.ConsoleMessage.MessageType.Warning)
+ level = WebInspector.ConsoleMessage.MessageLevel.Warning;
+ if (type === WebInspector.ConsoleMessage.MessageType.Info)
+ level = WebInspector.ConsoleMessage.MessageLevel.Info;
+ var message = "";
+ if (args.length && typeof args[0].value === "string")
+ message = args[0].value;
+ else if (args.length && args[0].description)
+ message = args[0].description;
+ var callFrame = stackTrace && stackTrace.callFrames.length ? stackTrace.callFrames[0] : null;
+ var consoleMessage = new WebInspector.ConsoleMessage(
+ this._runtimeModel.target(),
+ WebInspector.ConsoleMessage.MessageSource.ConsoleAPI,
+ level,
+ /** @type {string} */ (message),
+ type,
+ callFrame ? callFrame.url : undefined,
+ callFrame ? callFrame.lineNumber + 1 : undefined,
+ callFrame ? callFrame.columnNumber + 1 : undefined,
+ undefined,
+ args,
+ stackTrace,
+ timestamp,
+ executionContextId,
+ undefined);
+ this._runtimeModel.target().consoleModel.addMessage(consoleMessage);
+ },
+
+ /**
+ * @override
* @param {!RuntimeAgent.RemoteObject} payload
* @param {!Object=} hints
*/

Powered by Google App Engine
This is Rietveld 408576698