| OLD | NEW | 
|---|
| 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 {!RuntimeAgent.StackTrace=} stackTrace | 9  * @param {!RuntimeAgent.StackTrace=} stackTrace | 
| 10  * @param {boolean=} showBlackboxed | 10  * @param {boolean=} showBlackboxed | 
| 11  * @return {?RuntimeAgent.CallFrame} | 11  * @return {?RuntimeAgent.CallFrame} | 
| 12  */ | 12  */ | 
| 13 WebInspector.DebuggerPresentationUtils.callFrameAnchorFromStackTrace = function(
    debuggerModel, stackTrace, showBlackboxed) | 13 WebInspector.DebuggerPresentationUtils.callFrameAnchorFromStackTrace = function(
    debuggerModel, stackTrace, showBlackboxed) | 
| 14 { | 14 { | 
| 15     /** | 15     /** | 
| 16      * @param {!Array.<!RuntimeAgent.CallFrame>} callFrames | 16      * @param {!Array.<!RuntimeAgent.CallFrame>} callFrames | 
| 17      * @return {?RuntimeAgent.CallFrame} | 17      * @return {?RuntimeAgent.CallFrame} | 
| 18      */ | 18      */ | 
| 19     function innerCallFrameAnchorFromStackTrace(callFrames) | 19     function innerCallFrameAnchorFromStackTrace(callFrames) | 
| 20     { | 20     { | 
| 21         if (!callFrames.length) | 21         if (!callFrames.length) | 
| 22             return null; | 22             return null; | 
| 23         if (showBlackboxed) | 23         if (showBlackboxed) | 
| 24             return callFrames[0]; | 24             return callFrames[0]; | 
| 25         for (var i = 0; i < callFrames.length; ++i) { | 25         for (var callFrame of callFrames) { | 
| 26             var script = debuggerModel && debuggerModel.scriptForId(callFrames[i
    ].scriptId); | 26             var location = debuggerModel && debuggerModel.createRawLocationByScr
    iptId(callFrame.scriptId, callFrame.lineNumber, callFrame.columnNumber); | 
| 27             var blackboxed = script ? | 27             var blackboxed = location ? | 
| 28                 WebInspector.BlackboxSupport.isBlackboxed(script.sourceURL, scri
    pt.isContentScript()) : | 28                 WebInspector.blackboxManager.isBlackboxedRawLocation(location) : | 
| 29                 WebInspector.BlackboxSupport.isBlackboxedURL(callFrames[i].url); | 29                 WebInspector.blackboxManager.isBlackboxedURL(callFrame.url); | 
| 30             if (!blackboxed) | 30             if (!blackboxed) | 
| 31                 return callFrames[i]; | 31                 return callFrame; | 
| 32         } | 32         } | 
| 33         return null; | 33         return null; | 
| 34     } | 34     } | 
| 35 | 35 | 
| 36     var asyncStackTrace = stackTrace; | 36     var asyncStackTrace = stackTrace; | 
| 37     while (asyncStackTrace) { | 37     while (asyncStackTrace) { | 
| 38         var callFrame = innerCallFrameAnchorFromStackTrace(asyncStackTrace.callF
    rames); | 38         var callFrame = innerCallFrameAnchorFromStackTrace(asyncStackTrace.callF
    rames); | 
| 39         if (callFrame) | 39         if (callFrame) | 
| 40             return callFrame; | 40             return callFrame; | 
| 41         asyncStackTrace = asyncStackTrace.parent; | 41         asyncStackTrace = asyncStackTrace.parent; | 
| 42     } | 42     } | 
| 43     return stackTrace && stackTrace.callFrames.length ? stackTrace.callFrames[0]
     : null; | 43     return stackTrace && stackTrace.callFrames.length ? stackTrace.callFrames[0]
     : null; | 
| 44 } | 44 } | 
| OLD | NEW | 
|---|