mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 15:51:37 +00:00
Bug 824480 - Replace |tab == gBrowser.selectedTab| with tab.selected. r=dao
This commit is contained in:
parent
7dc505b1cf
commit
a71861c533
@ -448,7 +448,7 @@ var ctrlTab = {
|
||||
if (tabs.length > 2) {
|
||||
this.open();
|
||||
} else if (tabs.length == 2) {
|
||||
let index = gBrowser.selectedTab == tabs[0] ? 1 : 0;
|
||||
let index = tabs[0].selected ? 1 : 0;
|
||||
gBrowser.selectedTab = tabs[index];
|
||||
}
|
||||
}
|
||||
@ -488,7 +488,7 @@ var ctrlTab = {
|
||||
this.advanceFocus(false);
|
||||
|
||||
// If the current tab is removed, another tab can steal our focus.
|
||||
if (aTab == gBrowser.selectedTab && this.panel.state == "open") {
|
||||
if (aTab.selected && this.panel.state == "open") {
|
||||
setTimeout(function (selected) {
|
||||
selected.focus();
|
||||
}, 0, this.selected);
|
||||
|
@ -851,11 +851,11 @@
|
||||
var oldTab = this.mCurrentTab;
|
||||
|
||||
// Preview mode should not reset the owner
|
||||
if (!this._previewMode && oldTab != this.selectedTab)
|
||||
if (!this._previewMode && !oldTab.selected)
|
||||
oldTab.owner = null;
|
||||
|
||||
if (this._lastRelatedTab) {
|
||||
if (this._lastRelatedTab != this.selectedTab)
|
||||
if (!this._lastRelatedTab.selected)
|
||||
this._lastRelatedTab.owner = null;
|
||||
this._lastRelatedTab = null;
|
||||
}
|
||||
@ -957,8 +957,7 @@
|
||||
true, false);
|
||||
}
|
||||
|
||||
if (this.mCurrentTab.selected)
|
||||
this._setCloseKeyState(!this.mCurrentTab.pinned);
|
||||
this._setCloseKeyState(!this.mCurrentTab.pinned);
|
||||
|
||||
// TabSelect events are suppressed during preview mode to avoid confusing extensions and other bits of code
|
||||
// that might rely upon the other changes suppressed.
|
||||
@ -1825,7 +1824,7 @@
|
||||
<parameter name="aTab"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.mCurrentTab != aTab)
|
||||
if (!aTab.selected)
|
||||
return;
|
||||
|
||||
if (aTab.owner &&
|
||||
@ -1875,7 +1874,7 @@
|
||||
|
||||
// The tab is definitely not loading.
|
||||
aNewTab.removeAttribute("busy");
|
||||
if (aNewTab == this.selectedTab) {
|
||||
if (aNewTab.selected) {
|
||||
this.mIsBusy = false;
|
||||
}
|
||||
|
||||
@ -1884,7 +1883,7 @@
|
||||
// Update the new tab's title.
|
||||
this.setTabTitle(aNewTab);
|
||||
|
||||
if (aNewTab == this.selectedTab) {
|
||||
if (aNewTab.selected) {
|
||||
this.updateCurrentBrowser(true);
|
||||
}
|
||||
]]>
|
||||
@ -1923,7 +1922,7 @@
|
||||
if (isBusy) {
|
||||
aOurTab.setAttribute("busy", "true");
|
||||
this._tabAttrModified(aOurTab);
|
||||
if (aOurTab == this.selectedTab)
|
||||
if (aOurTab.selected)
|
||||
this.mIsBusy = true;
|
||||
}
|
||||
|
||||
@ -1939,7 +1938,7 @@
|
||||
|
||||
// If the tab was already selected (this happpens in the scenario
|
||||
// of replaceTabWithWindow), notify onLocationChange, etc.
|
||||
if (aOurTab == this.selectedTab)
|
||||
if (aOurTab.selected)
|
||||
this.updateCurrentBrowser(true);
|
||||
]]>
|
||||
</body>
|
||||
|
@ -82,7 +82,7 @@ var gWebProgressListener = {
|
||||
}
|
||||
|
||||
ok(gNewTab, "There is a new tab.");
|
||||
ok(isRedirectedURI(aLocation),
|
||||
ok(isRedirectedURI(aLocation),
|
||||
"onLocationChange catches only redirected URI.");
|
||||
|
||||
if (aLocation.ref == "BG") {
|
||||
@ -97,7 +97,7 @@ var gWebProgressListener = {
|
||||
ok(false, "This URI hash is not expected:" + aLocation.ref);
|
||||
}
|
||||
|
||||
let isSelectedTab = (gNewTab == gBrowser.selectedTab);
|
||||
let isSelectedTab = gNewTab.selected;
|
||||
setTimeout(delayed, 0, isSelectedTab);
|
||||
}
|
||||
};
|
||||
|
@ -59,7 +59,7 @@ function test() {
|
||||
pressCtrlTab(true);
|
||||
pressCtrlTab(true);
|
||||
releaseCtrl();
|
||||
ok(gBrowser.selectedTab == selectedTab,
|
||||
ok(selectedTab.selected,
|
||||
"Ctrl+Tab*2 -> Ctrl+W -> Ctrl+Shift+Tab*2 keeps the selected tab");
|
||||
}
|
||||
gBrowser.removeTab(gBrowser.tabContainer.lastChild);
|
||||
|
@ -38,7 +38,7 @@ function test() {
|
||||
tab = window.gBrowser.tabs[i];
|
||||
}
|
||||
|
||||
ok(tab.pinned || gBrowser.selectedTab == tab,
|
||||
ok(tab.pinned || tab.selected,
|
||||
"load came from pinned or selected tab");
|
||||
|
||||
// We should get 4 loads: 3 app tabs + 1 normal selected tab
|
||||
|
@ -37,7 +37,7 @@ function test() {
|
||||
}
|
||||
|
||||
// Check that the load only comes from the selected tab.
|
||||
ok(gBrowser.selectedTab == tab, "load came from selected tab");
|
||||
ok(tab.selected, "load came from selected tab");
|
||||
is(aNeedRestore, 6, "six tabs left to restore");
|
||||
is(aRestoring, 1, "one tab is restoring");
|
||||
is(aRestored, 0, "no tabs have been restored, yet");
|
||||
|
@ -1004,7 +1004,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
||||
|
||||
// if it matches the selected tab or no active tab and the browser
|
||||
// tab is hidden, the active group item would be set.
|
||||
if (item.tab == gBrowser.selectedTab ||
|
||||
if (item.tab.selected ||
|
||||
(!GroupItems.getActiveGroupItem() && !item.tab.hidden))
|
||||
UI.setActive(this);
|
||||
}
|
||||
@ -2542,7 +2542,7 @@ let GroupItems = {
|
||||
let groupItem;
|
||||
|
||||
// switch to the appropriate tab first.
|
||||
if (gBrowser.selectedTab == tab) {
|
||||
if (tab.selected) {
|
||||
if (gBrowser.visibleTabs.length > 1) {
|
||||
gBrowser._blurTab(tab);
|
||||
shouldUpdateTabBar = true;
|
||||
|
@ -277,7 +277,7 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
||||
|
||||
// if it matches the selected tab or no active tab and the browser
|
||||
// tab is hidden, the active group item would be set.
|
||||
if (this.tab == gBrowser.selectedTab ||
|
||||
if (this.tab.selected ||
|
||||
(!GroupItems.getActiveGroupItem() && !this.tab.hidden))
|
||||
UI.setActive(this.parent);
|
||||
}
|
||||
@ -539,11 +539,11 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
||||
|
||||
UI.goToTab(tab);
|
||||
|
||||
// tab might not be selected because hideTabView() is invoked after
|
||||
// tab might not be selected because hideTabView() is invoked after
|
||||
// UI.goToTab() so we need to setup everything for the gBrowser.selectedTab
|
||||
if (tab != gBrowser.selectedTab) {
|
||||
if (!tab.selected) {
|
||||
UI.onTabSelect(gBrowser.selectedTab);
|
||||
} else {
|
||||
} else {
|
||||
if (isNewBlankTab)
|
||||
gWindow.gURLBar.focus();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ function onTabViewLoadedAndShown() {
|
||||
gBrowser.pinTab(appTab);
|
||||
|
||||
// verify that the normal tab is selected
|
||||
ok(gBrowser.selectedTab == originalTab, "the normal tab is selected");
|
||||
ok(originalTab.selected, "the normal tab is selected");
|
||||
|
||||
// hit the exit button for the first time
|
||||
exitButton = contentWindow.document.getElementById("exit-button");
|
||||
@ -50,11 +50,11 @@ function onTabViewHiddenForNormalTab() {
|
||||
ok(!TabView.isVisible(), "Tab View is not visible");
|
||||
|
||||
// verify that the normal tab is still selected
|
||||
ok(gBrowser.selectedTab == originalTab, "the normal tab is still selected");
|
||||
ok(originalTab.selected, "the normal tab is still selected");
|
||||
|
||||
// select the app tab
|
||||
gBrowser.selectedTab = appTab;
|
||||
ok(gBrowser.selectedTab == appTab, "the app tab is now selected");
|
||||
ok(appTab.selected, "the app tab is now selected");
|
||||
|
||||
// go back to tabview
|
||||
window.addEventListener("tabviewshown", onTabViewShown, false);
|
||||
@ -77,14 +77,14 @@ function onTabViewHiddenForAppTab() {
|
||||
ok(!TabView.isVisible(), "Tab View is not visible");
|
||||
|
||||
// verify that the app tab is still selected
|
||||
ok(gBrowser.selectedTab == appTab, "the app tab is still selected");
|
||||
ok(appTab.selected, "the app tab is still selected");
|
||||
|
||||
// clean up
|
||||
gBrowser.selectedTab = originalTab;
|
||||
gBrowser.selectedTab = originalTab;
|
||||
gBrowser.removeTab(appTab);
|
||||
|
||||
is(gBrowser.tabs.length, 1, "we finish with one tab");
|
||||
ok(gBrowser.selectedTab == originalTab,
|
||||
ok(originalTab.selected,
|
||||
"we finish with the normal tab selected");
|
||||
ok(!TabView.isVisible(), "we finish with Tab View not visible");
|
||||
|
||||
|
@ -823,7 +823,7 @@ let UI = {
|
||||
// Selects the given xul:tab in the browser.
|
||||
goToTab: function UI_goToTab(xulTab) {
|
||||
// If it's not focused, the onFocus listener would handle it.
|
||||
if (gBrowser.selectedTab == xulTab)
|
||||
if (xulTab.selected)
|
||||
this.onTabSelect(xulTab);
|
||||
else
|
||||
gBrowser.selectedTab = xulTab;
|
||||
@ -936,7 +936,7 @@ let UI = {
|
||||
// TabView is hidden and that the correct group is activated. When a modal
|
||||
// dialog is shown for currently selected tab the onTabSelect event handler
|
||||
// is not called, so we need to do it.
|
||||
if (gBrowser.selectedTab == tab && this._currentTab == tab)
|
||||
if (tab.selected && this._currentTab == tab)
|
||||
this.onTabSelect(tab);
|
||||
},
|
||||
|
||||
|
@ -56,11 +56,11 @@ function test() {
|
||||
let canvas = createThumbnailSurface(preview);
|
||||
let ctx = canvas.getContext("2d");
|
||||
preview.controller.drawThumbnail(ctx, canvas.width, canvas.height);
|
||||
ok(currentSelectedTab == gBrowser.selectedTab, "Drawing thumbnail does not change selection");
|
||||
ok(currentSelectedTab.selected, "Drawing thumbnail does not change selection");
|
||||
canvas = getCanvas(preview.controller.width, preview.controller.height);
|
||||
ctx = canvas.getContext("2d");
|
||||
preview.controller.drawPreview(ctx);
|
||||
ok(currentSelectedTab == gBrowser.selectedTab, "Drawing preview does not change selection");
|
||||
ok(currentSelectedTab.selected, "Drawing preview does not change selection");
|
||||
}
|
||||
|
||||
// Close #4
|
||||
@ -70,7 +70,7 @@ function test() {
|
||||
|
||||
// Select #1
|
||||
ok(getPreviewForTab(gBrowser.tabs[0]).controller.onActivate(), "Activation was accepted");
|
||||
ok(gBrowser.tabs[0] == gBrowser.selectedTab, "Correct tab was selected");
|
||||
ok(gBrowser.tabs[0].selected, "Correct tab was selected");
|
||||
checkSelectedTab();
|
||||
|
||||
// Remove #3 (non active)
|
||||
@ -113,7 +113,7 @@ function test() {
|
||||
getPreviewForTab(gBrowser.selectedTab).active;
|
||||
|
||||
function isTabSelected(idx)
|
||||
gBrowser.selectedTab == gBrowser.tabs[idx];
|
||||
gBrowser.tabs[idx].selected;
|
||||
|
||||
function createThumbnailSurface(p) {
|
||||
let thumbnailWidth = 200,
|
||||
|
Loading…
x
Reference in New Issue
Block a user