Skip to content

Conversation

@joyeecheung
Copy link
Member

@joyeecheungjoyeecheung commented Dec 1, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test, url

Description of change

Check if the originFor implementation for WHATWG url parsing is correnct.

Right now this test fails because the implementation is still a WIP.

I believe the API for url.URL.originFor needs changes too. Right now it only takes the url as the only argument, and pass it to the URL constructor if that's a string, but the constructor actually takes two arguments: the url and the base. I put the base as the second argument here since that would not break the test even if the implementation is correct for urls without bases.

cc @jasnell

EDIT: I've fixed the implementation too. This indeed need a base as argument. So now this PR:

  • Adds tests to check if the originFor implementation for WHATWG url parsing is correnct.
  • Fixes originFor by including a base as argument

@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label Dec 1, 2016
@imyllerimyller added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Dec 1, 2016
@joyeecheungjoyeecheungforce-pushed the test-for-url-origin-for branch from d636ce0 to 4d17f6dCompareDecember 1, 2016 17:43
@mscdexmscdex added the url Issues and PRs related to the legacy built-in url module. label Dec 3, 2016
@jasnell
Copy link
Member

Thank you for this @joyeecheung ... the test is currently failing on master so I think there's an issue to resolve in the URL implementation. I will investigate but it will take a bit of time.

@jasnelljasnell self-assigned this Dec 5, 2016
@addaleax
Copy link
Member

@joyeecheung If you want to, you can probably start digging into this yourself :)

@joyeecheung
Copy link
MemberAuthor

@addaleax Yeah looks like he is pretty busy at the moment. @jasnell Mind if I have a try at this?

@joyeecheungjoyeecheungforce-pushed the test-for-url-origin-for branch from 4d17f6d to 1c37063CompareDecember 8, 2016 01:51
@jasnell
Copy link
Member

go for it! :-)

@joyeecheungjoyeecheung changed the title test: add test for WHATWG url originForurl, test: WHATWG url originFor should include a base as argumentDec 8, 2016
- Add tests to check if the `originFor` implementation for WHATWG url parsing is correnct. - Fix `originFor` by including a base as argument
@joyeecheungjoyeecheungforce-pushed the test-for-url-origin-for branch from 1c37063 to 9c76d3dCompareDecember 8, 2016 01:58
@joyeecheung
Copy link
MemberAuthor

I've managed to fix the implementation(simply adding base as second argument to originFor). Also updated the test because it didn't include unicode serialization and failed the test cases with IDN hosts.

The fix is pushed into this PR too. Can you take a look? @jasnell

@addaleax
Copy link
Member

@joyeecheung
Copy link
MemberAuthor

Also I'm not sure about the TupleOrigin#toString(unicode = false). Looking at this I think the default should be true. Firefox behaves this way(ref), but Chrome doesn't at the moment.

@joyeecheung
Copy link
MemberAuthor

The failed check looks like a unrelated build failure. Can I have another one?

@lpinca
Copy link
Member

@italoacasas
Copy link

CI is green, before we land, is this semver minor?

@jasnell
Copy link
Member

jasnell commented Dec 12, 2016 via email

@italoacasas
Copy link

Landed a84017a

Thanks for the contribution.

italoacasas pushed a commit that referenced this pull request Dec 12, 2016
- Add tests to check if the `originFor` implementation for WHATWG url parsing is correnct. - Fix `originFor` by including a base as argument PR-URL: #10021 Reviewed-By: James M Snell <[email protected]>
Fishrock123 pushed a commit that referenced this pull request Dec 13, 2016
- Add tests to check if the `originFor` implementation for WHATWG url parsing is correnct. - Fix `originFor` by including a base as argument PR-URL: #10021 Reviewed-By: James M Snell <[email protected]>
@italoacasasitaloacasas mentioned this pull request Dec 15, 2016
italoacasas pushed a commit that referenced this pull request Dec 15, 2016
Notable changes: - buffer: - fix single-character string filling (Anna Henningsen) #9837 - handle UCS2.fill() properly on BE (Anna Henningsen) #9837 - url: - including base argument in originFor (joyeecheung) #10021 - improve URLSearchParams spec compliance (Timothy Gu) #9484 - http: - remove stale timeout listeners (Karl Böhlmark) #9440 - build: - fix node_g target (Daniel Bevenius) #10153 PR-URL: #10277
italoacasas pushed a commit that referenced this pull request Dec 15, 2016
Notable changes SEMVER-MINOR - url: - add inspect function to TupleOrigin (Safia Abdalla) #10039 - crypto: - allow adding extra certs to well-known CAs (Sam Roberts) #9139 SEMVER-PATCH - buffer: - fix single-character string filling (Anna Henningsen) #9837 - handle UCS2 .fill() properly on BE (Anna Henningsen) #9837 - url: - including base argument in originFor (joyeecheung) #10021 - improve URLSearchParams spec compliance (Timothy Gu) #9484 - http: - remove stale timeout listeners (Karl Böhlmark) #9440 - build: - fix node_g target (Daniel Bevenius) #10153 - fs: - remove unused argument from copyObject() (Ethan Arrowood) #10041 - timers: - fix handling of cleared immediates (hveldstra) #9759 PR-URL: #10277
italoacasas pushed a commit that referenced this pull request Dec 17, 2016
Notable changes: * **crypto**: - Allow adding extra certificates to well-known CAs. (Sam Roberts) [#9139](#9139) * **buffer**: - Fix single-character string filling. (Anna Henningsen) [#9837](#9837) - Handle UCS2 `.fill()` properly on BE. (Anna Henningsen) [#9837](#9837) * **url**: - Add inspect function to TupleOrigin. (Safia Abdalla) [#10039](#10039) - Including base argument in originFor. (joyeecheung) [#10021](#10021) - Improve URLSearchParams spec compliance. (Timothy Gu) [#9484](#9484) * **http**: - Remove stale timeout listeners. (Karl Böhlmark) [#9440](#9440) * **build**: - Fix node_g target. (Daniel Bevenius) [#10153](#10153) * **fs**: - Remove unused argument from copyObject(). (EthanArrowood) [#10041](#10041) * **timers**: - Fix handling of cleared immediates. (hveldstra) [#9759](#9759) * **src**: - Add wrapper for process.emitWarning(). (SamRoberts) [#9139](#9139) - Fix string format mistake for 32 bit node.(Alex Newman) [#10082](#10082)
italoacasas pushed a commit that referenced this pull request Dec 19, 2016
Notable changes: * **crypto**: The built-in list of Well-Known CAs (Certificate Authorities) can now be extended via a NODE_EXTRA_CA_CERTS environment variable. (Sam Roberts) [#9139](#9139) * **buffer**: buffer.fill() now works properly for the UCS2 encoding on Big-Endian machines. (Anna Henningsen) [#9837](#9837) * **url**: - Including base argument in URL.originFor() to meet specification compliance. (joyeecheung) [#10021](#10021) - Improve URLSearchParams to meet specification compliance. (Timothy Gu) [#9484](#9484) * **http**: Remove stale timeout listeners in order to prevent a memory leak when using keep alive. (Karl Böhlmark) [#9440](#9440)
cjihrig added a commit to cjihrig/node that referenced this pull request Dec 20, 2016
Notable changes: * buffer: - buffer.fill() now works properly for the UCS2 encoding on Big-Endian machines. (Anna Henningsen) nodejs#9837 * cluster: - disconnect() now returns a reference to the disconnected worker. (Sean Villars) nodejs#10019 * crypto: - The built-in list of Well-Known CAs (Certificate Authorities) can now be extended via a NODE_EXTRA_CA_CERTS environment variable. (Sam Roberts) nodejs#9139 * http: - Remove stale timeout listeners in order to prevent a memory leak when using keep alive. (Karl Böhlmark) nodejs#9440 * tls: - Allow obvious key/passphrase combinations. (Sam Roberts) nodejs#10294 * url: - Including base argument in URL.originFor() to meet specification compliance. (joyeecheung) nodejs#10021 - Improve URLSearchParams to meet specification compliance. (Timothy Gu) nodejs#9484 PR-URL: nodejs#10277
cjihrig added a commit to cjihrig/node that referenced this pull request Dec 20, 2016
Notable changes: * buffer: - buffer.fill() now works properly for the UCS2 encoding on Big-Endian machines. (Anna Henningsen) nodejs#9837 * cluster: - disconnect() now returns a reference to the disconnected worker. (Sean Villars) nodejs#10019 * crypto: - The built-in list of Well-Known CAs (Certificate Authorities) can now be extended via a NODE_EXTRA_CA_CERTS environment variable. (Sam Roberts) nodejs#9139 * http: - Remove stale timeout listeners in order to prevent a memory leak when using keep alive. (Karl Böhlmark) nodejs#9440 * tls: - Allow obvious key/passphrase combinations. (Sam Roberts) nodejs#10294 * url: - Including base argument in URL.originFor() to meet specification compliance. (joyeecheung) nodejs#10021 - Improve URLSearchParams to meet specification compliance. (Timothy Gu) nodejs#9484 PR-URL: nodejs#10277
cjihrig added a commit that referenced this pull request Dec 20, 2016
Notable changes: * buffer: - buffer.fill() now works properly for the UCS2 encoding on Big-Endian machines. (Anna Henningsen) #9837 * cluster: - disconnect() now returns a reference to the disconnected worker. (Sean Villars) #10019 * crypto: - The built-in list of Well-Known CAs (Certificate Authorities) can now be extended via a NODE_EXTRA_CA_CERTS environment variable. (Sam Roberts) #9139 * http: - Remove stale timeout listeners in order to prevent a memory leak when using keep alive. (Karl Böhlmark) #9440 * tls: - Allow obvious key/passphrase combinations. (Sam Roberts) #10294 * url: - Including base argument in URL.originFor() to meet specification compliance. (joyeecheung) #10021 - Improve URLSearchParams to meet specification compliance. (Timothy Gu) #9484 PR-URL: #10277
@domenic
Copy link
Contributor

Wait, what? There is no URL.originFor in the standard. Why are you adding nonstandard methods to URL?

@jasnell
Copy link
Member

jasnell commented Dec 21, 2016 via email

@domenic
Copy link
Contributor

Great. I filed #10374 and #10375 to track removing nonstandard things.

imyller added a commit to imyller/meta-nodejs that referenced this pull request Dec 21, 2016
 Notable changes: * buffer: - buffer.fill() now works properly for the UCS2 encoding on Big-Endian machines. (Anna Henningsen) nodejs/node#9837 * cluster: - disconnect() now returns a reference to the disconnected worker. (Sean Villars) nodejs/node#10019 * crypto: - The built-in list of Well-Known CAs (Certificate Authorities) can now be extended via a NODE_EXTRA_CA_CERTS environment variable. (Sam Roberts) nodejs/node#9139 * http: - Remove stale timeout listeners in order to prevent a memory leak when using keep alive. (Karl Bohlmark) nodejs/node#9440 * tls: - Allow obvious key/passphrase combinations. (Sam Roberts) nodejs/node#10294 * url: - Including base argument in URL.originFor() to meet specification compliance. (joyeecheung) nodejs/node#10021 - Improve URLSearchParams to meet specification compliance. (Timothy Gu) nodejs/node#9484 PR-URL: nodejs/node#10277 Signed-off-by: Ilkka Myller <[email protected]>
@joyeecheungjoyeecheung deleted the test-for-url-origin-for branch January 2, 2017 05:28
@joyeecheungjoyeecheung added the whatwg-url Issues and PRs related to the WHATWG URL implementation. label Jan 5, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-and-learnIssues related to the Code-and-Learn events and PRs submitted during the events.testIssues and PRs related to the tests.urlIssues and PRs related to the legacy built-in url module.whatwg-urlIssues and PRs related to the WHATWG URL implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants

@joyeecheung@jasnell@addaleax@lpinca@italoacasas@domenic@mscdex@MylesBorins@imyller@nodejs-github-bot