source-map
Advanced tools
Comparing version 0.1.23 to 0.1.24
# Change Log | ||
## 0.1.24 | ||
* Fix issue with absolute paths and `file://` URIs. See | ||
https://bugzilla.mozilla.org/show_bug.cgi?id=885597 | ||
## 0.1.23 | ||
* Fix issue with absolute paths and sourcesContent, github issue 64. | ||
## 0.1.22 | ||
@@ -4,0 +13,0 @@ |
@@ -301,5 +301,5 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
/** | ||
* Returns the original source content. The only argument is | ||
* the url of the original source file. Returns null if no | ||
* original source content is availible. | ||
* Returns the original source content. The only argument is the url of the | ||
* original source file. Returns null if no original source content is | ||
* availible. | ||
*/ | ||
@@ -322,6 +322,17 @@ SourceMapConsumer.prototype.sourceContentFor = | ||
if (this.sourceRoot | ||
&& (url = util.urlParse(this.sourceRoot)) | ||
&& (!url.path || url.path == "/") | ||
&& this._sources.has("/" + aSource)) { | ||
return this.sourcesContent[this._sources.indexOf("/" + aSource)]; | ||
&& (url = util.urlParse(this.sourceRoot))) { | ||
// XXX: file:// URIs and absolute paths lead to unexpected behavior for | ||
// many users. We can help them out when they expect file:// URIs to | ||
// behave like it would if they were running a local HTTP server. See | ||
// https://bugzilla.mozilla.org/show_bug.cgi?id=885597. | ||
var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); | ||
if (url.scheme == "file" | ||
&& this._sources.has(fileUriAbsPath)) { | ||
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] | ||
} | ||
if ((!url.path || url.path == "/") | ||
&& this._sources.has("/" + aSource)) { | ||
return this.sourcesContent[this._sources.indexOf("/" + aSource)]; | ||
} | ||
} | ||
@@ -328,0 +339,0 @@ |
@@ -287,3 +287,3 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
// The mappings must be guarenteed to be in sorted order before we start | ||
// The mappings must be guaranteed to be in sorted order before we start | ||
// serializing them or else the generated line numbers (which are defined | ||
@@ -290,0 +290,0 @@ // via the ';' separators) will be all messed up. Note: it might be more |
{ | ||
"name": "source-map", | ||
"description": "Generates and consumes source maps", | ||
"version": "0.1.23", | ||
"version": "0.1.24", | ||
"homepage": "https://github.com/mozilla/source-map", | ||
@@ -6,0 +6,0 @@ "author": "Nick Fitzgerald <nfitzgerald@mozilla.com>", |
@@ -306,2 +306,17 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
exports['test bug 885597'] = function (assert, util) { | ||
var map = new SourceMapConsumer({ | ||
"version": 3, | ||
"file": "foo.js", | ||
"sourceRoot": "file:///Users/AlGore/Invented/The/Internet/", | ||
"sources": ["/a"], | ||
"names": [], | ||
"mappings": "AACA", | ||
"sourcesContent": ["foo"] | ||
}); | ||
var s = map.sources[0]; | ||
assert.equal(map.sourceContentFor(s), "foo"); | ||
}; | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132509
3155