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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js

Issue 1666563005: DevTools: merge ScriptCallStack and ScriptAsyncCallStack, move CallStacks from console to Runtime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: testts Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 this._messageElement = this._format(args); 208 this._messageElement = this._format(args);
209 } 209 }
210 } 210 }
211 211
212 if (consoleMessage.source !== WebInspector.ConsoleMessage.MessageSource. Network || consoleMessage.request) { 212 if (consoleMessage.source !== WebInspector.ConsoleMessage.MessageSource. Network || consoleMessage.request) {
213 if (consoleMessage.scriptId) { 213 if (consoleMessage.scriptId) {
214 this._anchorElement = this._linkifyScriptId(consoleMessage.scrip tId, consoleMessage.url || "", consoleMessage.line, consoleMessage.column); 214 this._anchorElement = this._linkifyScriptId(consoleMessage.scrip tId, consoleMessage.url || "", consoleMessage.line, consoleMessage.column);
215 } else { 215 } else {
216 var showBlackboxed = (consoleMessage.source !== WebInspector.Con soleMessage.MessageSource.ConsoleAPI); 216 var showBlackboxed = (consoleMessage.source !== WebInspector.Con soleMessage.MessageSource.ConsoleAPI);
217 var debuggerModel = WebInspector.DebuggerModel.fromTarget(this._ target()); 217 var debuggerModel = WebInspector.DebuggerModel.fromTarget(this._ target());
218 var callFrame = WebInspector.DebuggerPresentationUtils.callFrame AnchorFromStackTrace(debuggerModel, consoleMessage.stackTrace, consoleMessage.as yncStackTrace, showBlackboxed); 218 var callFrame = WebInspector.DebuggerPresentationUtils.callFrame AnchorFromStackTrace(debuggerModel, consoleMessage.stackTrace, showBlackboxed);
219 if (callFrame && callFrame.scriptId) 219 if (callFrame && callFrame.scriptId)
220 this._anchorElement = this._linkifyCallFrame(callFrame); 220 this._anchorElement = this._linkifyCallFrame(callFrame);
221 else if (consoleMessage.url && consoleMessage.url !== "undefined ") 221 else if (consoleMessage.url && consoleMessage.url !== "undefined ")
222 this._anchorElement = this._linkifyLocation(consoleMessage.u rl, consoleMessage.line, consoleMessage.column); 222 this._anchorElement = this._linkifyLocation(consoleMessage.u rl, consoleMessage.line, consoleMessage.column);
223 } 223 }
224 } 224 }
225 225
226 this._formattedMessage.appendChild(this._messageElement); 226 this._formattedMessage.appendChild(this._messageElement);
227 if (this._anchorElement) { 227 if (this._anchorElement) {
228 // Append a space to prevent the anchor text from being glued to the console message when the user selects and copies the console messages. 228 // Append a space to prevent the anchor text from being glued to the console message when the user selects and copies the console messages.
229 this._anchorElement.appendChild(createTextNode(" ")); 229 this._anchorElement.appendChild(createTextNode(" "));
230 this._formattedMessage.insertBefore(this._anchorElement, this._forma ttedMessage.firstChild); 230 this._formattedMessage.insertBefore(this._anchorElement, this._forma ttedMessage.firstChild);
231 } 231 }
232 232
233 var dumpStackTrace = (!!consoleMessage.stackTrace || !!consoleMessage.as yncStackTrace) && (consoleMessage.source === WebInspector.ConsoleMessage.Message Source.Network || consoleMessage.level === WebInspector.ConsoleMessage.MessageLe vel.Error || consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.R evokedError || consoleMessage.type === WebInspector.ConsoleMessage.MessageType.T race); 233 var dumpStackTrace = !!consoleMessage.stackTrace && (consoleMessage.sour ce === WebInspector.ConsoleMessage.MessageSource.Network || consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.Error || consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.RevokedError || consoleMessage.type === WebInspector.ConsoleMessage.MessageType.Trace);
234 if (dumpStackTrace) { 234 if (dumpStackTrace) {
235 var treeOutline = new TreeOutline(); 235 var treeOutline = new TreeOutline();
236 treeOutline.element.classList.add("outline-disclosure", "outline-dis closure-no-padding"); 236 treeOutline.element.classList.add("outline-disclosure", "outline-dis closure-no-padding");
237 var content = this._formattedMessage; 237 var content = this._formattedMessage;
238 var root = new TreeElement(content); 238 var root = new TreeElement(content);
239 root.toggleOnClick = true; 239 root.toggleOnClick = true;
240 root.selectable = false; 240 root.selectable = false;
241 content.treeElementForTest = root; 241 content.treeElementForTest = root;
242 treeOutline.appendChild(root); 242 treeOutline.appendChild(root);
243 if (consoleMessage.type === WebInspector.ConsoleMessage.MessageType. Trace) 243 if (consoleMessage.type === WebInspector.ConsoleMessage.MessageType. Trace)
(...skipping 25 matching lines...) Expand all
269 var target = this._target(); 269 var target = this._target();
270 if (!target) 270 if (!target)
271 return null; 271 return null;
272 // FIXME(62725): stack trace line/column numbers are one-based. 272 // FIXME(62725): stack trace line/column numbers are one-based.
273 lineNumber = lineNumber ? lineNumber - 1 : 0; 273 lineNumber = lineNumber ? lineNumber - 1 : 0;
274 columnNumber = columnNumber ? columnNumber - 1 : 0; 274 columnNumber = columnNumber ? columnNumber - 1 : 0;
275 return this._linkifier.linkifyScriptLocation(target, null, url, lineNumb er, columnNumber, "console-message-url"); 275 return this._linkifier.linkifyScriptLocation(target, null, url, lineNumb er, columnNumber, "console-message-url");
276 }, 276 },
277 277
278 /** 278 /**
279 * @param {!ConsoleAgent.CallFrame} callFrame 279 * @param {!RuntimeAgent.CallFrame} callFrame
280 * @return {?Element} 280 * @return {?Element}
281 */ 281 */
282 _linkifyCallFrame: function(callFrame) 282 _linkifyCallFrame: function(callFrame)
283 { 283 {
284 var target = this._target(); 284 var target = this._target();
285 return this._linkifier.linkifyConsoleCallFrame(target, callFrame, "conso le-message-url"); 285 return this._linkifier.linkifyConsoleCallFrame(target, callFrame, "conso le-message-url");
286 }, 286 },
287 287
288 /** 288 /**
289 * @param {string} scriptId 289 * @param {string} scriptId
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 }, 1006 },
1007 1007
1008 /** 1008 /**
1009 * @param {!TreeElement} parentTreeElement 1009 * @param {!TreeElement} parentTreeElement
1010 */ 1010 */
1011 _populateStackTraceTreeElement: function(parentTreeElement) 1011 _populateStackTraceTreeElement: function(parentTreeElement)
1012 { 1012 {
1013 var target = this._target(); 1013 var target = this._target();
1014 if (!target) 1014 if (!target)
1015 return; 1015 return;
1016 var content = WebInspector.DOMPresentationUtils.buildStackTracePreviewCo ntents(target, 1016 var content = WebInspector.DOMPresentationUtils.buildStackTracePreviewCo ntents(target, this._linkifier, this._message.stackTrace);
1017 this._linkifier, this._message.stackTrace, this._message.asyncStackT race);
1018 var treeElement = new TreeElement(content); 1017 var treeElement = new TreeElement(content);
1019 treeElement.selectable = false; 1018 treeElement.selectable = false;
1020 parentTreeElement.appendChild(treeElement); 1019 parentTreeElement.appendChild(treeElement);
1021 }, 1020 },
1022 1021
1023 resetIncrementRepeatCount: function() 1022 resetIncrementRepeatCount: function()
1024 { 1023 {
1025 this._repeatCount = 1; 1024 this._repeatCount = 1;
1026 if (!this._repeatCountElement) 1025 if (!this._repeatCountElement)
1027 return; 1026 return;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 { 1332 {
1334 if (!this._wrapperElement) { 1333 if (!this._wrapperElement) {
1335 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); 1334 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this );
1336 this._wrapperElement.classList.toggle("collapsed", this._collapsed); 1335 this._wrapperElement.classList.toggle("collapsed", this._collapsed);
1337 } 1336 }
1338 return this._wrapperElement; 1337 return this._wrapperElement;
1339 }, 1338 },
1340 1339
1341 __proto__: WebInspector.ConsoleViewMessage.prototype 1340 __proto__: WebInspector.ConsoleViewMessage.prototype
1342 } 1341 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698