I'm creating a Firefox extension, in which I want to iterate through the Application.windows
array and check if one of its elements is the same as Application.activeWindow
.
The mentioned excerpt from my code looks like this:
for (var i in Application.windows) {
if (Application.windows[i]==Application.activeWindow) alert('debug');
// there was some more complex code than alert('debug'),
// but since it didn't work, I decided to try with an alert
}
Unfortunately, the 'debug' alert is never viewed. Thus I decided to try this code (with only one window opened):
// the following code runs in an event listener for window.onload
alert(Application.windows[0]);
alert(Application.activeWindow);
alert(Application.windows[0]==Application.activeWindow);
Firefox displayed 3 alerts: the first one was [object Object]
, the second one - [xpconnect wrapped fuelIWindow]
, and the last one (which didn't surprise me) said false
. So it seems the objects I'm trying to compare have different types. How can I deal with this? Thanks in advance.