Use global counter for hidden browsers

This commit is contained in:
Simon Kornblith 2012-11-07 17:17:16 -05:00
parent 3c52b422fa
commit 7754d530da

View file

@ -2396,6 +2396,8 @@ Zotero.DragDrop = {
* Functions for creating and destroying hidden browser objects
**/
Zotero.Browser = new function() {
var nBrowsers = 0;
this.createHiddenBrowser = createHiddenBrowser;
this.deleteHiddenBrowser = deleteHiddenBrowser;
@ -2423,8 +2425,7 @@ Zotero.Browser = new function() {
hiddenBrowser.docShell.allowJavascript = true;
hiddenBrowser.docShell.allowMetaRedirects = false;
hiddenBrowser.docShell.allowPlugins = false;
Zotero.debug("Created hidden browser ("
+ (win.document.getElementsByTagName('browser').length - 1) + ")");
Zotero.debug("Created hidden browser (" + (nBrowsers++) + ")");
return hiddenBrowser;
}
@ -2436,8 +2437,7 @@ Zotero.Browser = new function() {
myBrowser.destroy();
myBrowser.parentNode.removeChild(myBrowser);
myBrowser = null;
Zotero.debug("Deleted hidden browser ("
+ (win.document.getElementsByTagName('browser').length - 1) + ")");
Zotero.debug("Deleted hidden browser (" + (--nBrowsers) + ")");
}
}
}