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

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: a Created 4 years, 1 month 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 && async StackTrace.callFrames.length > 1) {
88 var redundantFrame = asyncStackTrace.callFrames.shift();
dgozman 2016/10/20 21:37:07 Let's move model mutation to DebuggerModel.
kozy 2016/10/20 22:21:07 Done.
89 var topFrame = asyncStackTrace.callFrames[0];
90 var redundantFrameName = WebInspector.beautifyFunctionName(redun dantFrame.functionName);
91 var topFrameName = WebInspector.beautifyFunctionName(topFrame.fu nctionName);
92 title = topFrameName + " awaits " + redundantFrameName;
93 } else {
94 title = WebInspector.asyncStackTraceLabel(asyncStackTrace.descri ption);
95 }
86 var asyncCallFrame = new WebInspector.UIList.Item(title, "", true); 96 var asyncCallFrame = new WebInspector.UIList.Item(title, "", true);
87 asyncCallFrame.setHoverable(false); 97 asyncCallFrame.setHoverable(false);
88 asyncCallFrame.element.addEventListener("contextmenu", this._asyncCa llFrameContextMenu.bind(this, this.callFrames.length), true); 98 asyncCallFrame.element.addEventListener("contextmenu", this._asyncCa llFrameContextMenu.bind(this, this.callFrames.length), true);
89 this._appendSidebarCallFrames(this._callFramesFromRuntime(asyncStack Trace.callFrames, asyncCallFrame), asyncCallFrame); 99 this._appendSidebarCallFrames(this._callFramesFromRuntime(asyncStack Trace.callFrames, asyncCallFrame), asyncCallFrame);
90 asyncStackTrace = asyncStackTrace.parent; 100 asyncStackTrace = asyncStackTrace.parent;
91 } 101 }
92 102
93 if (topStackHidden) 103 if (topStackHidden)
94 this._revealHiddenCallFrames(); 104 this._revealHiddenCallFrames();
95 if (this._hiddenCallFrames) { 105 if (this._hiddenCallFrames) {
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 var uiLocation = liveLocation.uiLocation(); 498 var uiLocation = liveLocation.uiLocation();
489 if (!uiLocation) 499 if (!uiLocation)
490 return; 500 return;
491 var text = uiLocation.linkText(); 501 var text = uiLocation.linkText();
492 this.setSubtitle(text.trimMiddle(30)); 502 this.setSubtitle(text.trimMiddle(30));
493 this.subtitleElement.title = text; 503 this.subtitleElement.title = text;
494 }, 504 },
495 505
496 __proto__: WebInspector.UIList.Item.prototype 506 __proto__: WebInspector.UIList.Item.prototype
497 } 507 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/async-call-stack-async-function-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698