Skip to content

Commit c9e11a1

Browse files
committed
Handle null name in IndexedSourceMapConsumer._parseMappings
IndexedSourceMapConsumer._parseMappings could thrown an exception when a mapping did not have a name. However, mappings aren't required to have names. Fixes mozilla#258
1 parent 1941aaa commit c9e11a1

11 files changed

+86
-32
lines changed

dist/source-map.debug.js

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/source-map.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,9 +2447,12 @@ return /******/ (function(modules) { // webpackBootstrap
24472447
this._sources.add(source);
24482448
source = this._sources.indexOf(source);
24492449

2450-
var name = section.consumer._names.at(mapping.name);
2451-
this._names.add(name);
2452-
name = this._names.indexOf(name);
2450+
var name = null;
2451+
if (mapping.name) {
2452+
name = section.consumer._names.at(mapping.name);
2453+
this._names.add(name);
2454+
name = this._names.indexOf(name);
2455+
}
24532456

24542457
// The mappings coming from the consumer for the section have
24552458
// generated positions relative to the start of the section, so we

dist/source-map.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/source-map.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_api.js

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_dog_fooding.js

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_source_map_consumer.js

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_source_map_generator.js

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_source_node.js

Lines changed: 22 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/source-map-consumer.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,9 +1074,12 @@ IndexedSourceMapConsumer.prototype._parseMappings =
10741074
this._sources.add(source);
10751075
source = this._sources.indexOf(source);
10761076

1077-
var name = section.consumer._names.at(mapping.name);
1078-
this._names.add(name);
1079-
name = this._names.indexOf(name);
1077+
var name = null;
1078+
if (mapping.name) {
1079+
name = section.consumer._names.at(mapping.name);
1080+
this._names.add(name);
1081+
name = this._names.indexOf(name);
1082+
}
10801083

10811084
// The mappings coming from the consumer for the section have
10821085
// generated positions relative to the start of the section, so we

0 commit comments

Comments
 (0)