Closed Bug 126722 Opened 23 years ago Closed 23 years ago

(undefined === null) evaluating to true in Rhino compiled mode

Categories

(Rhino Graveyard :: Core, defect)

x86
Windows NT
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: pschwartau, Assigned: norrisboyd)

Details

I have a testcase which examines (undefined === null), expecting this to be false. It passes in the SpiderMonkey shell and in Rhino interpreted mode, but it's failing in Rhino compiled mode. I will check the testcase into CVS and give the path for it below -
Testcase added to JS testsuite: mozilla/js/tests/ecma_3/Expressions/11.9.6-1.js It is named after Section 11.9.6 in the ECMA-262 Edition 3 Final: 11.9.6 The Strict Equality Comparison Algorithm The comparison x === y, where x and y are values, produces true or false. Such a comparison is performed as follows: 1. If Type(x) is different from Type(y), return false. 2. If Type(x) is Undefined, return true. 3. If Type(x) is Null, return true. etc. etc. Since typeof undefined = 'undefined', and typeof null = 'object', I would expect (undefined === null) to be false by Step 1.
Here are the command lines I'm using: cd mozilla/js/tests TEST PASSES: perl jsDriver.pl -e rhinoi -f TEST.html -k -l ecma_3/Expressions/11.9.6-1.js TEST FAILS: perl jsDriver.pl -e rhino -f TEST.html -k -l ecma_3/Expressions/11.9.6-1.js Engine command line: java org.mozilla.javascript.tools.shell.Main OS type: WIN java full version "1.3.0_01" Failure Details Testcase ecma_3/Expressions/11.9.6-1.js failed Bug Number 126722 STATUS: Testing the comparison |undefined === null| Failure messages were: FAILED!: [reported from test()] Section 1 of test - FAILED!: [reported from test()] Expected value 'false', Actual value 'true' FAILED!: [reported from test()] FAILED!: [reported from test()] Section 2 of test - FAILED!: [reported from test()] Expected value 'false', Actual value 'true' FAILED!: [reported from test()] FAILED!: [reported from test()] Section 3 of test - FAILED!: [reported from test()] Expected value 'false', Actual value 'true' FAILED!: [reported from test()] FAILED!: [reported from test()] Section 4 of test - FAILED!: [reported from test()] Expected value 'false', Actual value 'true' FAILED!: [reported from test()]
Fixed: Checking in optimizer/Codegen.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java,v < -- Codegen.java new revision: 1.53; previous revision: 1.52 done
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Reopening. I'm still getting a failure on Section 1 of the testcase: java -jar build/rhino1_5R4pre/js.jar -f ../tests/ecma_3/shell.js -f ../tests/ecma_3/Expressions/11.9.6-1.js BUGNUMBER: 126722 STATUS: Testing the comparison |undefined === null| FAILED!: [reported from test()] Section 1 of test - FAILED!: [reported from test()] Expected value 'false', Actual value 'true' Section 1 is as follows: if (undefined === null) actual = true; else actual = false; expect = false;
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Thanks--missed one codepath. Checking in Codegen.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java,v < -- Codegen.java new revision: 1.54; previous revision: 1.53 done
Status: REOPENED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → FIXED
Marking Verified FIXED. The testcase now passes in both the rhino and rhinoi shells on WinNT -
Status: RESOLVED → VERIFIED
Targeting as resolved against 1.5R4
Target Milestone: --- → 1.5R4
You need to log in before you can comment on or make changes to this bug.