more Fx 3.6 fixes

This commit is contained in:
Simon Kornblith 2011-02-03 20:51:41 +00:00
parent f4f326601d
commit b22894006a
2 changed files with 10 additions and 10 deletions

View file

@ -34,6 +34,9 @@ var ZoteroOverlay = new function()
this.isTab = false; this.isTab = false;
this.onLoad = function() { this.onLoad = function() {
ZoteroPane_Overlay = ZoteroPane;
ZoteroPane.init();
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"] var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo); .getService(Components.interfaces.nsIXULAppInfo);
isFx36 = appInfo.platformVersion.indexOf('1.9') === 0; isFx36 = appInfo.platformVersion.indexOf('1.9') === 0;
@ -134,9 +137,6 @@ var ZoteroOverlay = new function()
setTimeout("gBrowser.selectedTab = gBrowser.addTab(Zotero.initialURL); Zotero.initialURL = null;", 1); setTimeout("gBrowser.selectedTab = gBrowser.addTab(Zotero.initialURL); Zotero.initialURL = null;", 1);
} }
ZoteroPane_Overlay = ZoteroPane;
ZoteroPane.init();
// Hide browser chrome on Zotero tab // Hide browser chrome on Zotero tab
if(Zotero.isFx4) { if(Zotero.isFx4) {
XULBrowserWindow.inContentWhitelist.push("chrome://zotero/content/tab.xul"); XULBrowserWindow.inContentWhitelist.push("chrome://zotero/content/tab.xul");
@ -272,7 +272,7 @@ var ZoteroOverlay = new function()
for(var index = 0; index < numTabs; index++) { for(var index = 0; index < numTabs; index++) {
var currentBrowser = gBrowser.getBrowserAtIndex(index); var currentBrowser = gBrowser.getBrowserAtIndex(index);
if(ZOTERO_TAB_URL == currentBrowser.currentURI.spec) { if(ZOTERO_TAB_URL == currentBrowser.currentURI.spec) {
tab = gBrowser.tabs[index]; tab = (gBrowser.tabs ? gBrowser.tabs : gBrowser.mTabs)[index];
break; break;
} }
} }
@ -303,7 +303,7 @@ var ZoteroOverlay = new function()
if(tab) { // Zotero is running in a tab if(tab) { // Zotero is running in a tab
if(setMode) return; if(setMode) return;
// don't do anything if Zotero tab is the only tab // don't do anything if Zotero tab is the only tab
if(tab && gBrowser.tabs.length === 1) return; if(tab && (gBrowser.tabs ? gBrowser.tabs : gBrowser.mTabs).length === 1) return;
// swap ZoteroPane object // swap ZoteroPane object
ZoteroPane = ZoteroPane_Overlay; ZoteroPane = ZoteroPane_Overlay;

View file

@ -47,7 +47,7 @@ var ZoteroTab = new function()
var currentBrowser = window.gBrowser.browsers[index]; var currentBrowser = window.gBrowser.browsers[index];
if(currentBrowser && ZOTERO_TAB_URL == currentBrowser.currentURI.spec) { if(currentBrowser && ZOTERO_TAB_URL == currentBrowser.currentURI.spec) {
window.gBrowser.removeTab(window.gBrowser.tabs[index]); window.gBrowser.removeTab((window.gBrowser.tabs ? window.gBrowser.tabs : window.gBrowser.mTabs)[index]);
} }
} }
@ -64,15 +64,16 @@ var ZoteroTab = new function()
}, false); }, false);
} }
var browser = window.gBrowser.getBrowserForDocument(document); // get tab for browser
if(window.gBrowser.selectedBrowser === browser) { var tab = (window.gBrowser.tabs ? window.gBrowser.tabs : window.gBrowser.mTabs)[browserIndex];
if(window.gBrowser.selectedTab === tab) {
// if tab is already selected, init now // if tab is already selected, init now
ZoteroPane.init(); ZoteroPane.init();
ZoteroPane.makeVisible(); ZoteroPane.makeVisible();
} else { } else {
// otherwise, add a handler to wait until this tab is selected // otherwise, add a handler to wait until this tab is selected
var listener = function(event) { var listener = function(event) {
if(window.gBrowser.getBrowserForTab(event.target) !== browser) return; if(event.target !== tab) return;
window.gBrowser.tabContainer.removeEventListener("TabSelect", listener, false); window.gBrowser.tabContainer.removeEventListener("TabSelect", listener, false);
ZoteroPane.init(); ZoteroPane.init();
ZoteroPane.makeVisible(); ZoteroPane.makeVisible();
@ -81,7 +82,6 @@ var ZoteroTab = new function()
} }
if(Zotero && Zotero.isFx4) { if(Zotero && Zotero.isFx4) {
var tab = window.gBrowser.tabs[browserIndex];
// on Fx 4, add an event listener so the pinned tab isn't restored on close // on Fx 4, add an event listener so the pinned tab isn't restored on close
var pinnedTabCloser = function() { var pinnedTabCloser = function() {
try { try {