зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset ed2484b982b9 due to accidental landing.
This commit is contained in:
Родитель
8969b2aead
Коммит
2f93fd2037
|
@ -1578,8 +1578,6 @@ function BrowserShutdown()
|
||||||
Components.utils.reportError(ex);
|
Components.utils.reportError(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBookmarkAllTabsHandler.uninit();
|
|
||||||
|
|
||||||
BrowserOffline.uninit();
|
BrowserOffline.uninit();
|
||||||
OfflineApps.uninit();
|
OfflineApps.uninit();
|
||||||
DownloadMonitorPanel.uninit();
|
DownloadMonitorPanel.uninit();
|
||||||
|
@ -6783,18 +6781,14 @@ function formatURL(aFormat, aIsPref) {
|
||||||
*/
|
*/
|
||||||
var gBookmarkAllTabsHandler = {
|
var gBookmarkAllTabsHandler = {
|
||||||
init: function () {
|
init: function () {
|
||||||
Services.obs.addObserver(this, "tab-visibility-change", false);
|
|
||||||
|
|
||||||
this._command = document.getElementById("Browser:BookmarkAllTabs");
|
this._command = document.getElementById("Browser:BookmarkAllTabs");
|
||||||
gBrowser.tabContainer.addEventListener("TabOpen", this, true);
|
gBrowser.tabContainer.addEventListener("TabOpen", this, true);
|
||||||
gBrowser.tabContainer.addEventListener("TabClose", this, true);
|
gBrowser.tabContainer.addEventListener("TabClose", this, true);
|
||||||
|
gBrowser.tabContainer.addEventListener("TabSelect", this, true);
|
||||||
|
gBrowser.tabContainer.addEventListener("TabMove", this, true);
|
||||||
this._updateCommandState();
|
this._updateCommandState();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
|
||||||
Services.obs.removeObserver(this, "tab-visibility-change");
|
|
||||||
},
|
|
||||||
|
|
||||||
_updateCommandState: function BATH__updateCommandState(aTabClose) {
|
_updateCommandState: function BATH__updateCommandState(aTabClose) {
|
||||||
let numTabs = gBrowser.visibleTabs.length;
|
let numTabs = gBrowser.visibleTabs.length;
|
||||||
|
|
||||||
|
@ -6815,12 +6809,7 @@ var gBookmarkAllTabsHandler = {
|
||||||
// nsIDOMEventListener
|
// nsIDOMEventListener
|
||||||
handleEvent: function(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
this._updateCommandState(aEvent.type == "TabClose");
|
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);
|
Components.utils.reportError(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1772,7 +1772,6 @@
|
||||||
Array.forEach(this.tabs, function(tab) {
|
Array.forEach(this.tabs, function(tab) {
|
||||||
tab.hidden = aTabs.indexOf(tab) == -1 && !tab.pinned && !tab.selected;
|
tab.hidden = aTabs.indexOf(tab) == -1 && !tab.pinned && !tab.selected;
|
||||||
});
|
});
|
||||||
Services.obs.notifyObservers(window, "tab-visibility-change", null);
|
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
|
@ -172,7 +172,6 @@ _BROWSER_FILES = \
|
||||||
browser_visibleTabs.js \
|
browser_visibleTabs.js \
|
||||||
browser_visibleTabs_contextMenu.js \
|
browser_visibleTabs_contextMenu.js \
|
||||||
browser_visibleTabs_bookmarkAllPages.js \
|
browser_visibleTabs_bookmarkAllPages.js \
|
||||||
browser_visibleTabs_bookmarkAllTabs.js \
|
|
||||||
discovery.html \
|
discovery.html \
|
||||||
moz.png \
|
moz.png \
|
||||||
test_bug435035.html \
|
test_bug435035.html \
|
||||||
|
|
|
@ -36,8 +36,6 @@
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
waitForExplicitFinish();
|
|
||||||
|
|
||||||
// There should be one tab when we start the test
|
// There should be one tab when we start the test
|
||||||
let [origTab] = gBrowser.visibleTabs;
|
let [origTab] = gBrowser.visibleTabs;
|
||||||
is(gBrowser.visibleTabs.length, 1, "1 tab should be open");
|
is(gBrowser.visibleTabs.length, 1, "1 tab should be open");
|
||||||
|
@ -48,39 +46,30 @@ function test() {
|
||||||
is(gBrowser.visibleTabs.length, 2, "2 tabs should be open");
|
is(gBrowser.visibleTabs.length, 2, "2 tabs should be open");
|
||||||
is(Disabled(), false, "Bookmark All Tabs should be available");
|
is(Disabled(), false, "Bookmark All Tabs should be available");
|
||||||
|
|
||||||
let observe = function(subject, topic, data) {
|
|
||||||
Services.obs.removeObserver(observe, "tab-visibility-change");
|
|
||||||
setTimeout(function() {
|
|
||||||
is(Disabled(), true, "Bookmark All Tabs should be hidden as there is only one visible tab");
|
|
||||||
|
|
||||||
// Add a tab that will get pinned
|
|
||||||
let pinned = gBrowser.addTab();
|
|
||||||
gBrowser.pinTab(pinned);
|
|
||||||
is(gBrowser.visibleTabs.length, 2, "2 tabs should be visible now");
|
|
||||||
is(Disabled(), false, "Bookmark All Tabs should be available as there are two visible tabs");
|
|
||||||
|
|
||||||
// Show all tabs
|
|
||||||
let allTabs = [tab for each (tab in gBrowser.tabs)];
|
|
||||||
gBrowser.showOnlyTheseTabs(allTabs);
|
|
||||||
|
|
||||||
// reset the environment
|
|
||||||
gBrowser.removeTab(testTab);
|
|
||||||
gBrowser.removeTab(pinned);
|
|
||||||
is(gBrowser.visibleTabs.length, 1, "only orig is left and visible");
|
|
||||||
is(gBrowser.tabs.length, 1, "sanity check that it matches");
|
|
||||||
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
|
// Hide the original tab
|
||||||
gBrowser.selectedTab = testTab;
|
gBrowser.selectedTab = testTab;
|
||||||
gBrowser.showOnlyTheseTabs([testTab]);
|
gBrowser.showOnlyTheseTabs([testTab]);
|
||||||
is(gBrowser.visibleTabs.length, 1, "1 tab should be visible");
|
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
|
||||||
|
let pinned = gBrowser.addTab();
|
||||||
|
gBrowser.pinTab(pinned);
|
||||||
|
is(gBrowser.visibleTabs.length, 2, "2 tabs should be visible now");
|
||||||
|
is(Disabled(), false, "Bookmark All Tabs should be available as there are two visible tabs");
|
||||||
|
|
||||||
|
// Show all tabs
|
||||||
|
let allTabs = [tab for each (tab in gBrowser.tabs)];
|
||||||
|
gBrowser.showOnlyTheseTabs(allTabs);
|
||||||
|
|
||||||
|
// reset the environment
|
||||||
|
gBrowser.removeTab(testTab);
|
||||||
|
gBrowser.removeTab(pinned);
|
||||||
|
is(gBrowser.visibleTabs.length, 1, "only orig is left and visible");
|
||||||
|
is(gBrowser.tabs.length, 1, "sanity check that it matches");
|
||||||
|
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!");
|
||||||
}
|
}
|
||||||
|
|
||||||
function Disabled() {
|
function Disabled() {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче