Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec update: ignore repeated slashes in the file scheme #73

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/get-latest-platform-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const request = require("request");
// 3. Copy the commit hash
const commitHash = "3c090ebc321c78a0977e4980c1db707cc6362b93";

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`;
const sourceURL = `https://raw.githubusercontent.com/watilde/web-platform-tests/800055d3ddfcf570bd1cee2e8eca232ac3a402f4/url/urltestdata.json`;
const setterSourceURL = `https://raw.githubusercontent.com/watilde/web-platform-tests/800055d3ddfcf570bd1cee2e8eca232ac3a402f4/url/setters_tests.json`;

const targetDir = path.resolve(__dirname, "..", "test", "web-platform-tests");

Expand Down
24 changes: 16 additions & 8 deletions src/url-state-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,14 +594,15 @@ URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) {
this.buffer = "";
if (this.stateOverride) {
return false;
}
if (this.url.scheme === "file") {
if (this.input[this.pointer + 1] !== p("/") || this.input[this.pointer + 2] !== p("/")) {
this.parseError = true;
}
this.state = "file";
} else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) {
this.state = "special relative or authority";
if (this.url.scheme === "file") {
if (this.input[this.pointer + 1] !== p("/") || this.input[this.pointer + 2] !== p("/")) {
this.parseError = true;
}
this.state = "file";
} else {
this.state = "special relative or authority";
}
} else if (isSpecial(this.url)) {
this.state = "special authority slashes";
} else if (this.input[this.pointer + 1] === p("/")) {
Expand Down Expand Up @@ -749,7 +750,14 @@ URLStateMachine.prototype["parse special authority slashes"] = function parseSpe

URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) {
if (c !== p("/") && c !== p("\\")) {
this.state = "authority";
if (this.url.scheme === "file") {
if (this.input[this.pointer + 1] !== p("/")) {
this.parseError = true;
}
this.state = "file";
} else {
this.state = "authority";
}
--this.pointer;
} else {
this.parseError = true;
Expand Down