GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — util: fix inspecting of proxy objects by jasnell · Pull Request #6465 · nodejs/node Conversation
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CI is green LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
-1, the whole point of proxies is being transparent |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
That’s true for the programmatic use of proxies, but |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@addaleax +1 . Note that 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.
There was an error while loading. Please reload this page.
|
(@thealphanerd ... what are you doing up at 2am reviewing code I wrote at 1am? Sleep my friend! Sleep!) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If you export this, it becomes public API, and should be documented.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
+1 ... Forgot to add the doc for it. Will add soon!
On Apr 29, 2016 6:29 AM, "Colin Ihrig" [email protected] 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.
There was an error while loading. Please reload this page.
|
@cjihrig ... updated! PTAL |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
New CI after update: https://ci.nodejs.org/job/node-test-pull-request/2432/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary blank line.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@cjihrig ... done! :-) @vkurchatkin ... +1 on it being semver-major (unfortunately). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@vkurchatkin ... would this be a bit more palatable if there were an option on |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This should probably be camelCase.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM pending CI, but it should sit for a couple days. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
@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.
There was an error while loading. Please reload this page.
|
@cjihrig +1 for letting it sit a couple days. There's definitely no rush on it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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.
There was an error while loading. Please reload this page.
|
CI is green. Will land on monday if there are no objections. /cc @nodejs/ctc |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Looks like this conflates two things:
Please do not land in this state. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
New CI: https://ci.nodejs.org/job/node-test-pull-request/2444/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| function formatValue(ctx, value, recurseTimes) { | ||
|
|
||
| if (ctx.showProxy && | ||
| (typeof value === 'object' || typeof value === 'function')) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
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 an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ack
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@bnoordhuis ... updated |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // 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.
The reason will be displayed to describe this comment to others. Learn more.
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 an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
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.
There was an error while loading. Please reload this page.
|
LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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.
There was an error while loading. Please reload this page.
|
@thealphanerd and @cjihrig ... still LGTY? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yes, LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
|
Landed in ba6196f. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
* 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
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.