Backed out changeset 4ab6eb349233 (bug 1847617) for causing bc failures in /browser_aboutHomeLoading.js CLOSED TREE

This commit is contained in:
Cristian Tuns 2023-08-08 23:57:39 -04:00
parent b2e135f779
commit dcf50463d3
3 changed files with 0 additions and 141 deletions

View File

@ -6149,7 +6149,6 @@ var SessionStoreInternal = {
!(
aTabState.entries.length == 1 &&
(entryUrl == "about:blank" ||
entryUrl == "about:home" ||
entryUrl == "about:newtab" ||
entryUrl == "about:privatebrowsing") &&
!aTabState.userTypedValue

View File

@ -365,7 +365,6 @@ skip-if =
os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
[browser_sessionStorage_size.js]
[browser_sessionStoreContainer.js]
[browser_should_restore_tab.js]
[browser_sizemodeBeforeMinimized.js]
[browser_speculative_connect.js]
[browser_swapDocShells.js]

View File

@ -1,139 +0,0 @@
const NOTIFY_CLOSED_OBJECTS_CHANGED = "sessionstore-closed-objects-changed";
add_setup(async () => {
registerCleanupFunction(async () => {
Services.obs.notifyObservers(null, "browser:purge-session-history");
});
});
async function check_tab_close_notification(openedTab, expectNotification) {
let tabUrl = openedTab.linkedBrowser.currentURI.spec;
let win = openedTab.ownerGlobal;
let initialTabCount = SessionStore.getClosedTabCountForWindow(win);
let tabClosed = BrowserTestUtils.waitForTabClosing(openedTab);
let notified = false;
function topicObserver(_, topic) {
notified = true;
}
Services.obs.addObserver(topicObserver, NOTIFY_CLOSED_OBJECTS_CHANGED);
BrowserTestUtils.removeTab(openedTab);
await tabClosed;
// SessionStore does a setTimeout(notify, 0) to notifyObservers when it handles TabClose
// We need to wait long enough to be confident the observer would have been notified
// if it was going to be.
let ticks = 0;
await TestUtils.waitForCondition(() => {
return ++ticks > 1;
});
Services.obs.removeObserver(topicObserver, NOTIFY_CLOSED_OBJECTS_CHANGED);
if (expectNotification) {
Assert.ok(
notified,
`Expected ${NOTIFY_CLOSED_OBJECTS_CHANGED} when the ${tabUrl} tab closed`
);
Assert.equal(
SessionStore.getClosedTabCountForWindow(win),
initialTabCount + 1,
"Expected closed tab count to have incremented"
);
} else {
Assert.ok(
!notified,
`Expected no ${NOTIFY_CLOSED_OBJECTS_CHANGED} when the ${tabUrl} tab closed`
);
Assert.equal(
SessionStore.getClosedTabCountForWindow(win),
initialTabCount,
"Expected closed tab count to have not changed"
);
}
}
add_task(async function test_control_case() {
let win = window;
let tabOpenedAndSwitchedTo = BrowserTestUtils.switchTab(
win.gBrowser,
() => {}
);
let tab = await BrowserTestUtils.openNewForegroundTab(
win.gBrowser,
"https://example.com/"
);
await tabOpenedAndSwitchedTo;
await check_tab_close_notification(tab, true);
});
add_task(async function test_about_new_tab() {
let win = window;
let tabOpenedAndSwitchedTo = BrowserTestUtils.switchTab(
win.gBrowser,
() => {}
);
// This opens about:newtab:
win.BrowserOpenTab();
let tab = await tabOpenedAndSwitchedTo;
await check_tab_close_notification(tab, false);
});
add_task(async function test_about_home() {
let win = window;
let tabOpenedAndSwitchedTo = BrowserTestUtils.switchTab(
win.gBrowser,
() => {}
);
let tab = await BrowserTestUtils.openNewForegroundTab(
win.gBrowser,
"about:home"
);
await tabOpenedAndSwitchedTo;
await check_tab_close_notification(tab, false);
});
add_task(async function test_navigated_about_home() {
let win = window;
let tabOpenedAndSwitchedTo = BrowserTestUtils.switchTab(
win.gBrowser,
() => {}
);
let tab = await BrowserTestUtils.openNewForegroundTab(
win.gBrowser,
"https://example.com/"
);
await tabOpenedAndSwitchedTo;
BrowserTestUtils.loadURIString(tab.linkedBrowser, "about:home");
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
// even if we end up on an ignorable URL,
// if there's meaningful history, we should save this tab
await check_tab_close_notification(tab, true);
});
add_task(async function test_about_blank() {
let win = window;
let tabOpenedAndSwitchedTo = BrowserTestUtils.switchTab(
win.gBrowser,
() => {}
);
let tab = await BrowserTestUtils.openNewForegroundTab(
win.gBrowser,
"about:blank"
);
await tabOpenedAndSwitchedTo;
await check_tab_close_notification(tab, false);
});
add_task(async function test_about_privatebrowsing() {
let win = window;
let tabOpenedAndSwitchedTo = BrowserTestUtils.switchTab(
win.gBrowser,
() => {}
);
let tab = await BrowserTestUtils.openNewForegroundTab(
win.gBrowser,
"about:privatebrowsing"
);
await tabOpenedAndSwitchedTo;
await check_tab_close_notification(tab, false);
});