<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>217051</bug_id>
          
          <creation_ts>2020-09-28 06:55:59 -0700</creation_ts>
          <short_desc>A question about defineProperty of Proxy object</short_desc>
          <delta_ts>2020-09-29 12:44:16 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Local Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>210267</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="NWU_NISL">nisl_grammarly1</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ashvayka</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1692533</commentid>
    <comment_count>0</comment_count>
    <who name="NWU_NISL">nisl_grammarly1</who>
    <bug_when>2020-09-28 06:55:59 -0700</bug_when>
    <thetext>When calling &quot;Object.defineProperty&quot; as below, the internal method &quot;[[DefineOwnProperty]&quot; will be invoked.

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

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

But jsc didn&apos;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(&quot;overwrite definedProperty&quot;);
        }
     };
var target = {&quot;a&quot;:3};
var descBefore = Object.getOwnPropertyDescriptor(target,&quot;a&quot;);
for(var j in descBefore){
  print(j,descBefore[j]);
	}

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

var descAfter = Object.getOwnPropertyDescriptor(target,&quot;a&quot;);
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 &apos;&quot;a&quot;&apos;


contributor:Yuan Wang</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1693092</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Shvayka">ashvayka</who>
    <bug_when>2020-09-29 12:44:16 -0700</bug_when>
    <thetext>(In reply to NWU_NISL from comment #0)
&gt; But jsc didn&apos;t throw any error as my expection, Is there any information I
&gt; have missed?

Thank you for detailed bug report.
You are absolutely right, a TypeError should be thrown because the trap didn&apos;t return a truthy value.
r259822 fixed ProxyObject::performDefineOwnProperty() to do that, aligning JSC with other engines.

&gt; #### version
&gt; dbae081

This appears to be referring to https://github.com/WebKit/webkit/commit/dbae081ad7e22d9ab61edf2f337f6c2bb593c7f8,
which was 6 weeks after the fix. Are we sure it&apos;s correct?

I can confirm the bug reproducing in Safari 13.1.2, yet fixed in TP 113.

*** This bug has been marked as a duplicate of bug 210267 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>