<?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>213023</bug_id>
          
          <creation_ts>2020-06-10 07:07:02 -0700</creation_ts>
          <short_desc>An issue about String.prototype.replace</short_desc>
          <delta_ts>2020-06-12 02:10:54 -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>205785</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</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="Yusuke Suzuki">ysuzuki</assigned_to>
          <cc>ashvayka</cc>
    
    <cc>fpizlo</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1661147</commentid>
    <comment_count>0</comment_count>
    <who name="NWU_NISL">nisl_grammarly1</who>
    <bug_when>2020-06-10 07:07:02 -0700</bug_when>
    <thetext>According to ES10.0, &quot;String.prototype.replace(searchValue,replaceValue)&quot; will return a new string which matches of &quot;searchValue&quot; is replaced by &quot;replaceValue&quot;. But when &quot;relpaceValue&quot; is a string with &quot;$&lt;&quot; and &quot;searchValue&quot; is &quot;/a/&quot;, the result is wrong. This is an issue of &quot;String.prototype.replace&quot;.

#### version
d940b47


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


#### testcase
var NISLFuzzingFunc = function(){
    var result = &quot;a&quot;.replace(/a/,&quot;AAAA$&lt;AAAA&quot;);
    print(result);
};
NISLFuzzingFunc();


#### output
$&lt;AAAA


#### expected output
AAAA$&lt;AAAA


Contributor:Yuan Wang</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1661812</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-06-11 18:07:00 -0700</bug_when>
    <thetext>&lt;rdar://problem/64278675&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1661886</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Shvayka">ashvayka</who>
    <bug_when>2020-06-12 02:10:54 -0700</bug_when>
    <thetext>(In reply to NWU_NISL from comment #0)
&gt; #### version
&gt; d940b47

This appears to be GitHub WebKit mirror commit hash (rather than git-svn): https://github.com/WebKit/webkit/commit/d940b477848884f63752d25491d9dd0b9d3ccb2d, which points to r246052 (Jun 3, 2019).

&gt; #### expected output
&gt; AAAA$&lt;AAAA

The issue was fixed in r254088 (Jan 6, 2020): I&apos;ve confirmed that JSC outputs expected &quot;AAAA$&lt;AAAA&quot; since this revision, yet &quot;$&lt;AAAA&quot; before it.

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

    </bug>

</bugzilla>