File tree 3 files changed +10
-8
lines changed
3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -522,12 +522,15 @@ class BasicSourceMapConsumer extends SourceMapConsumer {
522
522
523
523
/**
524
524
* Returns the original source content. The only argument is the url of the
525
- * original source file. Returns null if no original source content is
526
- * available.
525
+ * original source file.
527
526
*/
528
527
sourceContentFor ( aSource , nullOnMissing ) {
529
528
if ( ! this . sourcesContent ) {
530
- return null ;
529
+ if ( nullOnMissing ) {
530
+ return null ;
531
+ }
532
+
533
+ throw new Error ( '"' + aSource + '" is not in the SourceMap.' ) ;
531
534
}
532
535
533
536
const index = this . _findSourceIndex ( aSource ) ;
@@ -822,8 +825,7 @@ class IndexedSourceMapConsumer extends SourceMapConsumer {
822
825
823
826
/**
824
827
* Returns the original source content. The only argument is the url of the
825
- * original source file. Returns null if no original source content is
826
- * available.
828
+ * original source file.
827
829
*/
828
830
sourceContentFor ( aSource , nullOnMissing ) {
829
831
for ( let i = 0 ; i < this . _sections . length ; i ++ ) {
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ class SourceMapGenerator {
79
79
generator . _sources . add ( sourceRelative ) ;
80
80
}
81
81
82
- const content = aSourceMapConsumer . sourceContentFor ( sourceFile ) ;
82
+ const content = aSourceMapConsumer . sourceContentFor ( sourceFile , true ) ;
83
83
if ( content != null ) {
84
84
generator . setSourceContent ( sourceFile , content ) ;
85
85
}
@@ -238,7 +238,7 @@ class SourceMapGenerator {
238
238
239
239
// Copy sourcesContents of applied map.
240
240
aSourceMapConsumer . sources . forEach ( function ( srcFile ) {
241
- const content = aSourceMapConsumer . sourceContentFor ( srcFile ) ;
241
+ const content = aSourceMapConsumer . sourceContentFor ( srcFile , true ) ;
242
242
if ( content != null ) {
243
243
if ( aSourceMapPath != null ) {
244
244
srcFile = util . join ( aSourceMapPath , srcFile ) ;
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ class SourceNode {
137
137
138
138
// Copy sourcesContent into SourceNode
139
139
aSourceMapConsumer . sources . forEach ( function ( sourceFile ) {
140
- const content = aSourceMapConsumer . sourceContentFor ( sourceFile ) ;
140
+ const content = aSourceMapConsumer . sourceContentFor ( sourceFile , true ) ;
141
141
if ( content != null ) {
142
142
if ( aRelativePath != null ) {
143
143
sourceFile = util . join ( aRelativePath , sourceFile ) ;
You can’t perform that action at this time.
0 commit comments