Closed
Bug 690027
Opened 14 years ago
Closed 14 years ago
__proto__ doesn't work with objects with no prototype
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: bruant.d, Unassigned)
Details
-----
var o = Object.create(null);
console.log(o.hasOwnProperty); // "undefined" as it should
o.__proto__ = {};
console.log(o.hasOwnProperty);
-----
Second log logs "undefined" as well while it should report a function.
This works on Chrome.
Absence of specification makes difficult to judge how is right, but i think they are. My say is that __proto__ should be a magical trap to the internal [[Prototype]] property as defined in ES5.1
Comment 1•14 years ago
|
||
Pretty sure this is a dup.
We originated __proto__, developers use it. The expected semantics are not what we implement in full, but they also are not a "magical trap" as in Rhino and I suspect V8. That breaks JSON.
/be
Whiteboard: DUPEME
| Reporter | ||
Comment 2•14 years ago
|
||
Current consensus [1] is to have proto as a magic Object.prototype property. Consequently, it should not work on null-[[Prototype]]'ed objects.
[1] http://wiki.ecmascript.org/doku.php?id=strawman:magic_proto_property
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•