Release notes tab opens multiple times

The release notes tab, as seen after a FoxyProxy version upgrade, appears multiple times if you have multiple Firefox windows open.

How to test:

  1. Have something like the QuickRestart plugin installed to restart Firefox "cleanly"
  2. In about:config, set the extensions.foxyproxy.last-version configuration item to "0"
  3. With multiple windows open, restart Firefox

If you had four Firefox windows open upon restart, one of those windows will have at least three new tabs containing FoxyProxy release notes.

Hello,   Please check this

Hello,

 

Please check this out http://foxyproxy.mozdev.org/drupal/content/bug-release-notes-page

Hi Eric, Thank you for your

Hi Eric,

Thank you for your response. I am familiar with the case link you have given. This is not the same issue, however. This is not the problem of restarting Firefox multiple times and getting the FoxyProxy Release Notes coming back each time.

This is a case of Firefox restarting with multiple windows open (as might happen after a desktop reboot) and getting not just one FoxyProxy Release Notes tab but two, three or more Release Notes tabs all collected in the one window.

Please try the test procedure given in the original notes.

Thanks and kind regards,
AlwaysLearning.

I found the issue

Hi Eric,

After FoxyProxy 2.22.1 came out with the same problem, I decided to go find the issue for you. In components/common.js you have the following function in the Common.prototype:

openAndReuseOneTabPerURL : function(aURL) {

var wm = CC["@mozilla.org/appshell/window-mediator;1"].getService(CI.nsIWindowMediator);

var winEnum = wm.getEnumerator("navigator:browser");

if (!winEnum.hasMoreElements())

winEnum = wm.getEnumerator("Songbird:Main");

if (!winEnum.hasMoreElements())

winEnm = wm.getEnumerator("mail:3pane");

while (winEnum.hasMoreElements()) {

var win = winEnum.getNext();

var browser = win.getBrowser();

for (var i = 0; i < browser.mTabs.length; i++) {

if (aURL == browser.getBrowserForTab(browser.mTabs[i]).currentURI.spec) {

win.focus(); // bring wnd to the foreground

browser.selectedTab = browser.mTabs[i];

return;

}

}

}

// Our URL isn't open. Open it now.

this.openTab(aURL);

},

This code tries to do the right thing by checking to see if the supplied URL is in a tab before opening it in a new one. The problem, though, is that the browser is still busy loading tabs from previous invocations of this function (your foxyproxy.notify() function in chrome/content/overlay.js fires once for each open browser window, by the way, so this function gets called once for each open browser window as well) so browser.getBrowserForTab(browser.mTabs[i]).currentURI.spec is returning "about:blank" instead of one of the expected FoxyProxy release notes URLs. You can see this for yourself by logging the currentURI.spec to the Console.

How to fix? Perhaps avoid the "about:blank" issue above by setting a global "updateCheckRun" variable at the very beginning of foxyproxy.updateCheck() - this avoids updateCheck() getting run multiple times so the timer won't be installed and run multiple times either.

Good luck,
AlwaysLearning.