OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... |
32 * @constructor | 32 * @constructor |
33 */ | 33 */ |
34 function SourceMapV3() | 34 function SourceMapV3() |
35 { | 35 { |
36 /** @type {number} */ this.version; | 36 /** @type {number} */ this.version; |
37 /** @type {string|undefined} */ this.file; | 37 /** @type {string|undefined} */ this.file; |
38 /** @type {!Array.<string>} */ this.sources; | 38 /** @type {!Array.<string>} */ this.sources; |
39 /** @type {!Array.<!SourceMapV3.Section>|undefined} */ this.sections; | 39 /** @type {!Array.<!SourceMapV3.Section>|undefined} */ this.sections; |
40 /** @type {string} */ this.mappings; | 40 /** @type {string} */ this.mappings; |
41 /** @type {string|undefined} */ this.sourceRoot; | 41 /** @type {string|undefined} */ this.sourceRoot; |
| 42 /** @type {!Array.<string>|undefined} */ this.names; |
42 } | 43 } |
43 | 44 |
44 /** | 45 /** |
45 * @constructor | 46 * @constructor |
46 */ | 47 */ |
47 SourceMapV3.Section = function() | 48 SourceMapV3.Section = function() |
48 { | 49 { |
49 /** @type {!SourceMapV3} */ this.map; | 50 /** @type {!SourceMapV3} */ this.map; |
50 /** @type {!SourceMapV3.Offset} */ this.offset; | 51 /** @type {!SourceMapV3.Offset} */ this.offset; |
51 } | 52 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 }, | 132 }, |
132 | 133 |
133 /** | 134 /** |
134 * @return {string} | 135 * @return {string} |
135 */ | 136 */ |
136 url: function() | 137 url: function() |
137 { | 138 { |
138 return this._sourceMappingURL; | 139 return this._sourceMappingURL; |
139 }, | 140 }, |
140 | 141 |
141 /** | 142 /** |
142 * @return {!Array.<string>} | 143 * @return {!Array.<string>} |
143 */ | 144 */ |
144 sources: function() | 145 sources: function() |
145 { | 146 { |
146 return Object.keys(this._sources); | 147 return Object.keys(this._sources); |
147 }, | 148 }, |
148 | 149 |
149 /** | 150 /** |
150 * @param {string} sourceURL | 151 * @param {string} sourceURL |
151 * @return {string|undefined} | 152 * @return {string|undefined} |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 * @param {number} columnNumber | 283 * @param {number} columnNumber |
283 */ | 284 */ |
284 _parseMap: function(map, lineNumber, columnNumber) | 285 _parseMap: function(map, lineNumber, columnNumber) |
285 { | 286 { |
286 var sourceIndex = 0; | 287 var sourceIndex = 0; |
287 var sourceLineNumber = 0; | 288 var sourceLineNumber = 0; |
288 var sourceColumnNumber = 0; | 289 var sourceColumnNumber = 0; |
289 var nameIndex = 0; | 290 var nameIndex = 0; |
290 | 291 |
291 var sources = []; | 292 var sources = []; |
| 293 var names = map.names || []; |
292 var sourceRoot = map.sourceRoot || ""; | 294 var sourceRoot = map.sourceRoot || ""; |
293 if (sourceRoot && !sourceRoot.endsWith("/")) | 295 if (sourceRoot && !sourceRoot.endsWith("/")) |
294 sourceRoot += "/"; | 296 sourceRoot += "/"; |
295 for (var i = 0; i < map.sources.length; ++i) { | 297 for (var i = 0; i < map.sources.length; ++i) { |
296 var href = sourceRoot + map.sources[i]; | 298 var href = sourceRoot + map.sources[i]; |
297 var url = WebInspector.ParsedURL.completeURL(this._sourceMappingURL,
href) || href; | 299 var url = WebInspector.ParsedURL.completeURL(this._sourceMappingURL,
href) || href; |
298 var hasSource = map.sourcesContent && map.sourcesContent[i]; | 300 var hasSource = map.sourcesContent && map.sourcesContent[i]; |
299 if (url === this._compiledURL && hasSource) | 301 if (url === this._compiledURL && hasSource) |
300 url += WebInspector.UIString(" [sm]"); | 302 url += WebInspector.UIString(" [sm]"); |
301 sources.push(url); | 303 sources.push(url); |
(...skipping 28 matching lines...) Expand all Loading... |
330 var sourceIndexDelta = this._decodeVLQ(stringCharIterator); | 332 var sourceIndexDelta = this._decodeVLQ(stringCharIterator); |
331 if (sourceIndexDelta) { | 333 if (sourceIndexDelta) { |
332 sourceIndex += sourceIndexDelta; | 334 sourceIndex += sourceIndexDelta; |
333 sourceURL = sources[sourceIndex]; | 335 sourceURL = sources[sourceIndex]; |
334 } | 336 } |
335 sourceLineNumber += this._decodeVLQ(stringCharIterator); | 337 sourceLineNumber += this._decodeVLQ(stringCharIterator); |
336 sourceColumnNumber += this._decodeVLQ(stringCharIterator); | 338 sourceColumnNumber += this._decodeVLQ(stringCharIterator); |
337 if (!this._isSeparator(stringCharIterator.peek())) | 339 if (!this._isSeparator(stringCharIterator.peek())) |
338 nameIndex += this._decodeVLQ(stringCharIterator); | 340 nameIndex += this._decodeVLQ(stringCharIterator); |
339 | 341 |
340 this._mappings.push(new WebInspector.SourceMap.Entry(lineNumber, col
umnNumber, sourceURL, sourceLineNumber, sourceColumnNumber)); | 342 this._mappings.push(new WebInspector.SourceMap.Entry(lineNumber, col
umnNumber, sourceURL, sourceLineNumber, sourceColumnNumber, names[nameIndex])); |
341 } | 343 } |
342 | 344 |
343 for (var i = 0; i < this._mappings.length; ++i) { | 345 for (var i = 0; i < this._mappings.length; ++i) { |
344 var mapping = this._mappings[i]; | 346 var mapping = this._mappings[i]; |
345 var url = mapping.sourceURL; | 347 var url = mapping.sourceURL; |
346 if (!url) | 348 if (!url) |
347 continue; | 349 continue; |
348 if (!this._reverseMappingsBySourceURL.has(url)) | 350 if (!this._reverseMappingsBySourceURL.has(url)) |
349 this._reverseMappingsBySourceURL.set(url, []); | 351 this._reverseMappingsBySourceURL.set(url, []); |
350 var reverseMappings = this._reverseMappingsBySourceURL.get(url); | 352 var reverseMappings = this._reverseMappingsBySourceURL.get(url); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 } | 425 } |
424 } | 426 } |
425 | 427 |
426 /** | 428 /** |
427 * @constructor | 429 * @constructor |
428 * @param {number} lineNumber | 430 * @param {number} lineNumber |
429 * @param {number} columnNumber | 431 * @param {number} columnNumber |
430 * @param {string=} sourceURL | 432 * @param {string=} sourceURL |
431 * @param {number=} sourceLineNumber | 433 * @param {number=} sourceLineNumber |
432 * @param {number=} sourceColumnNumber | 434 * @param {number=} sourceColumnNumber |
| 435 * @param {string=} name |
433 */ | 436 */ |
434 WebInspector.SourceMap.Entry = function(lineNumber, columnNumber, sourceURL, sou
rceLineNumber, sourceColumnNumber) | 437 WebInspector.SourceMap.Entry = function(lineNumber, columnNumber, sourceURL, sou
rceLineNumber, sourceColumnNumber, name) |
435 { | 438 { |
436 this.lineNumber = lineNumber; | 439 this.lineNumber = lineNumber; |
437 this.columnNumber = columnNumber; | 440 this.columnNumber = columnNumber; |
438 this.sourceURL = sourceURL; | 441 this.sourceURL = sourceURL; |
439 this.sourceLineNumber = sourceLineNumber; | 442 this.sourceLineNumber = sourceLineNumber; |
440 this.sourceColumnNumber = sourceColumnNumber; | 443 this.sourceColumnNumber = sourceColumnNumber; |
| 444 this.name = name; |
441 } | 445 } |
OLD | NEW |