mozilla/source-map — pull request #124 by lydell (2014-07-09 10:29:57+00:00)
Title: Fix #123: Empty string as sourceRoot

Setting the `sourceRoot` property of a source-map to the empty string
incorrectly made relative sources absolute, due to a bug in `util.join`.
Now, setting the `sourceRoot` to the empty string is equivalent to
setting it to `.`, which in turn is equivalent to omitting the property
altogether.

This commit fixes the handling of empty strings in `util.join`, and adds
test cases for it. Since `util.normalize` and `util.urlParse` are used
by `util.join` they got a couple of new tests as well. Finally, all code
that uses `util.join` had their tests updated to test for empty strings
as well.

Note that this commit might not solve _all_ bugs related to the
`sourceRoot` being an empty string, since `sourceRoot` is often also
used together with `util.relative`. However, fixing that is a different
issue. I added TODO comments and a few initial tests, though, so it
won’t be forgotten.