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");
14611461class SourceMapConsumer {
14621462 constructor ( aSourceMap , aSourceMapURL ) {
14631463 // 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.
14651466 if ( aSourceMap == INTERNAL ) {
14661467 return Promise . resolve ( this ) ;
14671468 }
@@ -2686,11 +2687,10 @@ function _factory(aSourceMap, aSourceMapURL) {
26862687 sourceMap = util . parseSourceMapInput ( aSourceMap ) ;
26872688 }
26882689
2689- return Promise . resolve ( ) . then ( _ => {
2690- return sourceMap . sections != null
2690+ const consumer = sourceMap . sections != null
26912691 ? new IndexedSourceMapConsumer ( sourceMap , aSourceMapURL )
26922692 : new BasicSourceMapConsumer ( sourceMap , aSourceMapURL ) ;
2693- } ) ;
2693+ return Promise . resolve ( consumer ) ;
26942694}
26952695
26962696function _factoryBSM ( aSourceMap , aSourceMapURL ) {
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ const INTERNAL = Symbol("smcInternal");
1717class SourceMapConsumer {
1818 constructor ( aSourceMap , aSourceMapURL ) {
1919 // 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.
2122 if ( aSourceMap == INTERNAL ) {
2223 return Promise . resolve ( this ) ;
2324 }
@@ -1242,11 +1243,10 @@ function _factory(aSourceMap, aSourceMapURL) {
12421243 sourceMap = util . parseSourceMapInput ( aSourceMap ) ;
12431244 }
12441245
1245- return Promise . resolve ( ) . then ( _ => {
1246- return sourceMap . sections != null
1246+ const consumer = sourceMap . sections != null
12471247 ? new IndexedSourceMapConsumer ( sourceMap , aSourceMapURL )
12481248 : new BasicSourceMapConsumer ( sourceMap , aSourceMapURL ) ;
1249- } ) ;
1249+ return Promise . resolve ( consumer ) ;
12501250}
12511251
12521252function _factoryBSM ( aSourceMap , aSourceMapURL ) {
You can’t perform that action at this time.
0 commit comments