Bug 78438 - Failed strict assignment to __proto__ not throwing
Summary: Failed strict assignment to __proto__ not throwing
Status: RESOLVED DUPLICATE of bug 78409
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-12 14:18 PST by Mark S. Miller
Modified: 2012-02-20 13:54 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark S. Miller 2012-02-12 14:18:05 PST
In Version 5.1.2 (7534.52.7, r107511):

    > var x = Object.preventExtensions({});
    > var y = {};
    > function foo(){"use strict"; x.__proto__ = y;}
    > Object.getPrototypeOf(x) === Object.prototype
    true
    > foo()
    > Object.getPrototypeOf(x) === Object.prototype
    true

The above behavior correctly does not mutate x.__proto__, however, since it is a failed assignment and foo() is strict, the call to foo() should have thrown an exception. Instead it failed silently.
Comment 1 Mark S. Miller 2012-02-12 14:20:02 PST
See https://bugs.webkit.org/show_bug.cgi?id=65832
Comment 2 Mark S. Miller 2012-02-12 14:24:31 PST
On Version 5.1.2 (7534.52.7) I get

    > foo()
    TypeError: Attempted to assign to readonly property.

which is correct, so this is a regression.
Comment 3 Gavin Barraclough 2012-02-12 19:02:59 PST
Ah agreed, we should be following step 3 of your proposal here ( http://wiki.ecmascript.org/doku.php?id=strawman:magic_proto_property ), this will still be a change from our previous behavior, but will be more restrictive rather than less.

Thanks for the bug Mark!
Comment 4 Gavin Barraclough 2012-02-20 13:54:45 PST
I had to roll out bug#78409 to fix a couple of test cases, when I re-landed it I fixed this too.

There is a test case covering this.  All should hopefully be good now, cheers for the bug report.

*** This bug has been marked as a duplicate of bug 78409 ***