B.3.1 The __proto__ pseudo property

Mark Miller erights at gmail.com
Tue Apr 23 06:26:31 PDT 2013


Agreed. Just to clarify though, I'm going to make a pedantic change to your
wording ;).


On Tue, Apr 23, 2013 at 6:00 AM, Andreas Rossberg <rossberg at google.com>wrote:
[...]

> Preventing cross-realm prototype chains was not the intention. The
> intention was to prevent using a protosetter from another realm to
>

mutate the [[Prototype]] of an object in a realm where
Object.prototype.__proto__


> has been removed.
>

(In the case of a cross-realm prototype chain, the notion of "a prototype
chain in a realm" is not well defined.)


>
> Here is my example again:
>
>   // Realm A
>   delete Object.prototype.__proto__  // no messing around
>
>   let other = getObjectFromSomewherePotentiallyAnotherRealmB()
>
>   let p1 = Object.create(other, {a: {value: 1}})
>

For example, at this point in your scenario, we would have no problem with

    other.__proto__ = {a: 2};

However, the is mutating at least one prototype *chain* that starts in
Realm A.



>   let o = Object.create(p1)
>   let p2 = Object.create({})
>   o.__proto__ = p2  // say what?
>
> Everything is fine up to the last step. In particular, o has a
> cross-realm prototype chain just fine. The only problem is with the
> last line, which actually makes use of the __proto__ inherited from a
> different realm to mutate o's prototype. My understanding was that
> _that_ is the kind of thing we anted to prevent.
>
> /Andreas
>



-- 
  Cheers,
  --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130423/7ab64c19/attachment.html>


More information about the es-discuss mailing list