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 committed Mar 14, 2017
1 parent 0a1403b commit af113e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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 = "e8aa61d80e3971489ace4355ee970d30c09b615e";
const commitHash = "17966a23f1a561e5e0cd86232b3655c47240c9d5";

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
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 af113e8

Please sign in to comment.