Closed Bug 880798 Opened 11 years ago Closed 6 years ago

xpcshell eq/neq functions should do SameValue comparisons, not ==/!= comparisons

Categories

(Testing :: XPCShell Harness, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: Waldo, Unassigned)

Details

The SameValue algorithm is:

  function SameValue(v1, v2)
  {
    if (v1 === 0 && v2 === 0)
      return 1 / v1 === 1 / v2;
    if (v1 !== v1 && v2 !== v2)
      return true;
    return v1 === v2;
  }

Unlike ==, it doesn't do any coercions before comparing.  And unlike ===, it treats NaN as the same as NaN, and it treats +0 as the same as +0, and -0 as the same as -0, but it treats -0 as different from +0.

== is clearly the wrong thing given its extra coercions.  === is better, but still not quite right, as anyone testing for NaN would discover, or for testing of methods expecting particularly-signed zeroes.

This will probably require fixing up some tests, but I'd doubt it'd be too much work.
Mass closing bugs with no activity in 2+ years. If this bug is important to you, please re-open.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.