Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dist/source-map.debug.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/source-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
exports.getArg = getArg;

var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(\S*)$/;
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
var dataUrlRegexp = /^data:.+\,.+$/;

function urlParse(aUrl) {
Expand Down Expand Up @@ -902,7 +902,7 @@ return /******/ (function(modules) { // webpackBootstrap
exports.join = join;

exports.isAbsolute = function (aPath) {
return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion dist/source-map.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/source-map.min.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/test/test_api.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/test/test_array_set.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/test/test_dog_fooding.js

Large diffs are not rendered by default.

21 changes: 18 additions & 3 deletions dist/test/test_source_map_consumer.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/test/test_source_map_generator.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/test/test_source_node.js

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions dist/test/test_util.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function getArg(aArgs, aName, aDefaultValue) {
}
exports.getArg = getArg;

var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(\S*)$/;
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While reviewing, I realized that in isAbsolute, you should use urlRegexp.test(aPath) instead of aPath.match(urlRegexp) because you don't need the matches, so it should be faster. You can do it in this patch or in another patch if you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this change causes many regressions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... because I wrote it incorrectly.

var dataUrlRegexp = /^data:.+\,.+$/;

function urlParse(aUrl) {
Expand Down Expand Up @@ -182,7 +182,7 @@ function join(aRoot, aPath) {
exports.join = join;

exports.isAbsolute = function (aPath) {
return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
};

/**
Expand Down
15 changes: 15 additions & 0 deletions test/test-source-map-consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1134,3 +1134,18 @@ exports['test non-normalized sourceRoot (from issue #227)'] = function (assert)
// Before the fix, this threw an exception.
consumer.sourceContentFor(consumer.sources[0]);
};

exports['test webpack URL resolution'] = function (assert) {
var map = {
version: 3,
sources: ["webpack:///webpack/bootstrap 67e184f9679733298d44"],
names: [],
mappings: "CAAS",
file: "static/js/manifest.b7cf97680f7a50fa150f.js",
sourceRoot: ""
};
var consumer = new SourceMapConsumer(map);

assert.equal(consumer.sources.length, 1);
assert.equal(consumer.sources[0], "webpack:///webpack/bootstrap 67e184f9679733298d44");
};
7 changes: 7 additions & 0 deletions test/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ exports['test urls'] = function (assert) {
assert.equal(parsed.scheme, 'http');
assert.equal(parsed.host, 'x-y.com');
assert.equal(parsed.path, '/bar');

var webpackURL = 'webpack:///webpack/bootstrap 67e184f9679733298d44'
parsed = libUtil.urlParse(webpackURL);
assert.equal(parsed.scheme, 'webpack');
assert.equal(parsed.host, '');
assert.equal(parsed.path, '/webpack/bootstrap 67e184f9679733298d44');
assert.equal(webpackURL, libUtil.urlGenerate(parsed));
};

exports['test normalize()'] = function (assert) {
Expand Down