Bug 147930 - X.[[SetPrototypeOf]](Y) should succeed if X.[[Prototype]] is already Y even if X is not extensible
Summary: X.[[SetPrototypeOf]](Y) should succeed if X.[[Prototype]] is already Y even i...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-12 01:12 PDT by ziyunfei
Modified: 2015-08-13 10:25 PDT (History)
3 users (show)

See Also:


Attachments
Patch (4.81 KB, patch)
2015-08-13 00:58 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ziyunfei 2015-08-12 01:12:12 PDT
js> var proto = {}
js> var obj = Object.preventExtensions(Object.create(proto))
js> Object.setPrototypeOf(obj ,proto)
TypeError: Attempted to assign to readonly property. // should return obj
js> Reflect.setPrototypeOf(obj, proto)
false // should be true
Comment 1 Yusuke Suzuki 2015-08-12 01:32:35 PDT
(In reply to comment #0)
> js> var proto = {}
> js> var obj = Object.preventExtensions(Object.create(proto))
> js> Object.setPrototypeOf(obj ,proto)
> TypeError: Attempted to assign to readonly property. // should return obj
> js> Reflect.setPrototypeOf(obj, proto)
> false // should be true

Nice catch!
We need to fix
1. Object.setPrototypeOf
2. Reflect.setPrototypeOf
3. object.__proto__ = ...
Comment 2 Yusuke Suzuki 2015-08-13 00:58:08 PDT
Created attachment 258886 [details]
Patch
Comment 3 Saam Barati 2015-08-13 07:59:36 PDT
Comment on attachment 258886 [details]
Patch

r=me
Comment 4 Yusuke Suzuki 2015-08-13 09:34:54 PDT
Comment on attachment 258886 [details]
Patch

Thank you!
Comment 5 WebKit Commit Bot 2015-08-13 10:25:24 PDT
Comment on attachment 258886 [details]
Patch

Clearing flags on attachment: 258886

Committed r188384: <http://trac.webkit.org/changeset/188384>
Comment 6 WebKit Commit Bot 2015-08-13 10:25:27 PDT
All reviewed patches have been landed.  Closing bug.