[Webkit-unassigned] [Bug 59795] New: Inconsistent SyntaxError from new Function(...)
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Apr 29 07:38:32 PDT 2011
https://bugs.webkit.org/show_bug.cgi?id=59795
Summary: Inconsistent SyntaxError from new Function(...)
Product: WebKit
Version: 528+ (Nightly build)
Platform: Macintosh
OS/Version: Mac OS X 10.5
Status: UNCONFIRMED
Severity: Normal
Priority: P2
Component: JavaScriptCore
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: mikesamuel at gmail.com
Executing the Function constructor with a mis-parenthesized input thus
Function("(i + (j)")
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("return (i + (j)")
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("return (i + (j)")
Note that
var i = 1
var j = 2
typeof Function("return (i + (j)")()
evaluates normally with the string
"undefined"
not "number" as might be done if bad inputs are being intentionally massaged or a SyntaxError as might be done if parsing is intentionally done lazily.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list