Bug 147930

Summary: X.[[SetPrototypeOf]](Y) should succeed if X.[[Prototype]] is already Y even if X is not extensible
Product: WebKit Reporter: ziyunfei <446240525>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, sam, ysuzuki
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

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.