Backed out changeset 0ded63123e6c (bug 1908418) for causing multiple perma failures.

This commit is contained in:
Sandor Molnar 2024-10-08 00:10:34 +03:00
Родитель 5c7c8c75a8
Коммит d1a6774d15
7 изменённых файлов: 3 добавлений и 213 удалений

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

@ -117,12 +117,6 @@ const TAB_EVENTS = [
"TabHide",
"TabPinned",
"TabUnpinned",
"TabGroupCreate",
"TabGroupRemove",
"TabGrouped",
"TabUngrouped",
"TabGroupCollapse",
"TabGroupExpand",
];
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
@ -184,7 +178,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
"resource://gre/modules/sessionstore/SessionStoreHelper.sys.mjs",
TabAttributes: "resource:///modules/sessionstore/TabAttributes.sys.mjs",
TabCrashHandler: "resource:///modules/ContentCrashHandlers.sys.mjs",
TabGroupState: "resource:///modules/sessionstore/TabGroupState.sys.mjs",
TabState: "resource:///modules/sessionstore/TabState.sys.mjs",
TabStateCache: "resource:///modules/sessionstore/TabStateCache.sys.mjs",
TabStateFlusher: "resource:///modules/sessionstore/TabStateFlusher.sys.mjs",
@ -846,10 +839,7 @@ var SessionStoreInternal = {
// defaults to now if no session was restored or timestamp doesn't exist
_sessionStartTime: Date.now(),
/**
* states for all currently opened windows
* @type {object.<WindowID, WindowStateData>}
*/
// states for all currently opened windows
_windows: {},
// counter for creating unique window IDs
@ -1697,14 +1687,6 @@ var SessionStoreInternal = {
case "SwapDocShells":
this.saveStateDelayed(win);
break;
case "TabGroupCreate":
case "TabGroupRemove":
case "TabGrouped":
case "TabUngrouped":
case "TabGroupCollapse":
case "TabGroupExpand":
this.saveStateDelayed(win);
break;
case "oop-browser-crashed":
case "oop-browser-buildid-mismatch":
if (aEvent.isTopFrame) {
@ -1764,7 +1746,6 @@ var SessionStoreInternal = {
// and create its data object
this._windows[aWindow.__SSi] = {
tabs: [],
groups: [],
selected: 0,
_closedTabs: [],
_lastClosedTabGroupCount: -1,
@ -4750,7 +4731,6 @@ var SessionStoreInternal = {
let tabbrowser = aWindow.gBrowser;
let tabs = tabbrowser.tabs;
/** @type {WindowStateData} */
let winData = this._windows[aWindow.__SSi];
let tabsData = (winData.tabs = []);
@ -4764,11 +4744,6 @@ var SessionStoreInternal = {
tabsData.push(tabData);
}
// update tab group state for this window
winData.groups = aWindow.gBrowser.tabGroups.map(tabGroup =>
lazy.TabGroupState.collect(tabGroup)
);
let selectedIndex = tabbrowser.tabbox.selectedIndex + 1;
// We don't store the Firefox View tab in Session Store, so if it was the last selected "tab" when
// a window is closed, point to the first item in the tab strip instead (it will never be the Firefox View tab,

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

@ -1,37 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Module that contains tab group state collection methods.
*/
export const TabGroupState = Object.freeze({
/**
* @param {MozTabbrowserTabGroup} tabGroup
* Tab group browser element
* @returns {TabGroupStateData}
* Serialized tab group data
*/
collect(tabGroup) {
return TabGroupStateInternal.collect(tabGroup);
},
});
const TabGroupStateInternal = {
/**
* Collect data related to a single tab group, synchronously.
*
* @param {MozTabbrowserTabGroup} tabGroup
* Tab group browser element
* @returns {TabGroupStateData}
* Serialized tab group data
*/
collect(tabGroup) {
return {
id: tabGroup.id,
name: tabGroup.label,
color: tabGroup.color,
collapsed: tabGroup.collapsed,
};
},
};

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

@ -47,7 +47,7 @@ var TabStateInternal = {
* @param [extData]
* optional dictionary object, containing custom tab values.
*
* @returns {TabStateData} An object with the data for this tab. If the
* @returns {TabData} An object with the data for this tab. If the
* tab has not been invalidated since the last call to
* collect(aTab), the same object is returned.
*/
@ -81,7 +81,7 @@ var TabStateInternal = {
* {extData: object} optional dictionary object, containing custom tab values
* {includePrivateData: true} to always include private data
*
* @returns {TabStateData} An object with the basic data for this tab.
* @returns {object} An object with the basic data for this tab.
*/
_collectBaseTabData(tab, options) {
let tabData = { entries: [], lastAccessed: tab.lastAccessed };
@ -98,10 +98,6 @@ var TabStateInternal = {
tabData.muteReason = tab.muteReason;
}
if (tab.group) {
tabData.groupId = tab.group.id;
}
tabData.searchMode = tab.ownerGlobal.gURLBar.getSearchMode(browser, true);
tabData.userContextId = tab.userContextId || 0;

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

@ -25,7 +25,6 @@ EXTRA_JS_MODULES.sessionstore = [
"SessionWriter.sys.mjs",
"StartupPerformance.sys.mjs",
"TabAttributes.sys.mjs",
"TabGroupState.sys.mjs",
"TabState.sys.mjs",
"TabStateCache.sys.mjs",
"TabStateFlusher.sys.mjs",

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

@ -273,10 +273,6 @@ tags = "os_integration"
["browser_switch_remoteness.js"]
["browser_tab_groups_empty.js"]
["browser_tab_groups_state.js"]
["browser_tab_label_during_restore.js"]
https_first_disabled = true

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

@ -1,34 +0,0 @@
"use strict";
/** @type {Window} */
let win;
add_setup(async () => {
win = await promiseNewWindowLoaded();
SessionStoreTestUtils.init(this, win);
});
registerCleanupFunction(async () => {
await BrowserTestUtils.closeWindow(win);
});
add_task(async function test_ZeroTabGroups() {
const state = ss.getWindowState(win);
Assert.equal(state.windows.length, 1, "should have state from 1 window");
const windowState = state.windows[0];
Assert.ok(windowState.groups, "window state should have a `groups` property");
Assert.equal(
windowState.groups.length,
0,
"`groups` property should be 0 since there are no tab groups"
);
const countOfGroupedTabs = windowState.tabs.filter(tab => tab.groupId).length;
Assert.equal(
countOfGroupedTabs,
0,
"none of the tabs should refer to a tab group"
);
});

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

@ -1,105 +0,0 @@
"use strict";
/** @type {Window} */
let win;
add_setup(async () => {
win = await promiseNewWindowLoaded();
SessionStoreTestUtils.init(this, win);
});
registerCleanupFunction(async () => {
await BrowserTestUtils.closeWindow(win);
});
/**
* @param {WindowStateData} windowState
* @returns {TabStateData|undefined}
*/
function findTabStateByUrl(windowState, url) {
return windowState.tabs.find(tabState => tabState.userTypedValue == url);
}
add_task(async function test_TabGroupsInState() {
let aboutRobotsTab = BrowserTestUtils.addTab(win.gBrowser, "about:robots");
let aboutCrashesTab = BrowserTestUtils.addTab(win.gBrowser, "about:crashes");
BrowserTestUtils.addTab(win.gBrowser, "about:about");
let group = win.gBrowser.addTabGroup("blue", "non-meta about pages", [
aboutRobotsTab,
aboutCrashesTab,
]);
let state = ss.getWindowState(win);
Assert.equal(state.windows.length, 1, "should have state from 1 window");
let windowState = state.windows[0];
Assert.ok(windowState.groups, "window state should have a `groups` property");
Assert.equal(windowState.groups.length, 1, "there should be one tab group");
let groupState = windowState.groups[0];
Assert.equal(
groupState.id,
group.id,
"tab group ID should be recorded in state"
);
Assert.equal(
groupState.name,
group.label,
"tab group name should be recorded in state"
);
Assert.equal(
groupState.color,
group.color,
"tab group color should be recorded in state"
);
Assert.equal(
groupState.collapsed,
group.collapsed,
"tab group collapsed state should be recorded in state"
);
Assert.equal(
windowState.tabs.length,
3,
"there should be 3 tabs in session state"
);
const aboutRobotsTabState = findTabStateByUrl(windowState, "about:robots");
Assert.ok(aboutRobotsTabState, "about:robots tab should be in session state");
Assert.equal(
aboutRobotsTabState.groupId,
group.id,
"about:robots tab should be part of the tab group"
);
const aboutCrashesTabState = findTabStateByUrl(windowState, "about:crashes");
Assert.ok(
aboutCrashesTabState,
"about:crashes tab should be in session state"
);
Assert.equal(
aboutCrashesTabState.groupId,
group.id,
"about:crashes tab should be part of the tab group"
);
const aboutAboutTabState = findTabStateByUrl(windowState, "about:about");
Assert.ok(aboutAboutTabState, "about:about tab should be in session state");
Assert.ok(
!aboutAboutTabState.groupId,
"about:about tab should NOT be part of the tab group"
);
// collapse the tab group and make sure the tab group data updates
group.collapsed = true;
state = ss.getWindowState(win);
groupState = state.windows[0].groups[0];
Assert.equal(
groupState.collapsed,
group.collapsed,
"updated tab group collapsed state should be recorded in state"
);
});