Backed out changeset 9bf0a16672ec (bug 1787979) for causing bc failures on browser_sma_click_element.js. CLOSED TREE

This commit is contained in:
Marian-Vasile Laza 2022-09-14 16:45:04 +03:00
Родитель 72a10218e8
Коммит 02b993c483
7 изменённых файлов: 29 добавлений и 51 удалений

Просмотреть файл

@ -9934,7 +9934,7 @@ var FirefoxViewHandler = {
);
}
if (!this.tab) {
this.tab = gBrowser.addTrustedTab("about:firefoxview");
this.tab = gBrowser.addTrustedTab("about:firefoxview", { index: 0 });
this.tab.addEventListener("TabClose", this, { once: true });
gBrowser.tabContainer.addEventListener("TabSelect", this);
window.addEventListener("activate", this);

Просмотреть файл

@ -14,14 +14,11 @@ add_task(async function() {
let testTab = BrowserTestUtils.addTab(gBrowser);
let firefoxViewTab = BrowserTestUtils.addTab(gBrowser, "about:firefoxview");
gBrowser.hideTab(firefoxViewTab);
let visible = gBrowser.visibleTabs;
is(visible.length, 3, "3 tabs should be visible");
is(visible.length, 3, "3 tabs should be open");
is(visible[0], pinned, "the pinned tab is first");
is(visible[1], origTab, "original tab is next");
is(visible[2], testTab, "last created tab is next to last");
is(visible[2], testTab, "last created tab is last");
// Only show the test tab (but also get pinned and selected)
is(
@ -40,7 +37,7 @@ add_task(async function() {
is(visible.length, 2, "2 tabs should be visible including the pinned");
is(visible[0], pinned, "first is pinned");
is(visible[1], testTab, "next is the test tab");
is(gBrowser.tabs.length, 4, "4 tabs should still be open");
is(gBrowser.tabs.length, 3, "3 tabs should still be open");
gBrowser.selectTabAtIndex(1);
is(gBrowser.selectedTab, testTab, "second tab is the test tab");
@ -75,22 +72,8 @@ add_task(async function() {
gBrowser.tabContainer.advanceSelectedTab(-1, true);
is(gBrowser.selectedTab, testTab, "next to test tab again");
// select a hidden tab thats selectable
gBrowser.selectedTab = firefoxViewTab;
gBrowser.tabContainer.advanceSelectedTab(1, true);
is(gBrowser.selectedTab, pinned, "next to first visible tab, the pinned tab");
gBrowser.tabContainer.advanceSelectedTab(1, true);
is(gBrowser.selectedTab, testTab, "next to second visible tab, the test tab");
// again select a hidden tab thats selectable
gBrowser.selectedTab = firefoxViewTab;
gBrowser.tabContainer.advanceSelectedTab(-1, true);
is(gBrowser.selectedTab, testTab, "next to last visible tab, the test tab");
gBrowser.tabContainer.advanceSelectedTab(-1, true);
is(gBrowser.selectedTab, pinned, "next to first visible tab, the pinned tab");
// Try showing all tabs except for the Firefox View tab
gBrowser.showOnlyTheseTabs(Array.from(gBrowser.tabs.slice(0, 3)));
// Try showing all tabs
gBrowser.showOnlyTheseTabs(Array.from(gBrowser.tabs));
is(gBrowser.visibleTabs.length, 3, "all 3 tabs are visible again");
// Select the pinned tab and show the testTab to make sure selection updates
@ -111,10 +94,7 @@ add_task(async function() {
visible = gBrowser.visibleTabs;
is(visible.length, 1, "only the original tab is visible");
is(visible[0], testTab, "it's the original tab");
is(gBrowser.tabs.length, 3, "still have 3 open tabs");
// Close the selectable hidden tab
gBrowser.removeTab(firefoxViewTab);
is(gBrowser.tabs.length, 2, "still have 2 open tabs");
// Close the last visible tab and make sure we still get a visible tab
gBrowser.removeTab(testTab);

Просмотреть файл

@ -64,8 +64,9 @@ add_task(async function number_tab_select_shortcut() {
AppConstants.MOZ_WIDGET_GTK ? { altKey: true } : { accelKey: true },
win
);
ok(
!win.FirefoxViewHandler.tab.selected,
is(
win.gBrowser.tabContainer.selectedIndex,
1,
"Number shortcut to select the first tab skipped the Firefox View tab"
);
await BrowserTestUtils.closeWindow(win);

Просмотреть файл

@ -151,6 +151,11 @@ async function waitForVisibleSetupStep(browser, expected) {
function assertFirefoxViewTab(w) {
ok(w.FirefoxViewHandler.tab, "Firefox View tab exists");
ok(w.FirefoxViewHandler.tab?.hidden, "Firefox View tab is hidden");
is(
w.gBrowser.tabs.indexOf(w.FirefoxViewHandler.tab),
0,
"Firefox View tab is the first tab"
);
is(
w.gBrowser.visibleTabs.indexOf(w.FirefoxViewHandler.tab),
-1,
@ -170,7 +175,7 @@ async function openFirefoxViewTab(w) {
w
);
assertFirefoxViewTab(w);
ok(w.FirefoxViewHandler.tab.selected, "Firefox View tab is selected");
is(w.gBrowser.tabContainer.selectedIndex, 0, "Firefox View tab is selected");
await BrowserTestUtils.browserLoaded(w.FirefoxViewHandler.tab.linkedBrowser);
return w.FirefoxViewHandler.tab;
}

Просмотреть файл

@ -384,12 +384,17 @@ function test_newtab(testInfo, browserURL = "about:newtab") {
async function assertFirefoxViewTabSelected(w) {
ok(w.FirefoxViewHandler.tab, "Firefox View tab exists");
ok(w.FirefoxViewHandler.tab?.hidden, "Firefox View tab is hidden");
is(
w.gBrowser.tabs.indexOf(w.FirefoxViewHandler.tab),
0,
"Firefox View tab is the first tab"
);
is(
w.gBrowser.visibleTabs.indexOf(w.FirefoxViewHandler.tab),
-1,
"Firefox View tab is not in the list of visible tabs"
);
ok(w.FirefoxViewHandler.tab.selected, "Firefox View tab is selected");
is(w.gBrowser.tabContainer.selectedIndex, 0, "Firefox View tab is selected");
await BrowserTestUtils.browserLoaded(w.FirefoxViewHandler.tab.linkedBrowser);
}

Просмотреть файл

@ -18,8 +18,8 @@ add_task(async function test_TODO() {
is(
state.windows[0].selected,
3,
"The selected tab is Firefox view tab which is the third tab"
1,
"The selected tab is Firefox view tab which is the first tab"
);
gBrowser.selectedTab = tab;
@ -28,7 +28,7 @@ add_task(async function test_TODO() {
// The FxView tab doesn't get recorded in the session state and when we restore we want
// to open the tab that was previously opened so we record the tab position minus one
is(state.windows[0].selected, 1, "The selected tab is the first tab");
is(state.windows[0].selected, 2, "The selected tab is the second tab");
gBrowser.removeTab(window.FirefoxViewHandler.tab);
gBrowser.removeTab(gBrowser.selectedTab);

Просмотреть файл

@ -758,23 +758,10 @@
advanceSelectedTab(aDir, aWrap) {
let startTab = this.ariaFocusedItem || this.selectedItem;
let newTab = null;
// Handle keyboard navigation for a hidden tab that can be selected, like the Firefox View tab,
// which has a random placement in this.allTabs.
if (startTab.hidden) {
if (aDir == 1) {
newTab = this.allTabs.find(tab => !tab.hidden);
} else {
newTab = this.allTabs.findLast(tab => !tab.hidden);
}
} else {
newTab = this.findNextTab(startTab, {
direction: aDir,
wrap: aWrap,
});
}
let newTab = this.findNextTab(startTab, {
direction: aDir,
wrap: aWrap,
});
if (newTab && newTab != startTab) {
this._selectNewTab(newTab, aDir, aWrap);
}