diff --git a/README.md b/README.md index 86e4ff921..99e3b06a5 100644 --- a/README.md +++ b/README.md @@ -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 [83adf0c](https://github.com/whatwg/url/commit/83adf0c9ca9a88948e1e5d93374ffded04eec727). +whatwg-url is currently up to date with the URL spec up to commit [47efa00](https://github.com/whatwg/url/commit/47efa0043d677fb51169cde72b60703bd8de83e3). 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"`). diff --git a/scripts/get-latest-platform-tests.js b/scripts/get-latest-platform-tests.js index cdbad1567..55d42f266 100644 --- a/scripts/get-latest-platform-tests.js +++ b/scripts/get-latest-platform-tests.js @@ -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 = "551c9d604fb8b97d3f8c65793bb047d15baddbc2"; +const commitHash = "11a6ab8df5f84d40d8818afe8773dd519e5263e4"; const urlPrefix = `https://raw.githubusercontent.com/web-platform-tests/wpt/${commitHash}/url/`; const targetDir = path.resolve(__dirname, "..", "test", "web-platform-tests"); diff --git a/src/url-state-machine.js b/src/url-state-machine.js index 21976d666..2e06e2421 100644 --- a/src/url-state-machine.js +++ b/src/url-state-machine.js @@ -867,7 +867,6 @@ URLStateMachine.prototype["parse file"] = function parseFile(c) { shortenPath(this.url); } else { this.parseError = true; - this.url.host = null; this.url.path = []; } @@ -889,13 +888,12 @@ URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { } this.state = "file host"; } else { - if (this.base !== null && this.base.scheme === "file" && - !startsWithWindowsDriveLetter(this.input, this.pointer)) { - if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { + if (this.base !== null && this.base.scheme === "file") { + if (!startsWithWindowsDriveLetter(this.input, this.pointer) && + isNormalizedWindowsDriveLetterString(this.base.path[0])) { this.url.path.push(this.base.path[0]); - } else { - this.url.host = this.base.host; } + this.url.host = this.base.host; } this.state = "path"; --this.pointer; @@ -983,21 +981,11 @@ URLStateMachine.prototype["parse path"] = function parsePath(c) { this.url.path.push(""); } else if (!isSingleDot(this.buffer)) { if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { - if (this.url.host !== "" && this.url.host !== null) { - this.parseError = true; - this.url.host = ""; - } this.buffer = this.buffer[0] + ":"; } this.url.path.push(this.buffer); } this.buffer = ""; - if (this.url.scheme === "file" && (c === undefined || c === p("?") || c === p("#"))) { - while (this.url.path.length > 1 && this.url.path[0] === "") { - this.parseError = true; - this.url.path.shift(); - } - } if (c === p("?")) { this.url.query = ""; this.state = "query";