| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
|
CI is green LGTM |
Sorry, something went wrong.
|
-1, the whole point of proxies is being transparent |
Sorry, something went wrong.
That’s true for the programmatic use of proxies, but util.inspect comes with the intention of showing humans what is going on. |
Sorry, something went wrong.
|
@addaleax +1 . Note that getters/setters are also generally intended to be transparent for most cases but util.inspect will produce output like {a: [Getter]} which avoids similar stack-depth side effects... e.g. var m = {};
Object.defineProperty(m, 'a', {
enumerable: true,
get: function() {
console.log(this);
return 5;
}
});
util.inspect(m);
// Returns `{a: [Getter]}` |
Sorry, something went wrong.
|
(@thealphanerd ... what are you doing up at 2am reviewing code I wrote at 1am? Sleep my friend! Sleep!) |
Sorry, something went wrong.
There was a problem hiding this comment.
If you export this, it becomes public API, and should be documented.
Sorry, something went wrong.
There was a problem hiding this comment.
+1 ... Forgot to add the doc for it. Will add soon!
On Apr 29, 2016 6:29 AM, "Colin Ihrig" notifications@github.com wrote:
In lib/util.js
#6465 (comment):@@ -785,6 +792,10 @@ exports.isPrimitive = isPrimitive;
exports.isBuffer = Buffer.isBuffer;
+function isProxy(p) {
- return binding.isProxy(p);
+}
+exports.isProxy = isProxy;If you export this, it becomes public API, and should be documented.
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/nodejs/node/pull/6465/files/3d4ff4311a3cf1ff756413756ffc859a663aba99#r61577439
Sorry, something went wrong.
|
New CI after update: https://ci.nodejs.org/job/node-test-pull-request/2432/ |
Sorry, something went wrong.
There was a problem hiding this comment.
Unnecessary blank line.
Sorry, something went wrong.
|
@cjihrig ... done! :-) @vkurchatkin ... +1 on it being semver-major (unfortunately). |
Sorry, something went wrong.
|
@vkurchatkin ... would this be a bit more palatable if there were an option on util.inspect to turn off this special treatment of Proxy objects? e.g. util.inspect(proxyObj, {unwrapProxy: false}); |
Sorry, something went wrong.
There was a problem hiding this comment.
This should probably be camelCase.
Sorry, something went wrong.
|
LGTM pending CI, but it should sit for a couple days. |
Sorry, something went wrong.
@jasnell after some thinking, I agree with your reasoning. Having an option is nice, but in practice no one uses them |
Sorry, something went wrong.
|
@cjihrig +1 for letting it sit a couple days. There's definitely no rush on it. |
Sorry, something went wrong.
In certain conditions, inspecting a Proxy object can lead to a max call stack error. Avoid that by detecting the Proxy object and outputting information about the Proxy object itself. Also adds util.isProxy() Fixes: nodejs#6464
|
Squashed, new CI: https://ci.nodejs.org/job/node-test-pull-request/2435/ |
Sorry, something went wrong.
|
CI is green. Will land on monday if there are no objections. /cc @nodejs/ctc |
Sorry, something went wrong.
|
Looks like this conflates two things:
Please do not land in this state. |
Sorry, something went wrong.
Sorry, something went wrong.
| function formatValue(ctx, value, recurseTimes) { | ||
|
|
||
| if (ctx.showProxy && | ||
| (typeof value === 'object' || typeof value === 'function')) { |
There was a problem hiding this comment.
You should check that typeof value === 'object' && value !== null, I think?
Style nit: can you drop the blank line?
Sorry, something went wrong.
There was a problem hiding this comment.
Ack
Sorry, something went wrong.
| // for it to get proper formatting, and because | ||
| // the target and handle objects also might be | ||
| // proxies... it's unfortunate but necessary. | ||
| proxyCache.set(proxy, undefined); |
There was a problem hiding this comment.
I understand the logic but I don't think the 'necessary' is accurate; if you skipped adding proxy to the cache here, the algorithm would still work, only less efficiently. The next iteration would check the cache, miss, call .getProxyDetails() for the details array, and add the undefined return value to the cache a few lines below.
Sorry, something went wrong.
There was a problem hiding this comment.
Necessary in the sense of avoiding an extraneous call to getProxyDetails... Which I would consider to be a bug since the point is to only check when we don't know for sure. ;)
Sorry, something went wrong.
|
LGTM |
Sorry, something went wrong.
|
CI after nits.. seems fine to me if others are happy with the details: https://ci.nodejs.org/job/node-test-pull-request/2459/ |
Sorry, something went wrong.
|
@thealphanerd and @cjihrig ... still LGTY? |
Sorry, something went wrong.
|
LGTM |
Sorry, something went wrong.
|
Yes, LGTM |
Sorry, something went wrong.
In certain conditions, inspecting a Proxy object can lead to a max call stack error. Avoid that by detecting the Proxy object and outputting information about the Proxy object itself. Fixes: #6464 PR-URL: #6465 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
|
Landed in ba6196f. |
Sorry, something went wrong.
In certain conditions, inspecting a Proxy object can lead to a max call stack error. Avoid that by detecting the Proxy object and outputting information about the Proxy object itself. Fixes: #6464 PR-URL: #6465 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
In certain conditions, inspecting a Proxy object can lead to a max call stack error. Avoid that by detecting the Proxy object and outputting information about the Proxy object itself. Fixes: nodejs#6464 PR-URL: nodejs#6465 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* assert: `deep{Strict}Equal()` now works correctly with circular
references. (Rich Trott) #6432
* debugger: Arrays are now formatted correctly in the debugger repl.
(cjihrig) #6448
* deps: Upgrade OpenSSL sources to 1.0.2h (Shigeki Ohtsu)
#6550
* net: Introduced a `Socket#connecting` property. (Fedor Indutny)
#6404
- Previously this information was only available as the undocumented,
internal `_connecting` property.
* process: Introduced `process.cpuUsage()`. (Patrick Mueller)
#6157
* stream: `Writable#setDefaultEncoding()` now returns `this`.
(Alexander Makarenko) #5040
* util: Two new additions to `util.inspect()`:
- Added a `maxArrayLength` option to truncate the formatting of
Arrays. (James M Snell) #6334
- This is set to `100` by default.
- Added a `showProxy` option for formatting proxy intercepting
handlers. (James M Snell) #6465
- Inspecting proxies is non-trivial and as such this is off by
default.
PR-URL: #6557
* assert: `deep{Strict}Equal()` now works correctly with circular
references. (Rich Trott) #6432
* debugger: Arrays are now formatted correctly in the debugger repl.
(cjihrig) #6448
* deps: Upgrade OpenSSL sources to 1.0.2h (Shigeki Ohtsu)
#6550
- Please see our blog post for more info on the security contents of this release:
- https://nodejs.org/en/blog/vulnerability/openssl-may-2016/
* net: Introduced a `Socket#connecting` property. (Fedor Indutny)
#6404
- Previously this information was only available as the undocumented,
internal `_connecting` property.
* process: Introduced `process.cpuUsage()`. (Patrick Mueller)
#6157
* stream: `Writable#setDefaultEncoding()` now returns `this`.
(Alexander Makarenko) #5040
* util: Two new additions to `util.inspect()`:
- Added a `maxArrayLength` option to truncate the formatting of
Arrays. (James M Snell) #6334
- This is set to `100` by default.
- Added a `showProxy` option for formatting proxy intercepting
handlers. (James M Snell) #6465
- Inspecting proxies is non-trivial and as such this is off by
default.
PR-URL: #6557
* assert: `deep{Strict}Equal()` now works correctly with circular
references. (Rich Trott) #6432
* debugger: Arrays are now formatted correctly in the debugger repl.
(cjihrig) #6448
* deps: Upgrade OpenSSL sources to 1.0.2h (Shigeki Ohtsu)
#6550
- Please see our blog post for more info on the security contents of
this release:
- https://nodejs.org/en/blog/vulnerability/openssl-may-2016/
* net: Introduced a `Socket#connecting` property. (Fedor Indutny)
#6404
- Previously this information was only available as the undocumented,
internal `_connecting` property.
* process: Introduced `process.cpuUsage()`. (Patrick Mueller)
#6157
* stream: `Writable#setDefaultEncoding()` now returns `this`.
(Alexander Makarenko) #5040
* util: Two new additions to `util.inspect()`:
- Added a `maxArrayLength` option to truncate the formatting of
Arrays. (James M Snell) #6334
- This is set to `100` by default.
- Added a `showProxy` option for formatting proxy intercepting
handlers. (James M Snell) #6465
- Inspecting proxies is non-trivial and as such this is off by
default.
PR-URL: #6557
| Back | FazBrowse Home | New Git URL |
Checklist
Affected core subsystem(s)
util
Description of change
In certain conditions (see #6464), inspecting a Proxy object can lead to a max call stack error. Avoid that by detecting the Proxy object and outputting information about the Proxy object itself.
Also adds util.isProxy()
Fixes: #6464
/cc @bnoordhuis