Bug 171915

Summary: [JSC] Proxy's GetPrototypeOf does not invoked during access to __proto__ property
Product: WebKit Reporter: GSkachkov <gskachkov>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: keith_miller, saam, ysuzuki
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 169040    
Bug Blocks:    

GSkachkov
Reported 2017-05-10 01:48:37 PDT
Also I found interesting behavior of proxy: ``` var target = {}; proxy = new Proxy(target, { getPrototypeOf(t) { console.log("get prototype:", t); return t.__proto__; } }); proxy.__proto__ === target.__proto__; ``` In Chrome & FireFox it prints: // get prototype: .... // Object ... In jsc we do not print `get prototype: ....`, just `Object ...`
Attachments
Saam Barati
Comment 1 2017-05-10 09:39:42 PDT
Maybe we don't properly forward the receiver? I think this code should definitely go down the get() path in Proxy, but maybe the issue is we don't call get() on target in the correct way.
GSkachkov
Comment 2 2017-05-10 09:46:26 PDT
(In reply to Saam Barati from comment #1) > Maybe we don't properly forward the receiver? > I think this code should definitely go down the get() path in Proxy, but > maybe the issue is we don't call get() on target in the correct way. Hmm, It seems that you right. If I add get, it start invoke getPrototypeOf ``` var target = {}; var proxy = new Proxy(target, { getPrototypeOf(t, ) { print("get prototype:", t); return t; }, get(t, property, receiver) { print("get", property); return Reflect.get(t, property, receiver); } }); ``` Output: >>> proxy.__proto__ get __proto__ get prototype: [object Object] [object Object]
GSkachkov
Comment 3 2017-05-10 13:25:59 PDT
(In reply to Saam Barati from comment #1) > Maybe we don't properly forward the receiver? > I think this code should definitely go down the get() path in Proxy, but > maybe the issue is we don't call get() on target in the correct way. In casa if we use only getPrototypeOf handler, we just call target->get() for __proto__ property in performProxyGet, so we forget that we are executing in proxy context, that why we do not call proxy getPrototypeOf handler, but according to spec we should invoke target.[[Get]](P, Receiver) - where Receiver is current Proxy. So I think we need create new method for JSObject that support Receiver as the parameter
GSkachkov
Comment 4 2017-05-30 12:18:10 PDT
Fixed by bug 164849 *** This bug has been marked as a duplicate of bug 164849 ***
Note You need to log in before you can comment on or make changes to this bug.