Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

console: allow Object.prototype fields as labels #9116

Closed
wants to merge 1 commit into from
Closed

console: allow Object.prototype fields as labels #9116

wants to merge 1 commit into from

Conversation

cjihrig
Copy link

@cjihrig cjihrig commented Jan 29, 2015

Console.prototype.timeEnd() returns NaN if the timer label corresponds to a property on Object.prototype. This commit uses Object.create(null) to construct the _times object. This is not a proper fix for 0.10 because the older version of v8 includes a __proto__ field. Closes #9069

Console.prototype.timeEnd() returns NaN if the timer label
corresponds to a property on Object.prototype. This commit
uses Object.create(null) to construct the _times object.
@trevnorris
Copy link

LGTM

cjihrig added a commit that referenced this pull request Feb 13, 2015
Console.prototype.timeEnd() returns NaN if the timer label
corresponds to a property on Object.prototype. This commit
uses Object.create(null) to construct the _times object.

Fixes: #9069
PR-URL: #9116
Reviewed-By: Trevor Norris <[email protected]>
@cjihrig
Copy link
Author

cjihrig commented Feb 13, 2015

Landed in 6c3647c

@cjihrig cjihrig closed this Feb 13, 2015
@cjihrig cjihrig deleted the 9069 branch February 13, 2015 15:28
misterdjules pushed a commit to misterdjules/node that referenced this pull request Feb 13, 2015
This is a backport of 6c3647c from
v0.12 to v0.10.

Console.prototype.timeEnd() returns NaN if the timer label
corresponds to a property on Object.prototype. In v0.12, this was fixed
by using Object.create(null) to construct the _times object

However, the version of V8 in the v0.10 branch makes this fix not work
as expected. In v0.10, this commit changes the _times object into a
array of objects of the form:

{ label: someLabel, time: staringWallClockTime }

someLabel can thus be any string, including any string that represents
any Object.prototype field.

Fixes nodejs#9116.
misterdjules pushed a commit to misterdjules/node that referenced this pull request Feb 18, 2015
This is a backport of 6c3647c from
v0.12 to v0.10.

Console.prototype.timeEnd() returns NaN if the timer label
corresponds to a property on Object.prototype. In v0.12, this was fixed
by using Object.create(null) to construct the _times object

However, the version of V8 in the v0.10 branch makes this fix not work
as expected. In v0.10, this commit changes the _times object into a
array of objects of the form:

{ label: someLabel, time: staringWallClockTime }

someLabel can thus be any string, including any string that represents
any Object.prototype field.

Fixes nodejs#9116.

PR: nodejs#9215
PR-URL: nodejs#9215
Reviewed-By: Colin Ihrig <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants