url: update the processing in the scheme state.#11887
url: update the processing in the scheme state.#11887watilde wants to merge 2 commits intonodejs:masterfrom
Conversation
|
cc @nodejs/url |
|
The returning is handled in the JS layer. You might want to update that instead. |
|
Oh that's nice. I will update the commit then! |
af99bab to
1edd461
Compare
|
@TimothyGu I've updated the commits to handling it in JS layer. Well, I'm not sure those steps should be handled in the scheme state or not, but at least the spec expects it as scheme state checking. What are your thoughts on? |
lib/internal/url.js
Outdated
There was a problem hiding this comment.
port can only be >= 0 or undefined, since the C++ layer sets port to undefined if it is -1, and you should probably check ctx.username and ctx.password instead of username and password since IIRC the C++ layer doesn't pass those into the callback if it's unneeded.
There was a problem hiding this comment.
That's right! I will update it. Thanks 😺
1edd461 to
6ccf827
Compare
lib/internal/url.js
Outdated
There was a problem hiding this comment.
nit: stylistically it's more common to write it as:
if (protocol === 'file:' &&
(ctx.username || ctx.password || ctx.port !== undefined)) {Since file URLs can not have `username/password/port`, the specification was updated to restrict setting protocol to "file". Refs: whatwg/url#269 Fixes: nodejs#11785
Synchronize url-setter-test to upstream. Refs: web-platform-tests/wpt#5112
6ccf827 to
18eebe9
Compare
joyeecheung
left a comment
There was a problem hiding this comment.
If there are test cases that don't pass at the moment, you can change url-setter-tests.json to a js file with module.exports, then put those test cases in that file and comment them out, like what https://github.com/nodejs/node/blob/master/test/fixtures/url-tests.js does
|
@joyeecheung that's nice! I will sync the setter url fixture in my next patch, will rename the file at the same time then :) |
Since file URLs can not have `username/password/port`, the specification was updated to restrict setting protocol to "file". Refs: whatwg/url#269 Fixes: #11785 PR-URL: #11887 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Synchronize url-setter-test to upstream. Refs: web-platform-tests/wpt#5112 PR-URL: #11887 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Since file URLs can not have `username/password/port`, the specification was updated to restrict setting protocol to "file". Refs: whatwg/url#269 Fixes: nodejs#11785 PR-URL: nodejs#11887 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Synchronize url-setter-test to upstream. Refs: web-platform-tests/wpt#5112 PR-URL: nodejs#11887 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Since file URLs can not have `username/password/port`, the specification was updated to restrict setting protocol to "file". Refs: whatwg/url#269 Fixes: #11785 PR-URL: #11887 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Synchronize url-setter-test to upstream. Refs: web-platform-tests/wpt#5112 PR-URL: #11887 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Updates: + Bring tests url-setter-tests from WPT, and put it as JavaScript + Comment out unpassed tests Refs: web-platform-tests/wpt#5112 Refs: nodejs#11887
Refs: web-platform-tests/wpt#4586 Refs: #11887 PR-URL: #12058 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Updates: + Bring tests url-setter-tests from WPT, and put it as JavaScript + Comment out unpassed tests Refs: web-platform-tests/wpt#5112 Refs: #11887 PR-URL: #12058 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Updates: + Bring tests url-setter-tests from WPT, and put it as JavaScript + Comment out unpassed tests Refs: web-platform-tests/wpt#5112 Refs: nodejs#11887 PR-URL: nodejs#12058 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
PR-URL: nodejs#12507 Refs: web-platform-tests/wpt#4586 Refs: nodejs#11887 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #12507 Refs: web-platform-tests/wpt#4586 Refs: #11887 Reviewed-By: James M Snell <jasnell@gmail.com>
Fix #11785. I've updated the processing in the scheme state to follow the specification and synchronized
url-setter-testswith upstream.https://github.com/whatwg/url/blob/a8ed8d2aefeec1e742490d08844c3d91a87e77fb/url.bs#L1493-L1508
While I was testing added tests, I noticed that the current state machine of Node.js doesn't parse URL correctly for
pathname. For example:So I got rid of the following test for this time.
{ "href": "ssh://example.net", "new_value": "file", "expected": { "href": "ssh://example.net", "protocol": "ssh:" } },I will work on it later.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
url, test