Bug 36523 - Parser allows getters/setters to have arguments, should throw
Summary: Parser allows getters/setters to have arguments, should throw
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.5
: P2 Normal
Assignee: Nobody
URL: http://stuff.gsnedders.com/es/getterp...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-24 05:14 PDT by Sam Sneddon [:gsnedders]
Modified: 2011-02-23 23:14 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Sneddon [:gsnedders] 2010-03-24 05:14:10 PDT
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.
Comment 1 Oliver Hunt 2010-03-24 11:18:46 PDT
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.
Comment 2 Mark S. Miller 2010-03-30 12:05:25 PDT
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.
Comment 3 Sam Sneddon [:gsnedders] 2011-02-23 17:08:02 PST
The Firefox bug is now closed (fixed in Fx4), so this is no longer invalid in terms of Fx-compat.
Comment 4 Mark S. Miller 2011-02-23 23:14:00 PST
(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.