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 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
9 */ | 9 */ |
10 WebInspector.BlackboxManager = function(debuggerWorkspaceBinding) | 10 WebInspector.BlackboxManager = function(debuggerWorkspaceBinding) |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 * @return {!Promise<undefined>} | 142 * @return {!Promise<undefined>} |
143 */ | 143 */ |
144 sourceMapLoaded: function(script, sourceMap) | 144 sourceMapLoaded: function(script, sourceMap) |
145 { | 145 { |
146 if (!sourceMap) | 146 if (!sourceMap) |
147 return Promise.resolve(); | 147 return Promise.resolve(); |
148 var previousScriptState = this._scriptPositions(script); | 148 var previousScriptState = this._scriptPositions(script); |
149 if (!previousScriptState) | 149 if (!previousScriptState) |
150 return Promise.resolve(); | 150 return Promise.resolve(); |
151 | 151 |
152 var mappings = sourceMap.mappings().slice(); | 152 var hasBlackboxedMappings = sourceMap.sourceURLs().some((url) => this.is BlackboxedURL(url)); |
153 mappings.sort(mappingComparator); | 153 var mappings = hasBlackboxedMappings ? sourceMap.mappings().slice() : [] ; |
154 | |
155 if (!mappings.length) { | 154 if (!mappings.length) { |
lushnikov
2016/10/01 04:23:50
how's a sourceMap with empty mappings differs from
kozy
2016/10/01 04:40:21
There are no big difference between empty source m
| |
156 if (previousScriptState.length > 0) | 155 if (previousScriptState.length > 0) |
157 return this._setScriptState(script, []); | 156 return this._setScriptState(script, []); |
158 return Promise.resolve(); | 157 return Promise.resolve(); |
159 } | 158 } |
159 mappings.sort(mappingComparator); | |
160 | 160 |
161 var currentBlackboxed = false; | 161 var currentBlackboxed = false; |
162 var isBlackboxed = false; | 162 var isBlackboxed = false; |
163 var positions = []; | 163 var positions = []; |
164 // If content in script file begin is not mapped and one or more ranges are blackboxed then blackbox it. | 164 // If content in script file begin is not mapped and one or more ranges are blackboxed then blackbox it. |
165 if (mappings[0].lineNumber !== 0 || mappings[0].columnNumber !== 0) { | 165 if (mappings[0].lineNumber !== 0 || mappings[0].columnNumber !== 0) { |
166 positions.push({ lineNumber: 0, columnNumber: 0}); | 166 positions.push({ lineNumber: 0, columnNumber: 0}); |
167 currentBlackboxed = true; | 167 currentBlackboxed = true; |
168 } | 168 } |
169 for (var mapping of mappings) { | 169 for (var mapping of mappings) { |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 if (scheme === "chrome-extension") | 446 if (scheme === "chrome-extension") |
447 prefix += parsedURL.host + "\\b"; | 447 prefix += parsedURL.host + "\\b"; |
448 prefix += ".*"; | 448 prefix += ".*"; |
449 } | 449 } |
450 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\ b"); | 450 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\ b"); |
451 } | 451 } |
452 } | 452 } |
453 | 453 |
454 /** @type {!WebInspector.BlackboxManager} */ | 454 /** @type {!WebInspector.BlackboxManager} */ |
455 WebInspector.blackboxManager; | 455 WebInspector.blackboxManager; |
OLD | NEW |