change behavior of Array.prototype.push?

Jann Horn jann at
Sun Oct 30 00:00:34 UTC 2016

On Sat, Oct 29, 2016 at 07:40:56PM -0400, Caitlin Potter wrote:
> What do you mean by “nobody’s stuff broke”?

I mean "nobody seems to have complained yet, so there can't be that many
people who rely on the specced behavior".

> I would be surprised if nothing broke if v8 or JavaScriptCore or
> Chakra switched to the FireFox approach (which is only broken in the
> specific case where the target is a JSArray, based on what Jordan is
> saying). If you can prove that nothing breaks if other browsers
> implement that change

Nope, I can't, and I assume that nobody was able to prove that making
Object.prototype.[[Prototype]] immutable wouldn't break anything either.
However, I think that it's pretty clear that, if such a change is only
made for arrays inheriting from %ArrayPrototype%, someone would have to
do some pretty weird stuff to actually run into this edgecase.

> (and, if similar changes are implemented for pop/shift/unshift, since
> IMHO those apis need to behave consistently),

Yeah, I guess so.

> then maybe it’s not an unreasonable change.
> > On Oct 29, 2016, at 7:07 PM, Jann Horn <jann at> wrote:
> > 
> > On Sat, Oct 29, 2016 at 03:15:48PM -0700, Jordan Harband wrote:
> >> That just means anyone relying on that behavior is broken in Firefox - if
> >> their code would work in all of the other browsers, then it's a Firefox
> >> bug, not something the spec can change.
> > 
> > But apparently, nobody's stuff broke.
> > In the Linux kernel, the approach to API changes is basically "you can
> > change things as long as no existing userspace code breaks because of
> > those changes", which I think is reasonable.
> > And as far as I can tell, ECMAScript uses a similar approach; for
> > example, AFAIK in ECMAScript 6.0, the following code would have worked,
> > but ECMAScript 7.0 breaks it (by making %ObjectPrototype% an immutable
> > prototype exotic object):
> > 
> >    Reflect.setPrototypeOf(Object.prototype, {__proto__:null, a:1});
> >    console.log(({}).a);
> > 
> > So clearly, reasonable breakage in new ECMAScript versions is permitted.
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at
> >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <>

More information about the es-discuss mailing list