<?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>187092</bug_id>
          
          <creation_ts>2018-06-27 06:05:21 -0700</creation_ts>
          <short_desc>Inconsistent output compared with other JS engines</short_desc>
          <delta_ts>2020-06-07 10:01:52 -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>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <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>sunlili</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ashvayka</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1436924</commentid>
    <comment_count>0</comment_count>
    <who name="">sunlili</who>
    <bug_when>2018-06-27 06:05:21 -0700</bug_when>
    <thetext>Hello,
The following code behaves strangely (inconsistent with other engines).

v1 = new (Float64Array)();
v2 = {
    valueOf : function () {
        v3.y = &quot;bar&quot;;
        return 42; }
};
v3 = v1;
v3[0] = v2;
print(JSON.stringify(v1));

In Safari, output is
{&quot;y&quot;:&quot;bar&quot;}

However, in V8 and Firefox, output is
{}

BT group
2018.6.27</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1441088</commentid>
    <comment_count>1</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2018-07-10 20:44:46 -0700</bug_when>
    <thetext>For the reported issue, I think JSC&apos;s behavior is correct.
According to https://tc39.github.io/ecma262/#sec-integerindexedelementset, which is invoked by TypedArray&apos;s [[Set]],
we first perform `ToNumber(value)` at step 3 before checking length.
So, v2.valueOf should be executed. And v3.y should be set. Then, I think SpiderMonkey and V8 are wrong for this code.

BTW, when looking the code, I&apos;ve found that JSC does not have length check on [[DefineOwnProperty]] side before performing ToNumber.
I&apos;ll handle this case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1660092</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Shvayka">ashvayka</who>
    <bug_when>2020-06-07 10:01:52 -0700</bug_when>
    <thetext>(In reply to sunlili from comment #0)
&gt; However, in V8 and Firefox, output is
&gt; {}

Both Chrome 85 and Firefox 79 output `{&quot;y&quot;:&quot;bar&quot;}` now, just like Safari 13.1.
test262 coverage: https://test262.report/browse/built-ins/TypedArrayConstructors/internals/Set/tonumber-value-throws.js (last test case).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>