Closed Bug 635010 Opened 13 years ago Closed 13 years ago

new Error(undefined).hasOwnProperty("message") should be false

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jorendorff, Unassigned)

References

Details

(Whiteboard: [fixed-in-tracemonkey])

Attachments

(1 file, 2 obsolete files)

We fail http://test262.ecmascript.org/ test S15.11.1.1_A1_T1.

Basically
  assertEq("message" in new Error(undefined), false);

I checked the spec. The test is right. We're wrong. 
http://people.mozilla.org/~jorendorff/es5.html#sec-15.11.1.1
S15.11.1.1_A1_T1 tests `Error(undefined)`.
S15.11.2.1_A1_T1 tests `new Error(undefined)`.

We fail both for the same reason.
Blocks: es5
Attachment #517275 - Flags: review?(jorendorff)
Attached patch v2 fixed bug + test (obsolete) — Splinter Review
Fixed bug regarding new Error(undefined), and added some test.
Attachment #517275 - Attachment is obsolete: true
Attachment #517275 - Flags: review?(jorendorff)
Attachment #517444 - Flags: review?(jorendorff)
Comment on attachment 517444 [details] [diff] [review]
v2 fixed bug + test

Thanks for the patch. I applied it... but it doesn't seem to fix the bug!

  js> assertEq("message" in new Error(undefined), false);
  typein:3: Error: Assertion failed: got true, expected false
  js> assertEq("message" in new Error(), false);
  typein:4: Error: Assertion failed: got true, expected false

Am I doing something wrong?

Note that tests under js/src/tests need to end with a line like:
  reportCompare(0, 0, 'ok');
and the test has to be added to the jstests.list file in the same directory.
Attachment #517444 - Flags: review?(jorendorff)
Attached patch v3 fixed testsSplinter Review
Oh sorry, forgot to mention this. The right test is actually, different, i checked test262, and they use this, too. I have no idea where the "in" came from.
 (new Error(undefined)).hasOwnProperty('message') => false
The "in" test makes no sense, because Error.prototype has an message property with an empty string as value.

My last patch is already a little while back, so i am already forgetting things, bad ;)
Attachment #517444 - Attachment is obsolete: true
Attachment #517444 - Flags: review?(jorendorff)
Comment on attachment 517745 [details] [diff] [review]
v3 fixed tests

That makes sense! Nice work.
Attachment #517745 - Flags: review+
http://hg.mozilla.org/tracemonkey/rev/2a7515434a1d
Summary: "message" in new Error(undefined) should be false → new Error(undefined).hasOwnProperty("message") should be false
Whiteboard: [fixed-in-tracemonkey]
Attachment #517444 - Flags: review?(jorendorff)
http://hg.mozilla.org/mozilla-central/rev/2a7515434a1d
Status: NEW → RESOLVED
Closed: 13 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: