<?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>188874</bug_id>
          
          <creation_ts>2018-08-22 17:49:37 -0700</creation_ts>
          <short_desc>Function object should convert params to string before throw a parsing error</short_desc>
          <delta_ts>2018-09-01 01:04:17 -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>Safari 11</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>macOS 10.13</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <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="Sotero Jr">srsj2</reporter>
          <assigned_to name="Yusuke Suzuki">ysuzuki</assigned_to>
          <cc>darin</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>fpizlo</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1452914</commentid>
    <comment_count>0</comment_count>
    <who name="Sotero Jr">srsj2</who>
    <bug_when>2018-08-22 17:49:37 -0700</bug_when>
    <thetext>Hi everyone,

I found out an inconsistency in JSC when we declare a Function Object with a special characters as params.

Version: 235121
O.S: MacOS High Sierra Version 10.13.6

step to reproduce:
assertThrowsValue(() =&gt; Function(&quot;@&quot;, { toString() { throw 42; } }), 42);

atual result: 
SyntaxError: Invalid character: &apos;@&apos;

expected result:
pass without failures

V8, Chakra and SpiderMonkey works as expected 

cinfuzz</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1453670</commentid>
    <comment_count>1</comment_count>
      <attachid>348075</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2018-08-24 23:32:42 -0700</bug_when>
    <thetext>Created attachment 348075
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1453699</commentid>
    <comment_count>2</comment_count>
      <attachid>348075</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2018-08-25 17:23:50 -0700</bug_when>
    <thetext>Comment on attachment 348075
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=348075&amp;action=review

&gt; Source/JavaScriptCore/ChangeLog:9
&gt; +        ToString operation onto the `body` of the Function constructor should be performed
&gt; +        before checking syntax correctness of the parameters.

I have no doubt that this is better, but I wonder where these semantics are defined and tested unambiguously. There must be lots of other cases where the order of evaluation side effect is visible, and the new test covers just this one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1454733</commentid>
    <comment_count>3</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2018-08-28 23:14:41 -0700</bug_when>
    <thetext>(In reply to Darin Adler from comment #2)
&gt; Comment on attachment 348075 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=348075&amp;action=review
&gt; 
&gt; &gt; Source/JavaScriptCore/ChangeLog:9
&gt; &gt; +        ToString operation onto the `body` of the Function constructor should be performed
&gt; &gt; +        before checking syntax correctness of the parameters.
&gt; 
&gt; I have no doubt that this is better, but I wonder where these semantics are
&gt; defined and tested unambiguously. There must be lots of other cases where
&gt; the order of evaluation side effect is visible, and the new test covers just
&gt; this one.

It&apos;s defined here:
https://tc39.github.io/ecma262/#sec-createdynamicfunction

I agree that it would be nice to add some more tests that stress the order of evaluation, including the order of toString on the parameters.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1455954</commentid>
    <comment_count>4</comment_count>
      <attachid>348075</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2018-09-01 01:02:58 -0700</bug_when>
    <thetext>Comment on attachment 348075
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=348075&amp;action=review

Thanks!

&gt;&gt;&gt; Source/JavaScriptCore/ChangeLog:9
&gt;&gt;&gt; +        before checking syntax correctness of the parameters.
&gt;&gt; 
&gt;&gt; I have no doubt that this is better, but I wonder where these semantics are defined and tested unambiguously. There must be lots of other cases where the order of evaluation side effect is visible, and the new test covers just this one.
&gt; 
&gt; It&apos;s defined here:
&gt; https://tc39.github.io/ecma262/#sec-createdynamicfunction
&gt; 
&gt; I agree that it would be nice to add some more tests that stress the order of evaluation, including the order of toString on the parameters.

I&apos;ve added the test checking the order of toString onto the arguments of Function constructor.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1455955</commentid>
    <comment_count>5</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2018-09-01 01:03:48 -0700</bug_when>
    <thetext>Committed r235582: &lt;https://trac.webkit.org/changeset/235582&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1455956</commentid>
    <comment_count>6</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2018-09-01 01:04:17 -0700</bug_when>
    <thetext>&lt;rdar://problem/43989360&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>348075</attachid>
            <date>2018-08-24 23:32:42 -0700</date>
            <delta_ts>2018-08-25 17:23:50 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-188874-20180825153241.patch</filename>
            <type>text/plain</type>
            <size>3545</size>
            <attacher name="Yusuke Suzuki">ysuzuki</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjM1MzM4CmR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AgICBmdW5jKCk7CisgICAgfSBjYXRjaCAoZSkgeworICAgICAg
ICBlcnJvclRocm93biA9IHRydWU7CisgICAgICAgIGVycm9yID0gZTsKKyAgICB9CisgICAgaWYg
KCFlcnJvclRocm93bikKKyAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdub3QgdGhyb3duJyk7Cisg
ICAgaWYgKFN0cmluZyhlcnJvcikgIT09IGVycm9yTWVzc2FnZSkKKyAgICAgICAgdGhyb3cgbmV3
IEVycm9yKGBiYWQgZXJyb3I6ICR7U3RyaW5nKGVycm9yKX1gKTsKK30KKworc2hvdWxkVGhyb3co
KCkgPT4geworICAgIEZ1bmN0aW9uKCJAIiwgeyB0b1N0cmluZygpIHsgdGhyb3cgNDI7IH0gfSkK
K30sIGA0MmApOwo=
</data>
<flag name="review"
          id="365766"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>