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: change path parsing for non-special URLs #70

Merged
merged 3 commits into from
Jan 31, 2017

Conversation

domenic
Copy link
Member

@domenic domenic commented Jan 24, 2017

Follows whatwg/url#213.

Waiting on tests in web-platform-tests/wpt#4586 to get rebased.

if (c === p("\\")) {
this.parseError = true;
} else if (c === p("/")) {
this.state = "special authority ignore slashes";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really match the proposed standard change.

@annevk
Copy link
Contributor

annevk commented Jan 27, 2017

Patch for that:

diff --git a/scripts/get-latest-platform-tests.js b/scripts/get-latest-platform-tests.js
index f43b2b4..e045632 100644
--- a/scripts/get-latest-platform-tests.js
+++ b/scripts/get-latest-platform-tests.js
@@ -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 = "825b63235d43b95a12b4a174e3f8243bd990e741";
+const commitHash = "4ea8eae2fd807ffd22e84f3c2f2ca12f798f8206";
 
 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`;
diff --git a/src/url-state-machine.js b/src/url-state-machine.js
index ce46d69..85bad9c 100644
--- a/src/url-state-machine.js
+++ b/src/url-state-machine.js
@@ -706,9 +706,10 @@ URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(
   if (isSpecial(this.url) && (c === p("/") || c === p("\\"))) {
     if (c === p("\\")) {
       this.parseError = true;
-    } else if (c === p("/")) {
-      this.state = "special authority ignore slashes";
     }
+    this.state = "special authority ignore slashes";
+  } else if (c === p("/")) {
+    this.state = "authority";
   } else {
     this.url.username = this.base.username;
     this.url.password = this.base.password;

@domenic domenic merged commit 9ec5618 into master Jan 31, 2017
@domenic domenic deleted the spec-update-213 branch January 31, 2017 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants