Closed
Bug 1959714
Opened 1 year ago
Closed 1 year ago
Implement tabs.group() and tabs.ungroup()
Categories
(WebExtensions :: General, enhancement, P1)
WebExtensions
General
Tracking
(firefox138 fixed, firefox139 fixed)
RESOLVED
FIXED
139 Branch
People
(Reporter: robwu, Assigned: robwu)
References
(Blocks 1 open bug)
Details
(Whiteboard: [addons-jira])
Attachments
(2 external files)
Even without knowing the name, color, etc. of a tab groups, it is already useful/feasible to add or remove tabs from existing groups.
For example, the Multi Account Container extension moves tabs with specific URLs to a different container by creating a new tab and removing the old one (because it is not possible to change the container of an existing tab). While doing so, it would be ideal if the original tab group can be preserved, which is currently not possible.
Semantics:
tabs.group(): When the specified tab(s) are not already adjacent to a tab group, they are moved to the closest index before or after a tab group (index changes).tabs.ungroup(): When the specified tab(s) are not at the boundaries of a tab group, they are moved after the tab group.- If a tab is already pinned, it becomes unpinned before grouping.
tabs.group()can create new tab group whengroupIdis not specified. Defaults to within the current window, but can be customized viaoptions.createProperties.windowId.tabs.group()validation:- If
groupIdis specified and invalid, an error is raised. - If
windowIdis specified and invalid, an error is raised. - If neither
groupIdnorwindowIdare specified, the current window is used, but may throw an error if there is no browser window. - If any of the
tabIdsare invalid, an error is raised.
- If
When tabs.group() / tabs.ungroup() is implemented, an extension that wants to create a new tab based on a previous tab can do something like this:
let [ oldTab ] = await browser.tabs.query({ index: 0 });
let newTab = await browser.tabs.create({
url: oldTab.url,
index: oldTab.index,
// cookieStoreId: ..., etc.
});
if (browser.tabs.group) {
if (oldTab.groupId !== -1) {
await browser.tabs.group({ groupId: oldTab.groupId, tabIds: [newTab.id] });
} else {
await browser.tabs.ungroup(newTab.id);
}
}
await browser.tabs.remove(oldTab.id);
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Comment 2•1 year ago
|
||
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/76583f7a0558
Implement tabs.group() and tabs.ungroup() r=zombie,dao,frontend-codestyle-reviewers
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
status-firefox139:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch
| Assignee | ||
Comment 5•1 year ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D245249
Updated•1 year ago
|
Attachment #9478856 -
Flags: approval-mozilla-beta?
Comment 6•1 year ago
|
||
beta Uplift Approval Request
- User impact if declined: Extensions unable to distinguish tabs in tab groups, which may result in the loss of tab groups (e.g. by the MAC extension), see https://bugzilla.mozilla.org/show_bug.cgi?id=1956278#c22
- Code covered by automated testing: yes
- Fix verified in Nightly: no
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: Not needed; covered by automated tests.
- Risk associated with taking this patch: Low
- Explanation of risk level: Patch stack has low risk changes to extension APIs, see D245395; This patch specifically (D245397) introduces new methods that are covered by automated tests.
- String changes made/needed: None
- Is Android affected?: no
Updated•1 year ago
|
Attachment #9478856 -
Flags: approval-mozilla-beta? → approval-mozilla-beta+
Updated•1 year ago
|
status-firefox138:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•