Uh oh!
There was an error while loading. Please reload this page.
console: allow Object.prototype fields as labels - #563
Conversation
vkurchatkin
commented
Jan 24, 2015
LGTM! |
There was a problem hiding this comment.
No. It returns NaN like I noted in the commit log :-/. Will update the test.
cjihrig
commented
Jan 25, 2015
@vkurchatkin updated the test. PTAL |
vkurchatkin
commented
Jan 25, 2015
LGTM |
There was a problem hiding this comment.
I'm generally -0 on replacing var with let unless there's a distinct need for block-scoping.
Edit: This is a non-blocking nit. It would make me feel better if these remained vars, though.
cjihrig
commented
Jan 26, 2015
@chrisdickinson changed the |
vkurchatkin
commented
Jan 26, 2015
I'll just leave it here: http://www.reddit.com/r/javascript/comments/1sgsmj/let_var_die/ |
Fishrock123
commented
Jan 26, 2015
If we are going to switch, I think it most reasonable to only change lines that we are already editing. |
cjihrig
commented
Jan 26, 2015
@vkurchatkin I'm in the camp of being as restrictive as possible, which I think |
pluma
commented
Jan 26, 2015
The test should still fail for console._times=Object.create(null);console.time('__proto__');// => console._times.__proto__ = Date.now();console.timeEnd('__proto__');// throwsconsole._times.__proto__===null;// true |
cjihrig
commented
Jan 26, 2015
@pluma seems to work fine with the latest iojs code. |
pluma
commented
Jan 26, 2015
@cjihrig Interesting. Is this related to the newer version of V8 being used? |
cjihrig
commented
Jan 26, 2015
@pluma that would be my guess - I see the same behavior in the Chrome console. |
pluma
commented
Jan 26, 2015
Hm, odd. I guess the semantics of |
cjihrig
commented
Jan 27, 2015
Is anyone opposed to this landing? Another alternative would be to use a |
rvagg
commented
Jan 27, 2015
+1 for landing, and also +1 for experimenting with |
Console.prototype.timeEnd() returns NaN if the timer label corresponds to a property on Object.prototype. This commit uses a Map to construct the _times object.
cjihrig
commented
Jan 27, 2015
@rvagg updated to use a |
rvagg
commented
Jan 27, 2015
love it! |
There was a problem hiding this comment.
It might be better (perf-wise) to just replace this with { __proto__: null } or Object.create(null)
Console.prototype.timeEnd() returns NaN if the timer label corresponds to a property on Object.prototype. This commit uses a Map to construct the _times object. Fixes: nodejs/node-v0.x-archive#9069 PR-URL: #563 Reviewed-By: Vladimir Kurchatkin <vladimir.kurchatkin@gmail.com> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
cjihrig
commented
Jan 27, 2015
Landed in 3cbb5cd |
Console.prototype.timeEnd()returnsNaNif the timer label corresponds to a property onObject.prototype. This commit usesObject.create(null)to construct the_timesobject. See nodejs/node-v0.x-archive#9069