[Webkit-unassigned] [Bug 217051] New: A question about defineProperty of Proxy object

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 28 06:55:59 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=217051

            Bug ID: 217051
           Summary: A question about defineProperty of Proxy object
           Product: WebKit
           Version: WebKit Local Build
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: nisl_grammarly1 at 163.com

When calling "Object.defineProperty" as below, the internal method "[[DefineOwnProperty]" will be invoked.

According to ES10.0, when invoking the internal method "[[DefineOwnProperty]]" of the proxy object, the method "defineProperty" of proxy handler is called. So the overwritten property "defineProperty " below is called. And a false will be returned after using "ToBoolean" dealing with its return value, because the method's default return value is undefined.

Finally, a TypeError will be thrown as other engines(like V8,spiderMonkey and quickjs) do. 

But jsc didn't throw any error as my expection, Is there any information I have missed?

#### version
dbae081


#### command
webkit/WebKitBuild/Debug/bin/jsc testcase.js


#### testcase
function main() {
var handler = {defineProperty:function(){
        print("overwrite definedProperty");
        }
     };
var target = {"a":3};
var descBefore = Object.getOwnPropertyDescriptor(target,"a");
for(var j in descBefore){
  print(j,descBefore[j]);
        }

var p = new Proxy(target,handler);
var desc = {value:200};
var v21 = Object.defineProperty(p,"a",desc);
print(v21);

var descAfter = Object.getOwnPropertyDescriptor(target,"a");
for(var i in descAfter){
print(i,descAfter[i]);
        }
}
main();


#### output
value 3
writable true
enumerable true
configurable true
overwrite definedProperty
[object Object]
value 3
writable true
enumerable true
configurable true


#### expected output
value 3
writable true
enumerable true
configurable true
overwrite definedProperty
TypeError: proxy defineProperty handler returned false for property '"a"'


contributor:Yuan Wang

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200928/8c74b062/attachment.htm>


More information about the webkit-unassigned mailing list