File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -352,6 +352,7 @@ export function getEmptySourceTable(): SourceTable {
352352 filename : [ ] ,
353353 startLine : [ ] ,
354354 startColumn : [ ] ,
355+ sourceMapURL : [ ] ,
355356 length : 0 ,
356357 } ;
357358}
Original file line number Diff line number Diff line change @@ -119,7 +119,8 @@ export class GlobalDataCollector {
119119 uuid : string | null ,
120120 filename : string ,
121121 startLine : number = 1 ,
122- startColumn : number = 1
122+ startColumn : number = 1 ,
123+ sourceMapURL : string | null = null
123124 ) : IndexIntoSourceTable {
124125 let index : IndexIntoSourceTable | undefined ;
125126
@@ -134,10 +135,15 @@ export class GlobalDataCollector {
134135 if ( index === undefined ) {
135136 index = this . _sources . length ;
136137 const filenameIndex = this . _stringTable . indexForString ( filename ) ;
138+ const sourceMapURLIndex =
139+ sourceMapURL !== null
140+ ? this . _stringTable . indexForString ( sourceMapURL )
141+ : null ;
137142 this . _sources . uuid [ index ] = uuid ;
138143 this . _sources . filename [ index ] = filenameIndex ;
139144 this . _sources . startLine [ index ] = startLine ;
140145 this . _sources . startColumn [ index ] = startColumn ;
146+ this . _sources . sourceMapURL [ index ] = sourceMapURLIndex ;
141147 this . _sources . length ++ ;
142148
143149 if ( uuid !== null ) {
Original file line number Diff line number Diff line change @@ -560,6 +560,12 @@ function mergeSources(
560560 const originalUrlIndex = sources . filename [ i ] ;
561561 const newUrlIndex = oldStringToNewStringPlusOne [ originalUrlIndex ] - 1 ;
562562
563+ const originalSourceMapURLIndex = sources . sourceMapURL [ i ] ;
564+ const newSourceMapURLIndex =
565+ originalSourceMapURLIndex !== null
566+ ? oldStringToNewStringPlusOne [ originalSourceMapURLIndex ] - 1
567+ : null ;
568+
563569 const sourceKey = uuid ?? `null-uuid-${ newUrlIndex } ` ;
564570 let insertedSourceIndex = mapOfInsertedSources . get ( sourceKey ) ;
565571 if ( insertedSourceIndex === undefined ) {
@@ -569,6 +575,7 @@ function mergeSources(
569575 newSources . filename [ insertedSourceIndex ] = newUrlIndex ;
570576 newSources . startLine [ insertedSourceIndex ] = sources . startLine [ i ] ;
571577 newSources . startColumn [ insertedSourceIndex ] = sources . startColumn [ i ] ;
578+ newSources . sourceMapURL [ insertedSourceIndex ] = newSourceMapURLIndex ;
572579 newSources . length ++ ;
573580 mapOfInsertedSources . set ( sourceKey , insertedSourceIndex ) ;
574581 }
Original file line number Diff line number Diff line change @@ -437,16 +437,20 @@ function _extractJsFunction(
437437 const filenameIndex = geckoSourceTable . schema . filename ;
438438 const startLineIndex = geckoSourceTable . schema . startLine ;
439439 const startColumnIndex = geckoSourceTable . schema . startColumn ;
440+ const sourceMapURLIndex = geckoSourceTable . schema . sourceMapURL ;
440441 const uuid = geckoSourceTable . data [ geckoSourceIdx ] [ uuidIndex ] ;
441442 const filename = geckoSourceTable . data [ geckoSourceIdx ] [ filenameIndex ] ;
442443 const startLine = geckoSourceTable . data [ geckoSourceIdx ] [ startLineIndex ] ;
443444 const startColumn =
444445 geckoSourceTable . data [ geckoSourceIdx ] [ startColumnIndex ] ;
446+ const sourceMapURL =
447+ geckoSourceTable . data [ geckoSourceIdx ] [ sourceMapURLIndex ] ;
445448 processedSourceIndex = globalDataCollector . indexForSource (
446449 uuid ,
447450 filename ,
448451 startLine ,
449- startColumn
452+ startColumn ,
453+ sourceMapURL
450454 ) ;
451455 }
452456 }
Original file line number Diff line number Diff line change @@ -746,6 +746,11 @@ function _gatherReferencesInSources(
746746 }
747747
748748 referencedStrings [ sources . filename [ i ] ] = 1 ;
749+
750+ const sourceMapURL = sources . sourceMapURL [ i ] ;
751+ if ( sourceMapURL !== null ) {
752+ referencedStrings [ sourceMapURL ] = 1 ;
753+ }
749754 }
750755}
751756
@@ -769,6 +774,15 @@ function _createCompactedSources(
769774 newSources . startLine [ newIndex ] = sources . startLine [ i ] ;
770775 newSources . startColumn [ newIndex ] = sources . startColumn [ i ] ;
771776
777+ // Translate the sourceMapURL string index if present.
778+ // The old string indexes are no longer valid since we compacted the
779+ // string array. All the indexes that reference them need to be updated.
780+ const oldSourceMapURLIndex = sources . sourceMapURL [ i ] ;
781+ newSources . sourceMapURL [ newIndex ] =
782+ oldSourceMapURLIndex !== null
783+ ? oldStringToNewStringPlusOne [ oldSourceMapURLIndex ] - 1
784+ : null ;
785+
772786 oldSourceToNewSourcePlusOne [ i ] = newIndex + 1 ;
773787 }
774788
Original file line number Diff line number Diff line change @@ -818,6 +818,7 @@ function _partiallyApplySymbolicationStep(
818818 sources . uuid . push ( null ) ;
819819 sources . startLine . push ( 1 ) ;
820820 sources . startColumn . push ( 1 ) ;
821+ sources . sourceMapURL . push ( null ) ;
821822 sources . length ++ ;
822823 }
823824 funcTable . source [ funcIndex ] = sourceIndex ;
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ export function getEmptySourceTable(): GeckoSourceTable {
5353 filename : 1 as const ,
5454 startLine : 2 as const ,
5555 startColumn : 3 as const ,
56+ sourceMapURL : 4 as const ,
5657 } ,
5758 data : [ ] ,
5859 } ;
Original file line number Diff line number Diff line change @@ -651,7 +651,8 @@ export function addSourceToTable(
651651 urlStringIndex : number ,
652652 uuid : string | null = null ,
653653 startLine : number = 1 ,
654- startColumn : number = 1
654+ startColumn : number = 1 ,
655+ sourceMapURLStringIndex : number | null = null
655656) : number {
656657 // Check if source already exists
657658 for ( let i = 0 ; i < sources . filename . length ; i ++ ) {
@@ -666,6 +667,7 @@ export function addSourceToTable(
666667 sources . uuid . push ( uuid ) ;
667668 sources . startLine . push ( startLine ) ;
668669 sources . startColumn . push ( startColumn ) ;
670+ sources . sourceMapURL . push ( sourceMapURLStringIndex ) ;
669671 sources . length = sources . filename . length ;
670672
671673 return sourceIndex ;
Original file line number Diff line number Diff line change @@ -636,6 +636,7 @@ Object {
636636 " sources" : Object {
637637 " filename" : Array [],
638638 " length" : 0 ,
639+ " sourceMapURL" : Array [],
639640 " startColumn" : Array [],
640641 " startLine" : Array [],
641642 " uuid" : Array [],
@@ -2626,6 +2627,7 @@ CallTree {
26262627 " sources" : Object {
26272628 " filename" : Array [],
26282629 " length" : 0 ,
2630+ " sourceMapURL" : Array [],
26292631 " startColumn" : Array [],
26302632 " startLine" : Array [],
26312633 " uuid" : Array [],
@@ -2976,6 +2978,7 @@ Object {
29762978 " sources" : Object {
29772979 " filename" : Array [],
29782980 " length" : 0 ,
2981+ " sourceMapURL" : Array [],
29792982 " startColumn" : Array [],
29802983 " startLine" : Array [],
29812984 " uuid" : Array [],
@@ -3394,6 +3397,7 @@ Object {
33943397 " sources" : Object {
33953398 " filename" : Array [],
33963399 " length" : 0 ,
3400+ " sourceMapURL" : Array [],
33973401 " startColumn" : Array [],
33983402 " startLine" : Array [],
33993403 " uuid" : Array [],
@@ -3742,6 +3746,7 @@ Object {
37423746 " sources" : Object {
37433747 " filename" : Array [],
37443748 " length" : 0 ,
3749+ " sourceMapURL" : Array [],
37453750 " startColumn" : Array [],
37463751 " startLine" : Array [],
37473752 " uuid" : Array [],
@@ -4090,6 +4095,7 @@ Object {
40904095 " sources" : Object {
40914096 " filename" : Array [],
40924097 " length" : 0 ,
4098+ " sourceMapURL" : Array [],
40934099 " startColumn" : Array [],
40944100 " startLine" : Array [],
40954101 " uuid" : Array [],
You can’t perform that action at this time.
0 commit comments