<?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>59795</bug_id>
          
          <creation_ts>2011-04-29 07:38:32 -0700</creation_ts>
          <short_desc>Inconsistent SyntaxError from new Function(...)</short_desc>
          <delta_ts>2012-03-11 12:53:04 -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>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</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>0</everconfirmed>
          <reporter name="mikesamuel@gmail.com">mikesamuel</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>barraclough</cc>
    
    <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>395258</commentid>
    <comment_count>0</comment_count>
    <who name="mikesamuel@gmail.com">mikesamuel</who>
    <bug_when>2011-04-29 07:38:32 -0700</bug_when>
    <thetext>Executing the Function constructor with a mis-parenthesized input thus
    Function(&quot;(i + (j)&quot;)
exits abruptly with a SyntaxError:
    SyntaxError: Parse error

Executing the same but with the return keyword before the mis-parenthesized expression does not error out:
    Function(&quot;return (i + (j)&quot;)
evaluates normally with the value
    function anonymous() { return (i + (j);
    }

I expected the first example and the second example to both produce a SyntaxError.
I.e., if this is fixed, I expect
    Function(&quot;return (i + (j)&quot;)


Note that
    var i = 1
    var j = 2
    typeof Function(&quot;return (i + (j)&quot;)()
evaluates normally with the string
    &quot;undefined&quot;
not &quot;number&quot; as might be done if bad inputs are being intentionally massaged or a SyntaxError as might be done if parsing is intentionally done lazily.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>575821</commentid>
    <comment_count>1</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2012-03-11 12:53:04 -0700</bug_when>
    <thetext>Looks like these have been fixed, added the extra test cases in r110398</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>