Bug 93873

Summary: Object.prototype.__define{G,S}etter__ with non-callable second parameter should throw TypeError instead of SyntaxError
Product: WebKit Reporter: Mathias Bynens <mathias>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, ap, barraclough, mathias, oliver, peter
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://mathias.html5.org/specs/javascript/#object.prototype.__definegetter__
Attachments:
Description Flags
Fix sam: review+

Mathias Bynens
Reported 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/
Attachments
Fix (3.89 KB, patch)
2012-09-07 15:41 PDT, Gavin Barraclough
sam: review+
Mathias Bynens
Comment 1 2012-08-13 11:39:54 PDT
So obvious I forgot to mention it, but the same goes for `Object.prototype.__defineSetter__`.
Gavin Barraclough
Comment 2 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!
Gavin Barraclough
Comment 3 2012-09-07 15:41:51 PDT
Gavin Barraclough
Comment 4 2012-09-07 15:50:56 PDT
Fixed in r127930
Note You need to log in before you can comment on or make changes to this bug.