Closed Bug 887521 Opened 11 years ago Closed 11 years ago

Differential Testing: Different error message involving Object.preventExtensions

Categories

(Core :: JavaScript Engine, defect)

x86_64
macOS
defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: gkw, Assigned: jandem)

Details

(Keywords: testcase)

Attachments

(1 file)

Object.preventExtensions = 1
function f() {
    Object.preventExtensions()
}
for each(w in [0, 0]) {
    try {
        f()
    } catch (e) {
        print(e)
    }
}

shows the following on a 64-bit deterministic threadsafe js shell on m-c rev 61c3c8b85563:

TypeError: undefined is not a function
TypeError: undefined is not a function

but shows the following with --ion-eager:

TypeError: undefined is not a function
TypeError: 1 is not a function


This seems to be an old bug. Setting needinfo for jandem as this may cloud other correctness bugs.
Flags: needinfo?(jdemooij)
Attached patch PatchSplinter Review
When js::OnUnknownMethod does not find a __noSuchMethod__ property, it sets vp (the result of the CALLPROP) to the result of the __noSuchMethod__ lookup. This makes no sense to me and the patch changes it to not touch vp in that case.

This means if you do:

Object.foo = 1;
Object.foo();

The error now says "1 is not a function" instead of "undefined is not a function". This only happens in more-deterministic shells though, in normal shells the expression decompiler turns it into "Object.foo is not a function" so it's hard to add a testcase for this.
Assignee: general → jdemooij
Status: NEW → ASSIGNED
Attachment #768274 - Flags: review?(jwalden+bmo)
Flags: needinfo?(jdemooij)
You could make a test whose skip or expected depends on 
getBuildConfiguration()["more-deterministic"]
Comment on attachment 768274 [details] [diff] [review]
Patch

Review of attachment 768274 [details] [diff] [review]:
-----------------------------------------------------------------

wat
Attachment #768274 - Flags: review?(jwalden+bmo) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/911c3a79cefa

(In reply to Jesse Ruderman from comment #2)
> You could make a test whose skip or expected depends on 
> getBuildConfiguration()["more-deterministic"]

Last time I tested it, more-deterministic shells fail various tests (enumeration order etc?) and nobody will notice if it breaks, so I didn't bother.
https://hg.mozilla.org/mozilla-central/rev/911c3a79cefa
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: