Open Bug 1423721 Opened 7 years ago Updated 1 year ago

Inconsistent error message for "instanceof" right-hand-side.

Categories

(Core :: JavaScript Engine, enhancement, P5)

enhancement

Tracking

()

People

(Reporter: nbp, Unassigned)

References

(Blocks 1 open bug)

Details

Currently, we have 2 different error messages for instanceof right-hand-side: TypeError: invalid 'instanceof' operand … TypeError: … is not a function I suggest to replace both of these messages by a single one which says: TypeError: invalid right-hand-side operand of 'instanceof', expected a function, got … js> 4 instanceof 5 TypeError: invalid 'instanceof' operand 5 js> [1,2,3] instanceof []; TypeError: [] is not a function js> [1,2,3] instanceof [] TypeError: [] is not a function js> [1,2,3] instanceof {} TypeError: ({}) is not a function js> [1,2,3] instanceof "" TypeError: invalid 'instanceof' operand "" js> var x = []; js> [1,2,3] instanceof x TypeError: x is not a function
Priority: -- → P4
Severity: normal → S3
Priority: P4 → P5

sometimes websites use the error message as condition, and changing the error message can result in breakage.
e.g. bug 1259822 caused bug 1490772, bug 1498257, and bug 1512401

while it's nice to improve the error message, we should prepare for breakage and fallback plan.

Blocks: jserror
You need to log in before you can comment on or make changes to this bug.