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
1 change: 0 additions & 1 deletion lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,6 @@ function originFor(url, base) {
case 'https:':
case 'ws:':
case 'wss:':
case 'file':
origin = new TupleOrigin(protocol.slice(0, -1),
url[context].host,
url[context].port,
Expand Down
16 changes: 16 additions & 0 deletions test/parallel/test-whatwg-url-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,19 @@ assert.strictEqual(url.searchParams, oldParams);
assert.strictEqual(opts.search, '?l=24');
assert.strictEqual(opts.hash, '#test');
}

// Test special origins
[
{ expected: 'https://whatwg.org',
Copy link
Member

Choose a reason for hiding this comment

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

I think most tests here are already in url-tests.js, therefore tested by test-whatwg-url-origin?

Copy link
Contributor Author

@mscdex mscdex Mar 5, 2017

Choose a reason for hiding this comment

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

Specifically the file: origin test is not covered by the WPT tests, which would have uncovered the 'bug.' I just added other origin tests for completeness.

url: 'blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f' },
{ expected: 'ftp://example.org', url: 'ftp://example.org/foo' },
{ expected: 'gopher://gopher.quux.org', url: 'gopher://gopher.quux.org/1/' },
{ expected: 'http://example.org', url: 'http://example.org/foo' },
{ expected: 'https://example.org', url: 'https://example.org/foo' },
{ expected: 'ws://example.org', url: 'ws://example.org/foo' },
{ expected: 'wss://example.org', url: 'wss://example.org/foo' },
{ expected: 'null', url: 'file:///tmp/mock/path' },
{ expected: 'null', url: 'npm://nodejs/rules' }
].forEach((test) => {
assert.strictEqual(new URL(test.url).origin, test.expected);
});