You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SourceMapGenerator.prototype.applySourceMap generates incorrect source map when source map to apply contains name entries in a filename not found in the source map to apply to.
#181
Closed
insidewhy opened this issue
May 3, 2015
· 3 comments
Say there's two SourceMapConsumers, M1 and M2, M2 has file = F1 and many name entries.
If each of the name entries in M2 is also found in the file F1 within M1 then you can apply M2 on top of M1 just fine.
However if any of the name entries within M2 don't have a corresponding name entry within M1 under F1 then the entries (relating to the names from F1) in the source map resulting from the application will be incorrect. If M1 doesn't even have any F1 entries then the resulting source map will contain entries pointing to F1 when F1 shouldn't even exist within the source map!
I guess it's necessary to detect names that don't exist in the destination map and remove them from the resulting source map, using the identifier locations instead.
The text was updated successfully, but these errors were encountered:
insidewhy
changed the title
SourceMapGenerator.prototype.applySourceMap does not work when source map to apply has "name" entries not found in file with same name.
SourceMapGenerator.prototype.applySourceMap generates incorrect source map when source map to apply contains name entries in a filename not found in the source map to apply to.
May 3, 2015
Thanks, hm that looks like the case I'm describing.
I have a case here where applying a source map M1 for file F3 containing source files F1 and F2 onto another M2 with file F3 leads to a map M3 with file F3 and sources F1, F2 and F3. In the resulting source map I have a source entry for F3 that shouldn't be there. The only way this test differs from those that works is that F3 doesn't exist as a source in the source map and that M2 contains names in F3.
The F3 entries are fine... they just represent lines that have no mapping in the original source file, I thought the source maps were off due to that bug screwing with stack traces of uglified code on line 1.
Say there's two SourceMapConsumers,
M1
andM2
,M2
hasfile
=F1
and many name entries.If each of the name entries in
M2
is also found in the fileF1
withinM1
then you can applyM2
on top ofM1
just fine.However if any of the
name
entries withinM2
don't have a corresponding name entry withinM1
underF1
then the entries (relating to the names fromF1
) in the source map resulting from the application will be incorrect. IfM1
doesn't even have anyF1
entries then the resulting source map will contain entries pointing toF1
whenF1
shouldn't even exist within the source map!I guess it's necessary to detect names that don't exist in the destination map and remove them from the resulting source map, using the identifier locations instead.
The text was updated successfully, but these errors were encountered: