Status: New
Owner: ----

New issue 3377 by [email protected]: odd behavior of __proto__ with Object.create(null) objects in an array
http://code.google.com/p/v8/issues/detail?id=3377

I was only able to get this to happen using an object when it is a member in an array.

x=[{}]; i=0; x[i].__proto__ = {y:1}; x[i].__proto__
{ y: 1 }
o=Object.create(null)
{}
o.y = 2
2
x[i].__proto__ = o
{ y: 2 }
x[0].__proto__
undefined
x[0].__proto__.y
TypeError: Cannot read property 'y' of undefined
    at repl:1:15
    at REPLServer.defaultEval (repl.js:130:27)
    at bound (domain.js:257:14)
    at REPLServer.runBound [as eval] (domain.js:270:12)
    at REPLServer.<anonymous> (repl.js:277:12)
    at REPLServer.emit (events.js:107:17)
    at REPLServer.Interface._onLine (readline.js:206:10)
    at REPLServer.Interface._line (readline.js:535:8)
    at REPLServer.Interface._ttyWrite (readline.js:816:14)
    at ReadStream.onkeypress (readline.js:108:10)
x[0].y
2
x
[ {} ]
Object.keys(x[0])
[]

Note that the object doesn't have a "y" own-property, but it also seems to not have a __proto__, so where is the y value coming from!?

This makes for a bunch of weird behavior in Node, because npm uses prototype chains to manage config values.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to