Open Bug 1399885 Opened 8 years ago Updated 3 years ago

Consider adding browser.{windows,tabs}.onBeforeRemoved

Categories

(WebExtensions :: Frontend, enhancement, P5)

enhancement

Tracking

(firefox57 wontfix)

Tracking Status
firefox57 --- wontfix

People

(Reporter: nika, Unassigned)

Details

(Whiteboard: [design-decision-approved])

I've recently run into a use case for a webextension where I want to be able to salvage some tabs from a window (by browser.tabs.move-ing them into another window) as the window is being closed. The `tabs.onRemoved` and `windows.onRemoved` events unfortunately fire too late in the process, as they fire after the window or tab has been removed, and there is no time between them firing and the tabs being destroyed for the tabs to be moved out of the dying window and/or salvaged in some way. `{tabs,windows}.onBeforeRemoved` would be similar to `webRequest.onBeforeRequest`, in that it would be possible for the webextension consumer to cancel the removal, or return a promise to delay decision making while asynchronous work (such as moving tabs out of the window) is being completed. The main concern here which I immediately have would be performance impact, as this could potentially add a round-trip to the webextension process into the tab close / window close logic. Blocking APIs like this do have some precedent (e.g. onBeforeRequest), and I imagine that this could have its impact reduced by not performing the round-trip if no listeners are installed.
Severity: normal → enhancement
Priority: -- → P5
Whiteboard: [design-decision-needed]
Hi Michael, this has been added to the agenda for the October 3 WebExtensions APIs triage. Would you be able to join us? Agenda: https://docs.google.com/document/d/1X5RmNq2tGC5Aw3npIKqxB2vhnVhg9uOoXh2TggduTPU/edit# Wiki: https://wiki.mozilla.org/Add-ons/Contribute/Triage#Next_Meeting
(In reply to Caitlin Neiman (http://pronoun.is/she) from comment #1) > Hi Michael, this has been added to the agenda for the October 3 > WebExtensions APIs triage. Would you be able to join us? Sure, do I need to do anything other than show up to the vidyo room?
Awesome! No need to prepare anything (although you may get some questions about use cases). See you on Tuesday!
Whiteboard: [design-decision-needed] → [design-decision-approved]
Product: Toolkit → WebExtensions

Any progress on this or are the details still to be worked out? (https://docs.google.com/document/d/1X5RmNq2tGC5Aw3npIKqxB2vhnVhg9uOoXh2TggduTPU/edit#heading=h.hhpni8ijl0wx)

If so I suggest the same callbacks as browser.{windows,tabs}.onRemoved, that is tab/window id as the first argument of the callback and a second removeInfo argument for the tab onBeforeRemoved callback.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.