File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Expand file tree Collapse file tree 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 {
522522
523523 /**
524524 * 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.
527526 */
528527 sourceContentFor ( aSource , nullOnMissing ) {
529528 if ( ! this . sourcesContent ) {
530- return null ;
529+ if ( nullOnMissing ) {
530+ return null ;
531+ }
532+
533+ throw new Error ( '"' + aSource + '" is not in the SourceMap.' ) ;
531534 }
532535
533536 const index = this . _findSourceIndex ( aSource ) ;
@@ -822,8 +825,7 @@ class IndexedSourceMapConsumer extends SourceMapConsumer {
822825
823826 /**
824827 * 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.
827829 */
828830 sourceContentFor ( aSource , nullOnMissing ) {
829831 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 {
7979 generator . _sources . add ( sourceRelative ) ;
8080 }
8181
82- const content = aSourceMapConsumer . sourceContentFor ( sourceFile ) ;
82+ const content = aSourceMapConsumer . sourceContentFor ( sourceFile , true ) ;
8383 if ( content != null ) {
8484 generator . setSourceContent ( sourceFile , content ) ;
8585 }
@@ -238,7 +238,7 @@ class SourceMapGenerator {
238238
239239 // Copy sourcesContents of applied map.
240240 aSourceMapConsumer . sources . forEach ( function ( srcFile ) {
241- const content = aSourceMapConsumer . sourceContentFor ( srcFile ) ;
241+ const content = aSourceMapConsumer . sourceContentFor ( srcFile , true ) ;
242242 if ( content != null ) {
243243 if ( aSourceMapPath != null ) {
244244 srcFile = util . join ( aSourceMapPath , srcFile ) ;
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ class SourceNode {
137137
138138 // Copy sourcesContent into SourceNode
139139 aSourceMapConsumer . sources . forEach ( function ( sourceFile ) {
140- const content = aSourceMapConsumer . sourceContentFor ( sourceFile ) ;
140+ const content = aSourceMapConsumer . sourceContentFor ( sourceFile , true ) ;
141141 if ( content != null ) {
142142 if ( aRelativePath != null ) {
143143 sourceFile = util . join ( aRelativePath , sourceFile ) ;
You can’t perform that action at this time.
0 commit comments