Re: [whatwg/url] "Let pointer be a pointer to first code point in..." (#373)

Step 11 in specification:
> 11. Keep running the following state machine by switching on _state_. (1) If after a run _pointer_ points to the EOF code point, go to the next step. (2) Otherwise, increase _pointer_ by one and continue with the state machine.

>From @mattto's https://github.com/whatwg/url/issues/373#issuecomment-365446966:
> ... Now the state machine step is over, (2) so increase pointer by one and continue. (1) pointer is again pointing to EOF, so the state machine is done.

The (1) and (2) operations here are in different order than in spec, so result is incorrect.

If follow specification, then after (2) operation we enter the "no scheme state":
> ... set _state_ to relative state and decrease _pointer_ by one.

Then we enter the "relative state", and `c` is **EOF**:
> Set url’s scheme to base’s scheme, and then, switching on `c`: 
> - **The EOF code point** 
> Set url’s username to base’s username, url’s password to base’s password, url’s host to base’s host, url’s port to base’s port, url’s path to a copy of base’s path, and url’s query to base’s query.

Now the _pointer_ isn't decreased, so it points to EOF and the state machine is done after (1) operation. The result is as specified in @annevk's https://github.com/whatwg/url/issues/373#issuecomment-366498774.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/373#issuecomment-378021273

Received on Monday, 2 April 2018 19:39:16 UTC