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

RESOLVED WONTFIX

Status

RESOLVED WONTFIX
6 years ago
a year ago

People

(Reporter: Waldo, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
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
Last Resolved: a year ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.