Closed
Bug 897021
Opened 12 years ago
Closed 10 years ago
NORMAL "__proto__" property is not enumerable even if "enumerable" of it's descriptor is true
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
DUPLICATE
of bug 837630
People
(Reporter: teramako, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0 (Beta/Release)
Build ID: 20130618035212
Steps to reproduce:
The following code works good:
```javascript
var obj = {};
Object.defineProperty(obj, "__proto__", { value: "nomal __proto__", enumerable: true});
for (var key in obj){ console.log(key); } // "__proto__" is written into the console
Object.keys(obj).length; // 1
```
But, on the other hand, it seems the following code doesn't works good:
```javascript
var obj = Object.create(null);
obj.__proto__ = "normal __proto__";
JSON.stringify(Object.getOwnPropertyDescriptor(obj, "__proto__"))
// {"configurable":true,"enumerable":true,"value":"normal __proto__","writable":true}
for (var key in obj) { console.log(key); } // nothing is written
Object.keys(obj).length; // 0
```
Why is not __proto__ property enumerated ?
And, I became aware that the following code works good:
Comment 1•12 years ago
|
||
> And, I became aware that the following code works good:
Where is "the following code"?
(In reply to Masatoshi Kimura [:emk] from comment #1)
> > And, I became aware that the following code works good:
>
> Where is "the following code"?
oops orz, please ignore the paragraph.
Assignee | ||
Updated•11 years ago
|
Assignee: general → nobody
Comment 3•10 years ago
|
||
Should be marked as duplicate of Bug 837630
Updated•10 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•