Closed Bug 601239 Opened 14 years ago Closed 14 years ago

Tabs in the "tabs" module don't support object identity comparison

Categories

(Add-on SDK Graveyard :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 598981

People

(Reporter: avarma, Assigned: irakli)

References

Details

Ben Stover and Daniel Buchner both reported to me confusion about the behavior of the tabs API, in that two Tab objects that actually represent the same tab can't be compared to each other using standard JS equality (neither '==' nor '===').

I think Ben said that he did some poking around in the code and found that new Tab objects were instantiated every time a Tab object was provided by the API, which was why the comparison wasn't working.
At the very least, if we can't get object identity comparison working, it'd be nice to have an "id" property on the object or somesuch.
On the Window API I needed a way to map the high-level object wrappers back to the actual XULWindow objects, so a mix of a cache/hash was used. One of the benefits of that is that it avoids creating a wrapper more than once, as it's possible to retrieve the one that was created, which makes the objects comparable.

http://github.com/mozillalabs/jetpack-sdk/blob/master/packages/addon-kit/lib/windows.js#L166
Assignee: nobody → rFobic
I'm working on tab related stuff so I'll take care of this one as well.
Depends on: 598981
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
Making this a duplicate for 598981 since it includes fix for this.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.