Closed Bug 1038545 Opened 9 years ago Closed 8 years ago
Coerce the argument passed to Object
.keys using To Object
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2091.2 Safari/537.36 Steps to reproduce: According to ES6 spec 220.127.116.11 http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys 1. Let obj be ToObject(O). So Object.keys(1) or Object.keys(Symbol("foo")) shouldn't throw any more.
V8 issue here: https://code.google.com/p/v8/issues/detail?id=3443#c1
OS: Mac OS X → All
Hardware: x86 → All
Version: 33 Branch → Trunk
Weird. Is this change intentional? I don't recall seeing a discussion or meeting notes on this.
(In reply to David Bruant from comment #3) > Weird. Is this change intentional? I don't recall seeing a discussion or > meeting notes on this. Yes, See this tweet by allen: https://twitter.com/ziyunfei/status/488893818620489730
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Let's deal with each of these changes in its own bug. The description of the new bug you filed doesn't at all explain what's going on. On top of that, these are quite a few changes. I'll change your new bug into a meta bug tracking all these related changes, though.
Summary: Object.keys() shouldn't throw when given primitive values as input → Coerce the argument passed to Object.keys using ToObject
Assignee: nobody → 446240525
Attachment #8499958 - Flags: review?(till)
Comment on attachment 8499958 [details] [diff] [review] bug-1038545.patch Review of attachment 8499958 [details] [diff] [review]: ----------------------------------------------------------------- Oh, how nice that the specification simplified this so much. :) Please mention this simplification in the commit message: "Coerce the argument passed to Object.keys using ToObject and simplify implementation." For future reference, if you make changes that go beyond what the bug says, please briefly explain why you're making them and why they're ok in a bug comment. In this case, something like "I also simplified the implementation in accordance with the current specification draft. All existing tests still pass." It probably would've taken me just as long to verify the correctness of these changes, but it would at least have spared me some confusion.
Attachment #8499958 - Flags: review?(till) → review+
Status: REOPENED → RESOLVED
Closed: 9 years ago → 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.