Closed Bug 642274 Opened 13 years ago Closed 13 years ago

Provide a way to compare to jsvals with '=='

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: sdwilsh, Assigned: cdleary)

References

()

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

You can compare two jsvals strictly ('==='), but there is no API to do a simple equality comparison ('==').  This would be handy to have.
Assignee: general → cdleary
Attached patch Loose equality API. (obsolete) — Splinter Review
Attachment #520026 - Flags: review?(jwalden+bmo)
Forgot to hg add the tests.
Attachment #520026 - Attachment is obsolete: true
Attachment #520026 - Flags: review?(jwalden+bmo)
Attachment #520027 - Flags: review?(jwalden+bmo)
Comment on attachment 520027 [details] [diff] [review]
Loose equality API.

> bool
>+LooselyEqual(JSContext *cx, const Value &lval, const Value &rval, JSBool *result)

This should probably start off with the XML equality check, h8.

Arguably this should be always-inline for parity with current behavior, but if we can get away with not having to over-specify that, sounds good to me.  Keep an eye on perf numbers when you land this.

We have a somewhat strange way of phrasing the spec algorithm with respect to DefaultValue-ing and stuff.

Make sure to add documentation for this to MDN -- looks like you can just copy the JS_StrictlyEqual page and make a couple tweaks.
Attachment #520027 - Flags: review?(jwalden+bmo) → review+
http://hg.mozilla.org/tracemonkey/rev/cfe6c2e05c07 (backout due to test bustage)
Whiteboard: fixed-in-tracemonkey
When might this land again?
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: