Bug 36523
| Summary: | Parser allows getters/setters to have arguments, should throw | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Sam Sneddon [:gsnedders] <gsnedders> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED INVALID | ||
| Severity: | Normal | CC: | erights, ggaren, mjs, oliver |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Mac (Intel) | ||
| OS: | OS X 10.5 | ||
| URL: | http://stuff.gsnedders.com/es/getterparsing.html | ||
Sam Sneddon [:gsnedders]
Currently the JSC parser allows getters and setters to have arbitrary numbers of arguments passed to them: the ES5 spec only defines getters with no arguments (i.e., "()") and setters with a single argument; as such the current behaviour is an undocumented extension to the syntax of ES. Syntax extensions are inevitably the worst type of extension because they prevent all execution of the script in other engines that don't support them. It'd be preferably to only allow what the spec requires and throw SyntaxError in the other cases.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Oliver Hunt
We support arbitrary argument counts on getters/setters as it is necessary for firefox compatibility. You should probably bring this up on the es5-discuss list.
Mark S. Miller
The Mozilla bug https://bugzilla.mozilla.org/show_bug.cgi?id=554616 is still open and Brendan has stated that they intends to fix this, probably as soon as FF3.7. Thus, it is premature to close this bug as invalid.
Sam Sneddon [:gsnedders]
The Firefox bug is now closed (fixed in Fx4), so this is no longer invalid in terms of Fx-compat.
Mark S. Miller
(In reply to comment #3)
> The Firefox bug is now closed (fixed in Fx4), so this is no longer invalid in terms of Fx-compat.
Yes, this should be reopened. Version 5.0.1 (5533.17.8, r79488) still accepts "({get foo(x){}})", which must be rejected with an early SyntaxError, as FF4 does.