Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"this.menuCommanders is undefined" when closing a browser window #1087

Closed
Ventero opened this issue Mar 14, 2010 · 3 comments
Closed

"this.menuCommanders is undefined" when closing a browser window #1087

Ventero opened this issue Mar 14, 2010 · 3 comments
Milestone

Comments

@Ventero
Copy link
Contributor

Ventero commented Mar 14, 2010

Steps to reproduce:

  1. Make sure Greasemonkey is activated
  2. Open a second browser window
  3. Load any website in that window
  4. Close that window (i.e. press Alt-F4)

For reference:

Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.9.2) Gecko/20100115 Firefox/3.6
with GM 0.8.20100211.5.

The error console shows "this.menuCommanders is undefined" in L308 of browser.js.

The error is thrown because when closing a browser window while a document is active, Firefox first fires the unload event and then the pagehide event. Thus, GM_BrowserUI.chromeUnload deletes menuCommanders before contentUnload tries to access it.

PS: While checking the source code for more information on that error, I stumbled across this line in GM_BrowserUI.contentUnload. Is that line intended (and if so, why)?

@erikvold
Copy link
Contributor

I've noticed this error for quite some time, thanks for doing this research Ventero!

I also noticed that the item variable on L308 of browser.js is globally scoped and not scoped to the function in which it resides, which it should be as far as I can tell.

So I've put this path together.

@erikvold
Copy link
Contributor

I also added a check of the menuCommanders array's length before creating variables (that will not be used if the length is equal to 0) to my issue-1087 branch, in this commit.

@arantius
Copy link
Collaborator

arantius commented Apr 2, 2010

commit 8bd4afe
commit f2f35aa
commit 0c9853f

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants