Backed out changeset ed2484b982b9 due to accidental landing.

This commit is contained in:
Edward Lee 2010-08-12 03:24:29 -07:00
parent 79de2be602
commit ffd35d7fc4
4 changed files with 33 additions and 56 deletions

View File

@ -1578,8 +1578,6 @@ function BrowserShutdown()
Components.utils.reportError(ex);
}
gBookmarkAllTabsHandler.uninit();
BrowserOffline.uninit();
OfflineApps.uninit();
DownloadMonitorPanel.uninit();
@ -6783,18 +6781,14 @@ function formatURL(aFormat, aIsPref) {
*/
var gBookmarkAllTabsHandler = {
init: function () {
Services.obs.addObserver(this, "tab-visibility-change", false);
this._command = document.getElementById("Browser:BookmarkAllTabs");
gBrowser.tabContainer.addEventListener("TabOpen", this, true);
gBrowser.tabContainer.addEventListener("TabClose", this, true);
gBrowser.tabContainer.addEventListener("TabSelect", this, true);
gBrowser.tabContainer.addEventListener("TabMove", this, true);
this._updateCommandState();
},
uninit: function () {
Services.obs.removeObserver(this, "tab-visibility-change");
},
_updateCommandState: function BATH__updateCommandState(aTabClose) {
let numTabs = gBrowser.visibleTabs.length;
@ -6815,12 +6809,7 @@ var gBookmarkAllTabsHandler = {
// nsIDOMEventListener
handleEvent: function(aEvent) {
this._updateCommandState(aEvent.type == "TabClose");
},
observe: function(subject, topic, data) {
if (topic == "tab-visibility-change" && subject == window)
this._updateCommandState();
},
}
};
/**
@ -7864,3 +7853,4 @@ XPCOMUtils.defineLazyGetter(this, "HUDConsoleUI", function () {
Components.utils.reportError(ex);
}
});

View File

@ -1772,7 +1772,6 @@
Array.forEach(this.tabs, function(tab) {
tab.hidden = aTabs.indexOf(tab) == -1 && !tab.pinned && !tab.selected;
});
Services.obs.notifyObservers(window, "tab-visibility-change", null);
]]>
</body>
</method>

View File

@ -172,7 +172,6 @@ _BROWSER_FILES = \
browser_visibleTabs.js \
browser_visibleTabs_contextMenu.js \
browser_visibleTabs_bookmarkAllPages.js \
browser_visibleTabs_bookmarkAllTabs.js \
discovery.html \
moz.png \
test_bug435035.html \

View File

@ -36,8 +36,6 @@
* ***** END LICENSE BLOCK ***** */
function test() {
waitForExplicitFinish();
// There should be one tab when we start the test
let [origTab] = gBrowser.visibleTabs;
is(gBrowser.visibleTabs.length, 1, "1 tab should be open");
@ -48,9 +46,10 @@ function test() {
is(gBrowser.visibleTabs.length, 2, "2 tabs should be open");
is(Disabled(), false, "Bookmark All Tabs should be available");
let observe = function(subject, topic, data) {
Services.obs.removeObserver(observe, "tab-visibility-change");
setTimeout(function() {
// Hide the original tab
gBrowser.selectedTab = testTab;
gBrowser.showOnlyTheseTabs([testTab]);
is(gBrowser.visibleTabs.length, 1, "1 tab should be visible");
is(Disabled(), true, "Bookmark All Tabs should be hidden as there is only one visible tab");
// Add a tab that will get pinned
@ -71,16 +70,6 @@ function test() {
is(Disabled(), true, "Bookmark All Tabs should be hidden");
is(gBrowser.selectedTab, origTab, "got the orig tab");
is(origTab.hidden, false, "and it's not hidden -- visible!");
finish();
}, 0);
}
Services.obs.addObserver(observe, "tab-visibility-change", false);
// Hide the original tab
gBrowser.selectedTab = testTab;
gBrowser.showOnlyTheseTabs([testTab]);
is(gBrowser.visibleTabs.length, 1, "1 tab should be visible");
}
function Disabled() {