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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/CallStackSidebarPane.js

Issue 2384533002: [DevTools] Better label for async function call stacks (Closed)
Patch Set: rebased Created 4 years, 2 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (!details) { 74 if (!details) {
75 WebInspector.context.setFlavor(WebInspector.DebuggerModel.CallFrame, null); 75 WebInspector.context.setFlavor(WebInspector.DebuggerModel.CallFrame, null);
76 return; 76 return;
77 } 77 }
78 this._debuggerModel = details.debuggerModel; 78 this._debuggerModel = details.debuggerModel;
79 var asyncStackTrace = details.asyncStackTrace; 79 var asyncStackTrace = details.asyncStackTrace;
80 80
81 this._appendSidebarCallFrames(this._callFramesFromDebugger(details.callF rames)); 81 this._appendSidebarCallFrames(this._callFramesFromDebugger(details.callF rames));
82 var topStackHidden = (this._hiddenCallFrames === this.callFrames.length) ; 82 var topStackHidden = (this._hiddenCallFrames === this.callFrames.length) ;
83 83
84 const asyncFunctionDesription = "async function";
84 while (asyncStackTrace) { 85 while (asyncStackTrace) {
85 var title = WebInspector.asyncStackTraceLabel(asyncStackTrace.descri ption); 86 var title = "";
87 if (asyncStackTrace.description === asyncFunctionDesription) {
88 var redundantFrame = asyncStackTrace.callFrames.shift();
89 var topFrame = asyncStackTrace.callFrames[0];
90 if (topFrame && redundantFrame) {
91 var redundantFrameName = WebInspector.beautifyFunctionName(r edundantFrame.functionName);
92 var topFrameName = WebInspector.beautifyFunctionName(topFram e.functionName);
93 title = WebInspector.UIString("%s awaits %s", topFrameName, redundantFrameName);
dgozman 2016/10/20 01:19:01 No UIString.
kozy 2016/10/20 01:39:33 Done.
94 }
95 } else {
96 title = WebInspector.asyncStackTraceLabel(asyncStackTrace.descri ption);
97 }
86 var asyncCallFrame = new WebInspector.UIList.Item(title, "", true); 98 var asyncCallFrame = new WebInspector.UIList.Item(title, "", true);
87 asyncCallFrame.setHoverable(false); 99 asyncCallFrame.setHoverable(false);
88 asyncCallFrame.element.addEventListener("contextmenu", this._asyncCa llFrameContextMenu.bind(this, this.callFrames.length), true); 100 asyncCallFrame.element.addEventListener("contextmenu", this._asyncCa llFrameContextMenu.bind(this, this.callFrames.length), true);
89 this._appendSidebarCallFrames(this._callFramesFromRuntime(asyncStack Trace.callFrames, asyncCallFrame), asyncCallFrame); 101 this._appendSidebarCallFrames(this._callFramesFromRuntime(asyncStack Trace.callFrames, asyncCallFrame), asyncCallFrame);
90 asyncStackTrace = asyncStackTrace.parent; 102 asyncStackTrace = asyncStackTrace.parent;
91 } 103 }
92 104
93 if (topStackHidden) 105 if (topStackHidden)
94 this._revealHiddenCallFrames(); 106 this._revealHiddenCallFrames();
95 if (this._hiddenCallFrames) { 107 if (this._hiddenCallFrames) {
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 var uiLocation = liveLocation.uiLocation(); 500 var uiLocation = liveLocation.uiLocation();
489 if (!uiLocation) 501 if (!uiLocation)
490 return; 502 return;
491 var text = uiLocation.linkText(); 503 var text = uiLocation.linkText();
492 this.setSubtitle(text.trimMiddle(30)); 504 this.setSubtitle(text.trimMiddle(30));
493 this.subtitleElement.title = text; 505 this.subtitleElement.title = text;
494 }, 506 },
495 507
496 __proto__: WebInspector.UIList.Item.prototype 508 __proto__: WebInspector.UIList.Item.prototype
497 } 509 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698