Closed Bug 690027 Opened 10 years ago Closed 9 years ago

__proto__ doesn't work with objects with no prototype

Categories

(Core :: JavaScript Engine, defect)

6 Branch
x86
Linux
defect
Not set
normal

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
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
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: 9 years ago
Resolution: --- → INVALID
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.