Closed Bug 574867 Opened 14 years ago Closed 14 years ago

<NativeError>.prototype.message properties should be own, not simply visible to users because they're on Error.prototype

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b1

People

(Reporter: Waldo, Assigned: Waldo)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

Attached patch PatchSplinter Review
The MS ES5 test suite checks for this, ES5 is clear enough about what should happen.
Attachment #454174 - Flags: review?(lw)
Attachment #454174 - Flags: review?(lw) → review+
Comment on attachment 454174 [details] [diff] [review]
Patch

>         /* Make the prototype for the current constructor name. */
>-        proto = NewObject(cx, &js_ErrorClass,
>-                          (i != JSEXN_ERR) ? error_proto : obj_proto,
>-                          obj);
>+        JSObject *proto = NewObject(cx, &js_ErrorClass,
>+                                    (i != JSEXN_ERR) ? error_proto : obj_proto, obj);

Declaring at first assignment is great, thanks for that -- but prevailing style favors keeping that final obj arg on its own line. Once an overlong argument has forced a line break, the shorties get their own lines (they can share if adjacent, maybe; judgment call). The above loses the final arg in an expression that's long enough the comma hides.

Good fix, this is way old code, from 1998 or 1999. Did ES3 differ?

/be
Attachment #454174 - Flags: review+ → review?(lw)
Attachment #454174 - Flags: review?(lw) → review+
http://hg.mozilla.org/tracemonkey/rev/a8211f428f21

ES3 said the same.

Even better here seems to move the whole expression down a line and indent it, then there's no need for a visually-disruptive line break at all.
Whiteboard: fixed-in-tracemonkey
(In reply to comment #2)
> http://hg.mozilla.org/tracemonkey/rev/a8211f428f21
> 
> ES3 said the same.

That slacker mccabe :-P.

> Even better here seems to move the whole expression down a line and indent it,
> then there's no need for a visually-disruptive line break at all.

Not bad -- better sometimes, but over-complicates args can merit their own lines even if all would fit on one line with little else. Nice patch anyway, in the end; thanks.

/be
http://hg.mozilla.org/mozilla-central/rev/a8211f428f21
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: