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();
@ -4291,7 +4289,7 @@ var XULBrowserWindow = {
// Of course, this is especially wrong with bfcache on...
// fix bug 253793 - turn off highlight when page changes
gFindBar.getElement("highlight").checked = false;
gFindBar.getElement("highlight").checked = false;
}
// See bug 358202, when tabs are switched during a drag operation,
@ -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

@ -555,7 +555,7 @@
_startStalledTimer: function () {
this._cancelStalledTimer();
this._stalledTimer = setTimeout(function (self) {
this._stalledTimer = setTimeout(function (self) {
self.mTab.setAttribute("stalled", "true");
}, 700, this);
},
@ -634,7 +634,7 @@
<body>
<![CDATA[
var browser = this.getBrowserForTab(aTab);
var docURIObject = browser.contentDocument.documentURIObject;
var docURIObject = browser.contentDocument.documentURIObject;
if (browser.contentDocument instanceof ImageDocument) {
if (Services.prefs.getBoolPref("browser.chrome.site_icons")) {
try {
@ -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>
@ -2726,7 +2725,7 @@
var tab = this._getDragTargetTab(event);
if (window.getComputedStyle(this, null).direction == "ltr") {
for (let i = tab ? tab._tPos : 0; i < tabs.length; i++)
if (event.screenX < tabs[i].boxObject.screenX + tabs[i].boxObject.width / 2)
if (event.screenX < tabs[i].boxObject.screenX + tabs[i].boxObject.width / 2)
return i;
} else {
for (let i = tab ? tab._tPos : 0; i < tabs.length; i++)
@ -2961,7 +2960,7 @@
var scrollRect = tabStrip.scrollClientRect;
var rect = this.getBoundingClientRect();
var minMargin = scrollRect.left - rect.left;
var maxMargin = Math.min(minMargin + scrollRect.width,
var maxMargin = Math.min(minMargin + scrollRect.width,
scrollRect.right);
if (!ltr)
[minMargin, maxMargin] = [this.clientWidth - maxMargin,
@ -3342,7 +3341,7 @@
var curTabBO = this.childNodes[i].tab.boxObject;
if (curTabBO.screenX >= tabstripBO.screenX &&
curTabBO.screenX + curTabBO.width <= tabstripBO.screenX + tabstripBO.width)
this.childNodes[i].setAttribute("tabIsVisible", "true");
this.childNodes[i].setAttribute("tabIsVisible", "true");
else
this.childNodes[i].removeAttribute("tabIsVisible");
}
@ -3353,7 +3352,7 @@
<parameter name="aTab"/>
<body><![CDATA[
var menuItem = document.createElementNS(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"menuitem");
menuItem.setAttribute("class", "menuitem-iconic alltabs-item menuitem-with-favicon");

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,11 +36,9 @@
* ***** 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");
is(gBrowser.visibleTabs.length, 1, "1 tab should be open");
is(Disabled(), true, "Bookmark All Tabs should be hidden");
// Add a tab
@ -48,39 +46,30 @@ 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() {
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
gBrowser.selectedTab = 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() {