Closed Bug 1134630 Opened 9 years ago Closed 8 years ago

browserWindows.length is undefined with no windows open

Categories

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

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jamie, Unassigned)

Details

(Whiteboard: [good first bug])

Attachments

(3 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.3.18 (KHTML, like Gecko) Version/8.0.3 Safari/600.3.18

Steps to reproduce:

1Password receives messages over a WebSocket connection, which can occur whether there are tabs or windows open or not. When we receive a message to open a URL, we need to check if there are any windows open in order to understand how to handle the message. So, we followed the documentation here[^1] and used

    windows.browserWindows.length

[^1]: https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/windows#browserWindows


Actual results:

With no windows open, windows.browserWindows.length returns undefined


Expected results:

windows.browserWindows.length should return 0 (zero)
Severity: normal → minor
Priority: -- → P2
Whiteboard: [good first bug]
Can I try to work on this bug?
Simply initialized windows list to have length 0.
Attachment #8589975 - Flags: review+
I'll like to work on this bug. I'm new on Bugzilla.
Comment on attachment 8589975 [details] [diff] [review]
windowLength.patch

Sorry, it looks like this patch was not generated correctly and does not contain any changes (except an extra space character added in utils.js).
Attachment #8589975 - Flags: review+ → review-
As no one has taken this bug, I would like to work on it.
Attached patch ClosedWindowLength.patch (obsolete) — Splinter Review
Initialized list.length to zero.Kindly review the patch and suggest modifications/further steps
Please review the patch and suggest further steps.
Attachment #8714061 - Attachment is obsolete: true
Attachment #8718362 - Flags: review?(mbrubeck)
Comment on attachment 8718362 [details] [diff] [review]
ClosedWindowLength.patch

Passing review to Mossop.

Also, it looks like this patch might need to land in the addon-sdk Git repository first:
https://github.com/mozilla/addon-sdk/blob/master/CONTRIBUTING.md
Attachment #8718362 - Flags: review?(mbrubeck) → review?(dtownsend)
Comment on attachment 8718362 [details] [diff] [review]
ClosedWindowLength.patch

Review of attachment 8718362 [details] [diff] [review]:
-----------------------------------------------------------------

I don't understand what effect this would have. Empty arrays already have a length of zero so this seems like it wouldn't do anything to me.
Attachment #8718362 - Flags: review?(dtownsend)
Sorry guys, it might be irrelevant, but how we can have no windows opened while Firefox is opened?
Flags: needinfo?(jamie)
(In reply to Mohsen Keyhani from comment #10)
> Sorry guys, it might be irrelevant, but how we can have no windows opened
> while Firefox is opened?

If you close all tabs there are no windows, however firefox is not closed. At least not on OS X and Linux, the application thread is still running
I was trying to replicate the bug on a Mac book with OS X El Capitan and Firefox 43.0.4 using this but I failed to do so. When I closed all the windows, it just printed 0 which is the expected behavior. Can anybody give me some more details about the situation in which this bug happens?
Attachment #8725002 - Flags: feedback?(jamie)
(In reply to Mohsen Keyhani from comment #12)
> Created attachment 8725002 [details]
> Trying to replicate the bug, a bare-bone extension which prints the number
> of open windows
> 
> I was trying to replicate the bug on a Mac book with OS X El Capitan and
> Firefox 43.0.4 using this but I failed to do so. When I closed all the
> windows, it just printed 0 which is the expected behavior. Can anybody give
> me some more details about the situation in which this bug happens?
I have not been able to reproduce it either. 
Have you read the user story? States pretty explicit the user agent, and what happens
Thanks for the attention on this bug. I just tried reproducing it with a sample add-on and I wasn't able to reproduce it either at this time in Firefox 44.0.2. 

Perhaps something changed in Add-on SDK in the last year that affected this. I tried locating it but I still find the source pretty hard to navigate to find where things are initialized.

I did notice, though, that there isn't a test specific to this scenario in the Add-on SDK, so perhaps that's something worth pursuing.
Flags: needinfo?(jamie)
Comment on attachment 8725002 [details]
Trying to replicate the bug, a bare-bone extension which prints the number of open windows

I'm no longer able to reproduce this bug either. It's been quite some time, so I think it's best to let it be considered moot and see if anything re-emerges.
Attachment #8725002 - Flags: feedback?(jamie) → feedback-
Attachment #8725002 - Flags: feedback- → feedback+
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: