Bug 93873 - Object.prototype.__define{G,S}etter__ with non-callable second parameter should throw TypeError instead of SyntaxError
Summary: Object.prototype.__define{G,S}etter__ with non-callable second parameter shou...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: http://mathias.html5.org/specs/javasc...
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-13 11:29 PDT by Mathias Bynens
Modified: 2012-09-07 15:50 PDT (History)
6 users (show)

See Also:


Attachments
Fix (3.89 KB, patch)
2012-09-07 15:41 PDT, Gavin Barraclough
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias Bynens 2012-08-13 11:29:46 PDT
For compatibility with other ECMAScript engines, `Object.prototype.__defineGetter__` must behave as described here: http://mathias.html5.org/specs/javascript/#object.prototype.__definegetter__

JavaScriptCore has a minor bug where it throws a SyntaxError instead of a TypeError in cases like the following:

    var object = {};
    object.__defineGetter__('foo', '_');

Online tests: http://mathias.html5.org/tests/javascript/object/
Comment 1 Mathias Bynens 2012-08-13 11:39:54 PDT
So obvious I forgot to mention it, but the same goes for `Object.prototype.__defineSetter__`.
Comment 2 Gavin Barraclough 2012-08-13 12:21:37 PDT
Yup - syntax errors should all be early errors, doesn't sounds appropriate here.  We should make this a type error.  Thanks for the bug report!
Comment 3 Gavin Barraclough 2012-09-07 15:41:51 PDT
Created attachment 162885 [details]
Fix
Comment 4 Gavin Barraclough 2012-09-07 15:50:56 PDT
Fixed in r127930