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 * @implements {WebInspector.TargetManager.Observer} | 9 * @implements {WebInspector.TargetManager.Observer} |
10 */ | 10 */ |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 * @return {!Promise<undefined>} | 144 * @return {!Promise<undefined>} |
145 */ | 145 */ |
146 sourceMapLoaded: function(script, sourceMap) | 146 sourceMapLoaded: function(script, sourceMap) |
147 { | 147 { |
148 if (!sourceMap) | 148 if (!sourceMap) |
149 return Promise.resolve(); | 149 return Promise.resolve(); |
150 var previousScriptState = this._scriptPositions(script); | 150 var previousScriptState = this._scriptPositions(script); |
151 if (!previousScriptState) | 151 if (!previousScriptState) |
152 return Promise.resolve(); | 152 return Promise.resolve(); |
153 | 153 |
154 var mappings = sourceMap.mappings().slice(); | 154 var hasBlackboxedMappings = sourceMap.sourceURLs().some((url) => this.is
BlackboxedURL(url)); |
155 mappings.sort(mappingComparator); | 155 var mappings = hasBlackboxedMappings ? sourceMap.mappings().slice() : []
; |
156 | |
157 if (!mappings.length) { | 156 if (!mappings.length) { |
158 if (previousScriptState.length > 0) | 157 if (previousScriptState.length > 0) |
159 return this._setScriptState(script, []); | 158 return this._setScriptState(script, []); |
160 return Promise.resolve(); | 159 return Promise.resolve(); |
161 } | 160 } |
| 161 mappings.sort(mappingComparator); |
162 | 162 |
163 var currentBlackboxed = false; | 163 var currentBlackboxed = false; |
164 var isBlackboxed = false; | 164 var isBlackboxed = false; |
165 var positions = []; | 165 var positions = []; |
166 // If content in script file begin is not mapped and one or more ranges
are blackboxed then blackbox it. | 166 // If content in script file begin is not mapped and one or more ranges
are blackboxed then blackbox it. |
167 if (mappings[0].lineNumber !== 0 || mappings[0].columnNumber !== 0) { | 167 if (mappings[0].lineNumber !== 0 || mappings[0].columnNumber !== 0) { |
168 positions.push({ lineNumber: 0, columnNumber: 0}); | 168 positions.push({ lineNumber: 0, columnNumber: 0}); |
169 currentBlackboxed = true; | 169 currentBlackboxed = true; |
170 } | 170 } |
171 for (var mapping of mappings) { | 171 for (var mapping of mappings) { |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 if (scheme === "chrome-extension") | 453 if (scheme === "chrome-extension") |
454 prefix += parsedURL.host + "\\b"; | 454 prefix += parsedURL.host + "\\b"; |
455 prefix += ".*"; | 455 prefix += ".*"; |
456 } | 456 } |
457 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\
b"); | 457 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\
b"); |
458 } | 458 } |
459 } | 459 } |
460 | 460 |
461 /** @type {!WebInspector.BlackboxManager} */ | 461 /** @type {!WebInspector.BlackboxManager} */ |
462 WebInspector.blackboxManager; | 462 WebInspector.blackboxManager; |
OLD | NEW |