Skip to content

Commit

Permalink
Spec update: make non-special URLs idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk authored Aug 24, 2020
1 parent 6c4ef80 commit 44e6a47
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ whatwg-url is a full implementation of the WHATWG [URL Standard](https://url.spe

## Specification conformance

whatwg-url is currently up to date with the URL spec up to commit [975614e](https://github.com/whatwg/url/commit/975614edeee28628298d39af174e9a276366de4f).
whatwg-url is currently up to date with the URL spec up to commit [83adf0c](https://github.com/whatwg/url/commit/83adf0c9ca9a88948e1e5d93374ffded04eec727).

For `file:` URLs, whose [origin is left unspecified](https://url.spec.whatwg.org/#concept-url-origin), whatwg-url chooses to use a new opaque origin (which serializes to `"null"`).

Expand Down
2 changes: 1 addition & 1 deletion scripts/get-latest-platform-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ process.on("unhandledRejection", err => {
// 1. Go to https://github.com/w3c/web-platform-tests/tree/master/url
// 2. Press "y" on your keyboard to get a permalink
// 3. Copy the commit hash
const commitHash = "6c74b7e43c9a1f6dc3dc529e427e2ef96152409e";
const commitHash = "551c9d604fb8b97d3f8c65793bb047d15baddbc2";

const urlPrefix = `https://raw.githubusercontent.com/web-platform-tests/wpt/${commitHash}/url/`;
const targetDir = path.resolve(__dirname, "..", "test", "web-platform-tests");
Expand Down
7 changes: 5 additions & 2 deletions src/url-state-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1113,8 +1113,11 @@ function serializeURL(url, excludeFragment) {
if (url.cannotBeABaseURL) {
output += url.path[0];
} else {
for (const string of url.path) {
output += "/" + string;
if (url.host === null && url.path.length > 1 && url.path[0] === "") {
output += "/.";
}
for (const segment of url.path) {
output += "/" + segment;
}
}

Expand Down

0 comments on commit 44e6a47

Please sign in to comment.