super.prop assignment can silently overwrite non-writable properties

Jason Orendorff jason.orendorff at
Mon Apr 20 16:38:01 UTC 2015

We're implementing `super` in Firefox, and ran across this surprising behavior:

    class X {
        constructor() {
            Object.defineProperty(this, "prop", {
                configurable: true,
                writable: false,
                value: 1});
        f() {
            super.prop = 2;  // overwrites non-writable property!

    var x = new X();
    assertEq(x.prop, 2);  // passes

In the spec, 9.1.9 step 4.d.i. is where `super.prop = 2` ends up, with


1. Do nothing. Allow overwriting. It's a little weird, but this code
is pretty weird.

2. (post-ES6 of course) Add more "code" in 4.d.i. to perform a
[[GetOwnProperty]] and check.


More information about the es-discuss mailing list