Skip to content

Commit

Permalink
Spec update: fix Windows drive letter handling in the file state
Browse files Browse the repository at this point in the history
  • Loading branch information
rmisev authored and domenic committed May 10, 2017
1 parent 08f7c21 commit 2265e99
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 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

## Current Status

whatwg-url is currently up to date with the URL spec up to commit [488c45](https://github.com/whatwg/url/commit/488c459d9e4245a3f6bf087e7dcd2c7e91487ac5).
whatwg-url is currently up to date with the URL spec up to commit [fe6b25](https://github.com/whatwg/url/commit/fe6b251739e225555f04319f19c70c031a5d99eb).

## API

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 @@ -14,7 +14,7 @@ const request = require("request");
// 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 = "3afae94fd4c945486a165e141a7755aa2a4908a3";
const commitHash = "28541bb338e33fb79bc6bf64330b62fac2eca325";

const sourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/urltestdata.json`;
const setterSourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/setters_tests.json`;
Expand Down
7 changes: 4 additions & 3 deletions src/url-state-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -932,9 +932,10 @@ URLStateMachine.prototype["parse file"] = function parseFile(c) {
this.url.fragment = "";
this.state = "fragment";
} else {
if (!isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) ||
this.input.length - this.pointer - 1 === 1 || // remaining consists of 1 code point
!fileOtherwiseCodePoints.has(this.input[this.pointer + 2])) {
if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points
!isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) ||
(this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points
!fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) {
this.url.host = this.base.host;
this.url.path = this.base.path.slice();
shortenPath(this.url);
Expand Down

0 comments on commit 2265e99

Please sign in to comment.