check whether gBrowser exists during init() without actually accessing it

This commit is contained in:
Simon Kornblith 2011-03-02 02:08:05 +00:00
parent f834e3f63e
commit e37dc98ef9

View file

@ -104,16 +104,9 @@ var Zotero_Browser = new function() {
* Initialize some variables and prepare event listeners for when chrome is done loading
*/
function init() {
try {
var gb = gBrowser;
} catch(e) {
if (!Zotero || !Zotero.initialized || !window.hasOwnProperty("gBrowser")) {
return;
}
if (!Zotero || !Zotero.initialized || !gb) {
return;
}
Zotero_Browser.browserData = new Object();
window.addEventListener("load",
function(e) { Zotero_Browser.chromeLoad(e) }, false);
@ -322,10 +315,9 @@ var Zotero_Browser = new function() {
}
/*
* When chrome unloads, delete our document objects
* Called when chrome is unloaded
*/
function chromeUnload() {
delete Zotero_Browser.browserData;
}
/*