File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -1461,7 +1461,8 @@ const INTERNAL = Symbol("smcInternal");
1461
1461
class SourceMapConsumer {
1462
1462
constructor ( aSourceMap , aSourceMapURL ) {
1463
1463
// If the constructor was called by super(), just return Promise<this>.
1464
- // Yes, this is a hack to retain the pre-existing API.
1464
+ // Yes, this is a hack to retain the pre-existing API of the base-class
1465
+ // constructor also being an async factory function.
1465
1466
if ( aSourceMap == INTERNAL ) {
1466
1467
return Promise . resolve ( this ) ;
1467
1468
}
@@ -2686,11 +2687,10 @@ function _factory(aSourceMap, aSourceMapURL) {
2686
2687
sourceMap = util . parseSourceMapInput ( aSourceMap ) ;
2687
2688
}
2688
2689
2689
- return Promise . resolve ( ) . then ( _ => {
2690
- return sourceMap . sections != null
2690
+ const consumer = sourceMap . sections != null
2691
2691
? new IndexedSourceMapConsumer ( sourceMap , aSourceMapURL )
2692
2692
: new BasicSourceMapConsumer ( sourceMap , aSourceMapURL ) ;
2693
- } ) ;
2693
+ return Promise . resolve ( consumer ) ;
2694
2694
}
2695
2695
2696
2696
function _factoryBSM ( aSourceMap , aSourceMapURL ) {
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ const INTERNAL = Symbol("smcInternal");
17
17
class SourceMapConsumer {
18
18
constructor ( aSourceMap , aSourceMapURL ) {
19
19
// If the constructor was called by super(), just return Promise<this>.
20
- // Yes, this is a hack to retain the pre-existing API.
20
+ // Yes, this is a hack to retain the pre-existing API of the base-class
21
+ // constructor also being an async factory function.
21
22
if ( aSourceMap == INTERNAL ) {
22
23
return Promise . resolve ( this ) ;
23
24
}
@@ -1242,11 +1243,10 @@ function _factory(aSourceMap, aSourceMapURL) {
1242
1243
sourceMap = util . parseSourceMapInput ( aSourceMap ) ;
1243
1244
}
1244
1245
1245
- return Promise . resolve ( ) . then ( _ => {
1246
- return sourceMap . sections != null
1246
+ const consumer = sourceMap . sections != null
1247
1247
? new IndexedSourceMapConsumer ( sourceMap , aSourceMapURL )
1248
1248
: new BasicSourceMapConsumer ( sourceMap , aSourceMapURL ) ;
1249
- } ) ;
1249
+ return Promise . resolve ( consumer ) ;
1250
1250
}
1251
1251
1252
1252
function _factoryBSM ( aSourceMap , aSourceMapURL ) {
You can’t perform that action at this time.
0 commit comments