Open
Bug 1388462
Opened 7 years ago
Updated 2 years ago
Extend tabs API with new options for tabs.remove
Categories
(WebExtensions :: General, enhancement, P5)
Tracking
(Not tracked)
NEW
People
(Reporter: geoffreydebelie, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: feature, Whiteboard: [design-decision-approved][tabs] [needs-follow-up])
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0 Build ID: 20170731100325 Steps to reproduce: An API to close the tabs to the right / left of the current tab would be useful for Tab Center Redux. It would need to keep in acccount the setting browser.tabs.warnOnCloseOtherTabs and display a warning to the user if needed, just like the function is called when using right mouse on a tab in the tab bar. This is an alternative approach / workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1376394 Maybe this extension to the tabs API would need an option to suppress the warning from browser.tabs.warnOnCloseOtherTabs (when using this code unattended - no user interaction allowed). This option is optional however, since you can do this by closing the tabs one by one by calling tabs.remove(). Suggested API usage: browser.tabs.closeTabsToTheRight(optionalTabId); optionalTabId = currentTabId as default. Never prompt API usage: browser.tabs.closeTabsToTheRight(optionalTabId, {prompt: false}); More info: https://github.com/eoger/tabcenter-redux/issues/93
Comment 1•7 years ago
|
||
I don't really like the API calls suggested, but I do think we could do something similar... browser.tabs.remove(listOfIDs, optionsObject) listOfIDs may be empty depending on optionsObject entries optionsObject = { allExcept, //boolean, closes all except listOfIDs all, //boolean closes all tabs right, //boolean, closes all to right left, // boolean, closes all to left prompt, // boolean ...other options?... }
Comment 2•7 years ago
|
||
Lets hash out the details here enough to make a decision. If we approve this, we'll close bug 1376394
Summary: Extend tabs API to close tabs to the right / left of the current tab → Extend tabs API with new options for tabs.remove
Whiteboard: [design-decision-needed]
Comment 3•7 years ago
|
||
nit: avoid the terms left/right as they're not RTL-safe. The tabbrowser method is called removeTabsToTheEndFrom for that reason.
Comment 4•7 years ago
|
||
sure, could be toStart and toEnd. simplifying a touch: optionsObject = { option: allExcept | all | toEnd | toStart prompt: boolean }
Comment 5•7 years ago
|
||
What's the use case for toStart? tabbrowser doesn't currently offer this. Also, how would you handle the allExcept or toEnd options when listOfIDs contains multiple ids?
Comment 6•7 years ago
|
||
allExcept would remove all tabs except those in listOfIDs (and maybe current tab?). If listOfIDs is empty, it would remove all except the current tab. toEnd/toStart would remove starting from current tab, or listOfIDs[0] if provided. we can either rely on docs or throw an error if more than one id is in the list. OP requested both toEnd and toStart.
Comment 7•7 years ago
|
||
Hi all, this has been added to the agenda for the August 22 WebExtensions APIs triage meeting. Geoffrey, would you be able to join us? Wiki: https://wiki.mozilla.org/Add-ons/Contribute/Triage#Next_Meeting Agenda: https://docs.google.com/document/d/11SdY-aRhvPU3SvH8jpj0covj3Teq9_GJl8wMeEeSVwo/edit#
Updated•7 years ago
|
Flags: needinfo?(amckay)
Reporter | ||
Comment 8•7 years ago
|
||
Summary (mainly from the meeting) * This API would greatly simplify API usage in many WebExtensions to bulk remove/delete certain tabs (left/right/whatever) ** This might improve performance (not needing to query the tabs API). * CTRL+Shift+T (native Firefox shortcut to restore tabs) would reopen all closed tabs at once * The "prompt" parameter can be used as a confirmation for the user. Implementing the prompt parameter obsoletes bug 1376394 (In reply to comment 1) > > optionsObject = { > allExcept, //boolean, closes all except listOfIDs > all, //boolean closes all tabs > right, //boolean, closes all to right > left, // boolean, closes all to left > prompt, // boolean > ...other options?... >} Optional (array of?) windowId (as first parameter) to limit "all" or "allExcept"?
Comment 9•7 years ago
|
||
On the assumption that this API works well with Ctrl+Shift+T, this would be a neat thing to have. I think its easy enough for an extension to calculate all the tabs, above, below, left, right, or whatever of a certain point and we should leave that to the extension author. A tree style tabs implementation as an example would be "everything in this tree". As such we should let close(...) take a list of tabIds instead of just one. I don't think there's any need for any more complicated logic than that. I would split the prompt? into a seperate bug so any discussion of how to closing a tab should work can occur in that bug.
Flags: needinfo?(amckay)
Updated•7 years ago
|
Severity: normal → enhancement
status-firefox57:
--- → wontfix
Keywords: feature
Priority: -- → P5
Whiteboard: [design-decision-needed] → [design-decision-needed][tabs]
Updated•6 years ago
|
Whiteboard: [design-decision-needed][tabs] → [design-decision-needed][tabs] [needs-follow-up]
Comment 10•6 years ago
|
||
Hi Geoffrey, this has been added to the agenda for the WebExtensions APIs triage on April 3, 2018. Would you be able to join us? Here’s a quick overview of what to expect at the triage: * We normally spend 5 minutes per bug * The more information in the bug, the better * The goal of the triage is to give a general thumbs up or thumbs down on a proposal; we won't be going deep into implementation details Relevant Links: * Wiki for the meeting: https://wiki.mozilla.org/WebExtensions/Triage#Next_Meeting * Meeting agenda: https://docs.google.com/document/d/1H1ZEWf7dmyyu7NZZL90TkbyaUTjbdIK3TUEtO_vff34/edit# * Vision doc for WebExtensions: https://wiki.mozilla.org/WebExtensions/Vision
Comment 11•6 years ago
|
||
This is being narrowed down to: - pass list of id's to tabs.remove and an option to prevent prompting - prompts probably shouldn't be shown from background operations also
Whiteboard: [design-decision-needed][tabs] [needs-follow-up] → [design-decision-approved][tabs] [needs-follow-up]
Comment 12•6 years ago
|
||
Note: If I understand this correctly, getting IDs of Tabs to the left/right is quite easy without the need for extra API. (I have already been doing it for multiple purposes in FoxyTab)
Updated•6 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•6 years ago
|
Product: Toolkit → WebExtensions
Comment 13•6 years ago
|
||
Bulk move of bugs per https://bugzilla.mozilla.org/show_bug.cgi?id=1483958
status-firefox57:
wontfix → ---
Component: Untriaged → General
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•