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 #9215

Closed
wants to merge 1 commit into from

Conversation

misterdjules
Copy link

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 #9116.

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.
@cjihrig
Copy link

cjihrig commented Feb 13, 2015

LGTM

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 <cjihrig@gmail.com>
@misterdjules
Copy link
Author

@cjihrig Thanks! Landed in c8239c0.

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.

4 participants