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
3 // found in the LICENSE file.
5 WebInspector.DebuggerPresentationUtils = {}
8 * @param {?WebInspector.DebuggerModel} debuggerModel
9 * @param {!Array.<!ConsoleAgent.CallFrame>=} stackTrace
10 * @param {!ConsoleAgent.AsyncStackTrace=} asyncStackTrace
11 * @param {boolean=} showBlackboxed
12 * @return {?ConsoleAgent.CallFrame}
14 WebInspector.DebuggerPresentationUtils.callFrameAnchorFromStackTrace = function(debuggerModel, stackTrace, asyncStackTrace, showBlackboxed)
17 * @param {?Array.<!ConsoleAgent.CallFrame>=} stackTrace
18 * @return {?ConsoleAgent.CallFrame}
20 function innerCallFrameAnchorFromStackTrace(stackTrace)
22 if (!stackTrace || !stackTrace.length)
26 for (var i = 0; i < stackTrace.length; ++i) {
27 var script = debuggerModel && debuggerModel.scriptForId(stackTrace[i].scriptId);
28 var blackboxed = script ?
29 WebInspector.BlackboxSupport.isBlackboxed(script.sourceURL, script.isContentScript()) :
30 WebInspector.BlackboxSupport.isBlackboxedURL(stackTrace[i].url);
37 var callFrame = innerCallFrameAnchorFromStackTrace(stackTrace);
41 while (asyncStackTrace) {
42 callFrame = innerCallFrameAnchorFromStackTrace(asyncStackTrace.callFrames);
45 asyncStackTrace = asyncStackTrace.asyncStackTrace;
48 return stackTrace ? stackTrace[0] : null;