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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/DebuggerPresentationUtils.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: 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 WebInspector.DebuggerPresentationUtils = {} 5 WebInspector.DebuggerPresentationUtils = {}
6 6
7 /** 7 /**
8 * @param {?WebInspector.DebuggerModel} debuggerModel 8 * @param {?WebInspector.DebuggerModel} debuggerModel
9 * @param {!Array.<!ConsoleAgent.CallFrame>=} stackTrace 9 * @param {!RuntimeAgent.StackTrace=} stackTrace
10 * @param {!ConsoleAgent.AsyncStackTrace=} asyncStackTrace
11 * @param {boolean=} showBlackboxed 10 * @param {boolean=} showBlackboxed
12 * @return {?ConsoleAgent.CallFrame} 11 * @return {?RuntimeAgent.CallFrame}
13 */ 12 */
14 WebInspector.DebuggerPresentationUtils.callFrameAnchorFromStackTrace = function( debuggerModel, stackTrace, asyncStackTrace, showBlackboxed) 13 WebInspector.DebuggerPresentationUtils.callFrameAnchorFromStackTrace = function( debuggerModel, stackTrace, showBlackboxed)
15 { 14 {
15 if (!stackTrace)
16 return null;
16 /** 17 /**
17 * @param {?Array.<!ConsoleAgent.CallFrame>=} stackTrace 18 * @param {!Array.<!RuntimeAgent.CallFrame>=} callFrames
dgozman 2016/02/04 01:43:06 stackTrace.callFrames cannot be optional.
pfeldman 2016/02/04 03:15:59 Done.
18 * @return {?ConsoleAgent.CallFrame} 19 * @return {?RuntimeAgent.CallFrame}
19 */ 20 */
20 function innerCallFrameAnchorFromStackTrace(stackTrace) 21 function innerCallFrameAnchorFromStackTrace(callFrames)
21 { 22 {
22 if (!stackTrace || !stackTrace.length) 23 if (!callFrames.length)
23 return null; 24 return null;
24 if (showBlackboxed) 25 if (showBlackboxed)
25 return stackTrace[0]; 26 return callFrames[0];
26 for (var i = 0; i < stackTrace.length; ++i) { 27 for (var i = 0; i < callFrames.length; ++i) {
27 var script = debuggerModel && debuggerModel.scriptForId(stackTrace[i ].scriptId); 28 var script = debuggerModel && debuggerModel.scriptForId(callFrames[i ].scriptId);
28 var blackboxed = script ? 29 var blackboxed = script ?
29 WebInspector.BlackboxSupport.isBlackboxed(script.sourceURL, scri pt.isContentScript()) : 30 WebInspector.BlackboxSupport.isBlackboxed(script.sourceURL, scri pt.isContentScript()) :
30 WebInspector.BlackboxSupport.isBlackboxedURL(stackTrace[i].url); 31 WebInspector.BlackboxSupport.isBlackboxedURL(callFrames[i].url);
31 if (!blackboxed) 32 if (!blackboxed)
32 return stackTrace[i]; 33 return callFrames[i];
33 } 34 }
34 return null; 35 return null;
35 } 36 }
36 37
37 var callFrame = innerCallFrameAnchorFromStackTrace(stackTrace); 38 var callFrame = innerCallFrameAnchorFromStackTrace(stackTrace.callFrames);
dgozman 2016/02/04 01:43:06 This section can be merged into |while| below.
pfeldman 2016/02/04 03:15:59 Done.
38 if (callFrame) 39 if (callFrame)
39 return callFrame; 40 return callFrame;
40 41
42 var asyncStackTrace = callFrame.parent;
41 while (asyncStackTrace) { 43 while (asyncStackTrace) {
42 callFrame = innerCallFrameAnchorFromStackTrace(asyncStackTrace.callFrame s); 44 callFrame = innerCallFrameAnchorFromStackTrace(asyncStackTrace.callFrame s);
43 if (callFrame) 45 if (callFrame)
44 return callFrame; 46 return callFrame;
45 asyncStackTrace = asyncStackTrace.asyncStackTrace; 47 asyncStackTrace = asyncStackTrace.parent;
46 } 48 }
47 49 return stackTrace.callFrames.length ? stackTrace.callFrames[0] : null;
48 return stackTrace ? stackTrace[0] : null;
49 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698