Closed Bug 556876 Opened 14 years ago Closed 14 years ago

PropertyDescriptor::initialize can throw a SyntaxError instead of a TypeError

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: jorendorff, Assigned: Waldo)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

js> Object.defineProperty({}, "p", {get: 23})
typein:1: SyntaxError: invalid getter usage

The error message itself should probably say "invalid getter" at worst. Of course in Ponyland it would say something like,

  The property descriptor is invalid. The "get" field must be either
  a function or undefined, not 23.

Ponyland is so nice.
Summary: PropertySpec::initialize can throw a SyntaxError → PropertyDescriptor::initialize can throw a SyntaxError instead of a TypeError
Attached patch Patch and testsSplinter Review
I'd really thought I was doing this error-type checking already, but I guess not.
Attachment #436798 - Flags: review?(jorendorff)
Attachment #436798 - Flags: review?(jorendorff) → review+
http://hg.mozilla.org/tracemonkey/rev/988aee821e1c
Status: NEW → ASSIGNED
Whiteboard: fixed-in-tracemonkey
Target Milestone: --- → mozilla1.9.3a5
http://hg.mozilla.org/mozilla-central/rev/988aee821e1c
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: