Closed
Bug 281606
Opened 20 years ago
Closed 19 years ago
instanceof does not throw exception for objects not implementing [[HasInstance]] method
Categories
(Core :: JavaScript Engine, defect, P4)
Tracking
()
VERIFIED
FIXED
mozilla1.8beta2
People
(Reporter: sukhisoul, Assigned: brendan)
Details
(Keywords: js1.5, Whiteboard: [have patch])
Attachments
(1 file)
4.01 KB,
patch
|
shaver
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; H010818) Build Identifier: According to specs -- section 11.8.6 of ECMA-262 -- instanceof operator on objects NOT implementing [[HasInstance]] internal method should throw a TypeError exception. Hence, in the following script the catch block must get executed, (since Math object does not implement [[HasInstance]] method). var varBool1; var objNumber = new Number(5); try{ /* Math object can not be used for instantiation */ /* Hence, TypeError */ varBool1 = objNumber instanceof Math; } catch(e){ print("Exception " + e.name + "occurred"); } Reproducible: Always Steps to Reproduce: 1. Copy the following script in a file, say t.js var varBool1; var objNumber = new Number(5); try{ /* Math object can not be used for instantiation */ /* Hence, TypeError */ varBool1 = objNumber instanceof Math; } catch(e){ print("Exception " + e.name + "occurred"); } 2. Launch Spidermonkey shell with above script-file as input. eg. js t.js 3. Watch the output on the screen Actual Results: Nothing was printed on screen Expected Results: Should have printed following: Exception TypeError occurred
Assignee | ||
Updated•20 years ago
|
Assignee: general → brendan
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: js1.5
Priority: -- → P4
Target Milestone: --- → mozilla1.8beta2
Assignee | ||
Comment 1•20 years ago
|
||
Reporter: no need for "STD Non-Compliance: " at the start of the summary. /be
Status: NEW → ASSIGNED
Summary: STD Non-Compliance: instanceof does not throw exception for objects not implementing [[HasInstance]] method → instanceof does not throw exception for objects not implementing [[HasInstance]] method
Assignee | ||
Comment 2•20 years ago
|
||
Attachment #173932 -
Flags: review?(shaver)
Assignee | ||
Updated•20 years ago
|
Whiteboard: [have patch]
Comment on attachment 173932 [details] [diff] [review] fix r=shaver
Attachment #173932 -
Flags: review?(shaver) → review+
Assignee | ||
Comment 4•19 years ago
|
||
Fixed. Bob, do you want to take over QA Contact for "JavaScript Engine" from pschwartau@meer.net? /be
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 5•19 years ago
|
||
If that is ok with Phil, I would be happy to be qa.
Comment 6•19 years ago
|
||
the second testcase in ecma_2/instanceof/instanceof-003.js is invalid. o = {}; o instanceof o
Comment 7•19 years ago
|
||
the second testcase in js/tests/ecma_2/instanceof/regress-7635.js is a repeat of the o = {}; o instanceof o which is invalid after this bug fix. checked in. js/tests/js1_5/Regress/regress-281606.js checked in with Milind <sukhisoul@yahoo.com> as primary contributor.
Comment 8•19 years ago
|
||
/cvsroot/mozilla/js/tests/ecma_2/instanceof/instanceof-003.js,v <-- instanceof-003.js new revision: 1.2; previous revision: 1.1
Updated•19 years ago
|
Flags: testcase+
Comment 9•18 years ago
|
||
verified fixed 1.8.0.2,1.8,1.9a1 20060401 win/mac/linux
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•