| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Symbols added this way are enumerable(can be verified via Object.getOwnPropertyDescriptor(url, kFormat)), I believe test-whatwg-url-properties doesn't catch this because for-in only iterates over string keys, but since Reflect.enumerate is withdrawn in ES2016 I can't think of a way to make that test more complete...anyways I think we should useObject.defineProperty here to make it non-enumerable, or just move this function out and use .call to call it properly?
Sorry, something went wrong.
There was a problem hiding this comment.
Using defineProperty is fine.
Sorry, something went wrong.
There was a problem hiding this comment.
Putting the symbols here at all (enumerable or not) creates an observable difference from the spec via Object.getOwnPropertySymbols. But I guess there are several of those already (special/cannotBeABase) so IMO it's probably not worth changing...
Sorry, something went wrong.
|
How much of a performance impact does this have on non-whatwg url usage? |
Sorry, something went wrong.
|
It may be another topic, but from the viewpoint of making the URL object behave the same as the standard, is URL.inspect() OK even when it can be called? I think it could be replaced with util.inspect when it needs. Here is an example: node/test/parallel/test-whatwg-url-parsing.js Lines 147 to 149 in d86ff5f |
Sorry, something went wrong.
|
@mscdex ... the performance hit incurred by the addition of the new instanceof URL check is, unfortunately, non-trivial. I'll play around with it to see how I can reduce the cost. |
Sorry, something went wrong.
|
@watilde ... we now have the option of using a symbol for the inspect function. It would make sense to switch to using that instead of the inspect() function itself. |
Sorry, something went wrong.
|
@mscdex @joyeecheung ... updated. modified the changes in url.format a bit to reduce the cost of the additional check. |
Sorry, something went wrong.
There was a problem hiding this comment.
Is the unicode option name from the spec, from compatibility with the old url, or is it up for debate? I don’t think it’s conveying the semantics very well (like, I have to look at the tests in this PR to see which behaviour maps to which value). How does something like decodeIDNA: true/false sound to you?
Sorry, something went wrong.
There was a problem hiding this comment.
(Strange, my response ended up both in my own review and here, but when I deleted that one in my review this one disappeared too)..
I think options is neither in the spec nor in the old url.format. For me the meaning of unicode is pretty straightforword(maybe it's just me though). The two serialization alternatives are named Domain to ASCII and Domain to Unicode in the spec.
Sorry, something went wrong.
There was a problem hiding this comment.
The unicode flag is consistent with the URL standard, yes (see: https://url.spec.whatwg.org/#host-parsing). To be fair, however, that is on parse side and this is on the serialization, but there is precedent at least.
Sorry, something went wrong.
There was a problem hiding this comment.
The unicode flag is consistent with the URL standard, yes (see: https://url.spec.whatwg.org/#host-parsing). To be fair, however, that is on parse side and this is on the serialization, but there is precedent at least.
Eh, if it’s in the standard, even just on the parse side, it’s probably best to leave it like that. Thanks for pointing it out.
For me the meaning of unicode is pretty straightforword(maybe it's just me though).
Well, if it’s working and people know what the option describes, that’s probably just fine then. (At least in my head, unicode: true sounds like it could both mean enabling a) decoding of the hostname from punycode to Unicode or b) encoding of the hostname from Unicode to punycode)
Sorry, something went wrong.
There was a problem hiding this comment.
I will make sure that the relevant documentation appropriately covers the option and makes its function clear
Sorry, something went wrong.
There was a problem hiding this comment.
Why use Boolean() instead of !! here?
Sorry, something went wrong.
There was a problem hiding this comment.
Personal preference with regards to code clarity
Sorry, something went wrong.
There was a problem hiding this comment.
nit: extra whitespace here
Sorry, something went wrong.
There was a problem hiding this comment.
This still hasn't been fixed.
Sorry, something went wrong.
There was a problem hiding this comment.
I think keep it as this.toString() is closer to how the spec defines href as the stringifier.
Sorry, something went wrong.
There was a problem hiding this comment.
The result is the same. Using this[kFormat]({}) here avoids an unnecessary property access.
Sorry, something went wrong.
There was a problem hiding this comment.
These two lines are not needed as they are the default. However, the trend in Web APIs seems to be make symbol properties configurable and writable, so I'd recommend sticking to that
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, I know they are the default. I prefer to be explicit. Also, because this is an internal only method, I prefer to keep these values
Sorry, something went wrong.
|
LGTM except it needs rebase. |
Sorry, something went wrong.
|
@mscdex ... any further thoughts on this? |
Sorry, something went wrong.
|
@jasnell Performance-wise the lib/url.js changes LGTM. |
Sorry, something went wrong.
Sorry, something went wrong.
Removes the non-standard options on WHATWG URL toString
and extends the existing url.format() API to support
customizable serialization of the WHATWG URL object.
This does not yet include the documentation updates
because the documentation for the new WHATWG URL object
has not yet landed.
Example:
```js
const url = require('url');
const URL = url.URL;
const myURL = new URL('http://example.org/?a=b#c');
const str = url.format(myURL, {fragment: false, search: false});
console.log(str);
// Prints: http://example.org/
```
Removes the non-standard options on WHATWG URL toString
and extends the existing url.format() API to support
customizable serialization of the WHATWG URL object.
This does not yet include the documentation updates
because the documentation for the new WHATWG URL object
has not yet landed.
Example:
```js
const url = require('url');
const URL = url.URL;
const myURL = new URL('http://example.org/?a=b#c');
const str = url.format(myURL, {fragment: false, search: false});
console.log(str);
// Prints: http://example.org/
```
PR-URL: #10857
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
PR-URL: #10857 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Removes the non-standard options on WHATWG URL toString
and extends the existing url.format() API to support
customizable serialization of the WHATWG URL object.
This does not yet include the documentation updates
because the documentation for the new WHATWG URL object
has not yet landed.
Example:
```js
const url = require('url');
const URL = url.URL;
const myURL = new URL('http://example.org/?a=b#c');
const str = url.format(myURL, {fragment: false, search: false});
console.log(str);
// Prints: http://example.org/
```
PR-URL: #10857
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
PR-URL: #10857 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Removes the non-standard options on WHATWG URL toString
and extends the existing url.format() API to support
customizable serialization of the WHATWG URL object.
This does not yet include the documentation updates
because the documentation for the new WHATWG URL object
has not yet landed.
Example:
```js
const url = require('url');
const URL = url.URL;
const myURL = new URL('http://example.org/?a=b#c');
const str = url.format(myURL, {fragment: false, search: false});
console.log(str);
// Prints: http://example.org/
```
PR-URL: nodejs#10857
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Notable changes:
* deps:
* update V8 to 5.5 (Michaël Zasso) [#11029](#11029)
* upgrade libuv to 1.11.0 (cjihrig) [#11094](#11094)
* add node-inspect 1.10.2 (Jan Krems) [#10187](#10187)
* lib: build `node inspect` into `node` (Anna Henningsen) [#10187](#10187)
* crypto: Remove expired certs from CNNIC whitelist (Shigeki Ohtsu) [#9469](#9469)
* inspector: add --inspect-brk (Josh Gavant) [#11149](#11149)
* fs: allow WHATWG URL and file: URLs as paths (James M Snell) [#10739](#10739)
* src: support UTF-8 in compiled-in JS source files (Ben Noordhuis) [#11129](#11129)
* url: extend url.format to support WHATWG URL (James M Snell) [#10857](#10857)
PR-URL: #11185
Notable changes:
* deps:
* update V8 to 5.5 (Michaël Zasso) [nodejs#11029](nodejs#11029)
* upgrade libuv to 1.11.0 (cjihrig) [nodejs#11094](nodejs#11094)
* add node-inspect 1.10.4 (Jan Krems) [nodejs#10187](nodejs#10187)
* upgrade zlib to 1.2.11 (Sam Roberts) [nodejs#10980](nodejs#10980)
* lib: build `node inspect` into `node` (Anna Henningsen) [nodejs#10187](nodejs#10187)
* crypto: Remove expired certs from CNNIC whitelist (Shigeki Ohtsu) [nodejs#9469](nodejs#9469)
* inspector: add --inspect-brk (Josh Gavant) [nodejs#11149](nodejs#11149)
* fs: allow WHATWG URL objects as paths (James M Snell) [nodejs#10739](nodejs#10739)
* src: support UTF-8 in compiled-in JS source files (Ben Noordhuis) [nodejs#11129](nodejs#11129)
* url: extend url.format to support WHATWG URL (James M Snell) [nodejs#10857](nodejs#10857)
PR-URL: nodejs#11185
Notable changes:
* deps:
* update V8 to 5.5 (Michaël Zasso) [nodejs#11029](nodejs#11029)
* upgrade libuv to 1.11.0 (cjihrig) [nodejs#11094](nodejs#11094)
* add node-inspect 1.10.4 (Jan Krems) [nodejs#10187](nodejs#10187)
* upgrade zlib to 1.2.11 (Sam Roberts) [nodejs#10980](nodejs#10980)
* lib: build `node inspect` into `node` (Anna Henningsen) [nodejs#10187](nodejs#10187)
* crypto: Remove expired certs from CNNIC whitelist (Shigeki Ohtsu) [nodejs#9469](nodejs#9469)
* inspector: add --inspect-brk (Josh Gavant) [nodejs#11149](nodejs#11149)
* fs: allow WHATWG URL objects as paths (James M Snell) [nodejs#10739](nodejs#10739)
* src: support UTF-8 in compiled-in JS source files (Ben Noordhuis) [nodejs#11129](nodejs#11129)
* url: extend url.format to support WHATWG URL (James M Snell) [nodejs#10857](nodejs#10857)
PR-URL: nodejs#11185
Removes the non-standard options on WHATWG URL toString
and extends the existing url.format() API to support
customizable serialization of the WHATWG URL object.
This does not yet include the documentation updates
because the documentation for the new WHATWG URL object
has not yet landed.
Example:
```js
const url = require('url');
const URL = url.URL;
const myURL = new URL('http://example.org/?a=b#c');
const str = url.format(myURL, {fragment: false, search: false});
console.log(str);
// Prints: http://example.org/
```
PR-URL: nodejs#10857
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
PR-URL: nodejs#10857 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Notable changes:
* deps:
* update V8 to 5.5 (Michaël Zasso) [#11029](nodejs/node#11029)
* upgrade libuv to 1.11.0 (cjihrig) [#11094](nodejs/node#11094)
* add node-inspect 1.10.4 (Jan Krems) [#10187](nodejs/node#10187)
* upgrade zlib to 1.2.11 (Sam Roberts) [#10980](nodejs/node#10980)
* lib: build `node inspect` into `node` (Anna Henningsen) [#10187](nodejs/node#10187)
* crypto: Remove expired certs from CNNIC whitelist (Shigeki Ohtsu) [#9469](nodejs/node#9469)
* inspector: add --inspect-brk (Josh Gavant) [#11149](nodejs/node#11149)
* fs: allow WHATWG URL objects as paths (James M Snell) [#10739](nodejs/node#10739)
* src: support UTF-8 in compiled-in JS source files (Ben Noordhuis) [#11129](nodejs/node#11129)
* url: extend url.format to support WHATWG URL (James M Snell) [#10857](nodejs/node#10857)
PR-URL: nodejs/node#11185
Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
| Back | FazBrowse Home | New Git URL |
Removes the non-standard options on WHATWG URL toString
and extends the existing url.format() API to support
customizable serialization of the WHATWG URL object.
This does not yet include the documentation updates
because the documentation for the new WHATWG URL object
has not yet landed.
Example:
Checklist
Affected core subsystem(s)
url, whatwg-url
/cc @watilde @nodejs/url