This adds tab groups and their state data to the session store. For any tabs that are in tab groups, this patch adds the group ID into the tab state. This change has a number of limitations that will be addressed in future bugs. Most notably, tab groups will not be restored from session state -- this change just records the tab group state data. Another important limitation is that when users remove tab groups, they will no longer appear in the session store. This patch is only intended to lay the initial groundwork for storing tab group data in the session store. Differential Revision: https://phabricator.services.mozilla.com/D224348
38 lines
985 B
JavaScript
38 lines
985 B
JavaScript
/* 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,
|
|
};
|
|
},
|
|
};
|