| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** | 
| 6  * @constructor | 6  * @constructor | 
| 7  * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding | 7  * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding | 
| 8  * @param {!WebInspector.NetworkMapping} networkMapping | 8  * @param {!WebInspector.NetworkMapping} networkMapping | 
| 9  */ | 9  */ | 
| 10 WebInspector.BlackboxManager = function(debuggerWorkspaceBinding, networkMapping
     ) | 10 WebInspector.BlackboxManager = function(debuggerWorkspaceBinding, networkMapping
     ) | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 42         WebInspector.moduleSetting("skipStackFramesPattern").removeChangeListene
     r(listener, thisObject); | 42         WebInspector.moduleSetting("skipStackFramesPattern").removeChangeListene
     r(listener, thisObject); | 
| 43     }, | 43     }, | 
| 44 | 44 | 
| 45     /** | 45     /** | 
| 46      * @param {!WebInspector.DebuggerModel.Location} location | 46      * @param {!WebInspector.DebuggerModel.Location} location | 
| 47      * @return {boolean} | 47      * @return {boolean} | 
| 48      */ | 48      */ | 
| 49     isBlackboxedRawLocation: function(location) | 49     isBlackboxedRawLocation: function(location) | 
| 50     { | 50     { | 
| 51         if (!this._scriptIdToPositions.has(location.scriptId)) | 51         if (!this._scriptIdToPositions.has(location.scriptId)) | 
| 52             return false; | 52             return this._isBlackboxedScript(location.script()); | 
| 53         var positions = this._scriptIdToPositions.get(location.scriptId); | 53         var positions = this._scriptIdToPositions.get(location.scriptId); | 
| 54         var index = positions.lowerBound(location, comparator); | 54         var index = positions.lowerBound(location, comparator); | 
| 55         return !!(index % 2); | 55         return !!(index % 2); | 
| 56 | 56 | 
| 57         /** | 57         /** | 
| 58          * @param {!WebInspector.DebuggerModel.Location} a | 58          * @param {!WebInspector.DebuggerModel.Location} a | 
| 59          * @param {!DebuggerAgent.ScriptPosition} b | 59          * @param {!DebuggerAgent.ScriptPosition} b | 
| 60          * @return {number} | 60          * @return {number} | 
| 61          */ | 61          */ | 
| 62         function comparator(a, b) | 62         function comparator(a, b) | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 77         var isContentScript = projectType === WebInspector.projectTypes.ContentS
     cripts; | 77         var isContentScript = projectType === WebInspector.projectTypes.ContentS
     cripts; | 
| 78         if (isContentScript && WebInspector.moduleSetting("skipContentScripts").
     get()) | 78         if (isContentScript && WebInspector.moduleSetting("skipContentScripts").
     get()) | 
| 79             return true; | 79             return true; | 
| 80         var networkURL = this._networkMapping.networkURL(uiSourceCode); | 80         var networkURL = this._networkMapping.networkURL(uiSourceCode); | 
| 81         var url = projectType === WebInspector.projectTypes.Formatter ? uiSource
     Code.url() : networkURL; | 81         var url = projectType === WebInspector.projectTypes.Formatter ? uiSource
     Code.url() : networkURL; | 
| 82         return this.isBlackboxedURL(url); | 82         return this.isBlackboxedURL(url); | 
| 83     }, | 83     }, | 
| 84 | 84 | 
| 85     /** | 85     /** | 
| 86      * @param {string} url | 86      * @param {string} url | 
|  | 87      * @param {boolean=} isContentScript | 
| 87      * @return {boolean} | 88      * @return {boolean} | 
| 88      */ | 89      */ | 
| 89     isBlackboxedURL: function(url) | 90     isBlackboxedURL: function(url, isContentScript) | 
| 90     { | 91     { | 
| 91         if (this._isBlackboxedURLCache.has(url)) | 92         if (this._isBlackboxedURLCache.has(url)) | 
| 92             return !!this._isBlackboxedURLCache.get(url); | 93             return !!this._isBlackboxedURLCache.get(url); | 
|  | 94         if (isContentScript && WebInspector.moduleSetting("skipContentScripts").
     get()) | 
|  | 95             return true; | 
| 93         var regex = WebInspector.moduleSetting("skipStackFramesPattern").asRegEx
     p(); | 96         var regex = WebInspector.moduleSetting("skipStackFramesPattern").asRegEx
     p(); | 
| 94         var isBlackboxed = regex && regex.test(url); | 97         var isBlackboxed = regex && regex.test(url); | 
| 95         this._isBlackboxedURLCache.set(url, isBlackboxed); | 98         this._isBlackboxedURLCache.set(url, isBlackboxed); | 
| 96         return isBlackboxed; | 99         return isBlackboxed; | 
| 97     }, | 100     }, | 
| 98 | 101 | 
| 99     /** | 102     /** | 
| 100      * @param {!WebInspector.Script} script | 103      * @param {!WebInspector.Script} script | 
| 101      * @param {?WebInspector.SourceMap} sourceMap | 104      * @param {?WebInspector.SourceMap} sourceMap | 
| 102      * @return {!Promise<undefined>} | 105      * @return {!Promise<undefined>} | 
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 267         var blackboxed = this._isBlackboxedScript(script); | 270         var blackboxed = this._isBlackboxedScript(script); | 
| 268         return this._setScriptState(script, blackboxed ? [ { line: 0, column: 0 
     } ] : []); | 271         return this._setScriptState(script, blackboxed ? [ { line: 0, column: 0 
     } ] : []); | 
| 269     }, | 272     }, | 
| 270 | 273 | 
| 271     /** | 274     /** | 
| 272      * @param {!WebInspector.Script} script | 275      * @param {!WebInspector.Script} script | 
| 273      * @return {boolean} | 276      * @return {boolean} | 
| 274      */ | 277      */ | 
| 275     _isBlackboxedScript: function(script) | 278     _isBlackboxedScript: function(script) | 
| 276     { | 279     { | 
| 277         if (script.isContentScript() && WebInspector.moduleSetting("skipContentS
     cripts").get()) | 280         return this.isBlackboxedURL(script.sourceURL, script.isContentScript()); | 
| 278             return true; |  | 
| 279         return this.isBlackboxedURL(script.sourceURL); |  | 
| 280     }, | 281     }, | 
| 281 | 282 | 
| 282     /** | 283     /** | 
| 283      * @param {!WebInspector.Script} script | 284      * @param {!WebInspector.Script} script | 
| 284      * @param {!Array<!DebuggerAgent.ScriptPosition>} positions | 285      * @param {!Array<!DebuggerAgent.ScriptPosition>} positions | 
| 285      * @return {!Promise<undefined>} | 286      * @return {!Promise<undefined>} | 
| 286      */ | 287      */ | 
| 287     _setScriptState: function(script, positions) | 288     _setScriptState: function(script, positions) | 
| 288     { | 289     { | 
| 289         if (this._scriptIdToPositions.has(script.scriptId)) { | 290         if (this._scriptIdToPositions.has(script.scriptId)) { | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 303 | 304 | 
| 304         /** | 305         /** | 
| 305          * @param {boolean} success | 306          * @param {boolean} success | 
| 306          * @this {WebInspector.BlackboxManager} | 307          * @this {WebInspector.BlackboxManager} | 
| 307          */ | 308          */ | 
| 308         function updateState(success) | 309         function updateState(success) | 
| 309         { | 310         { | 
| 310             if (success) { | 311             if (success) { | 
| 311                 this._scriptIdToPositions.set(script.scriptId, positions); | 312                 this._scriptIdToPositions.set(script.scriptId, positions); | 
| 312                 this._debuggerWorkspaceBinding.updateLocations(script); | 313                 this._debuggerWorkspaceBinding.updateLocations(script); | 
|  | 314                 var isBlackboxed = positions.length !== 0; | 
|  | 315                 if (!isBlackboxed && script.sourceMapURL) | 
|  | 316                     this._debuggerWorkspaceBinding.maybeLoadSourceMap(script); | 
| 313             } else if (!this._scriptIdToPositions.has(script.scriptId)) { | 317             } else if (!this._scriptIdToPositions.has(script.scriptId)) { | 
| 314                 this._scriptIdToPositions.set(script.scriptId, []); | 318                 this._scriptIdToPositions.set(script.scriptId, []); | 
| 315             } | 319             } | 
| 316         } | 320         } | 
| 317     }, | 321     }, | 
| 318 | 322 | 
| 319     /** | 323     /** | 
| 320      * @param {string} url | 324      * @param {string} url | 
| 321      * @return {string} | 325      * @return {string} | 
| 322      */ | 326      */ | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 343             if (scheme === "chrome-extension") | 347             if (scheme === "chrome-extension") | 
| 344                 prefix += parsedURL.host + "\\b"; | 348                 prefix += parsedURL.host + "\\b"; | 
| 345             prefix += ".*"; | 349             prefix += ".*"; | 
| 346         } | 350         } | 
| 347         return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\
     b"); | 351         return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\
     b"); | 
| 348     } | 352     } | 
| 349 } | 353 } | 
| 350 | 354 | 
| 351 /** @type {!WebInspector.BlackboxManager} */ | 355 /** @type {!WebInspector.BlackboxManager} */ | 
| 352 WebInspector.blackboxManager; | 356 WebInspector.blackboxManager; | 
| OLD | NEW | 
|---|