Open Bug 1466904 Opened 3 years ago Updated 2 months ago

Add API to wake up a discarded tab


(WebExtensions :: General, enhancement, P3)



(Not tracked)


(Reporter: ianbicking, Unassigned)


(Blocks 1 open bug)


Currently if you attempt to call browser.tabs.executeScript() on a discarded tab, the script isn't executed and the tab remains discarded.

I've created a small extension to demonstrate the current behavior:

There are two resolutions I can see:

1. Wake the tab up on demand. Per some discussion, this used to be the behavior, but it made it easy for an extension to restore all tabs on session restore, with poor performance characteristics.

2. Allow the tab to be woken up. Currently you can do this by activating the tab, but I think it would be nice to allow it to be done without changing the user's active tab (which is intrusive).

2b. Give an error if you attempt to interact with a discarded tab. Currently the call never returns.
Depends on: 1322485
Product: Toolkit → WebExtensions
tabs.reload() isn't ideal. Restoring a discarded tab is meant to be extremely conservative, and load things from the cache whenever possible. tabs.reload() is not, and will generally make a lot of additional requests that a session store load would not.

We should probably support this by calling tabs.update() and setting discarded to false. Though I'd really generally prefer that add-ons not do that.
Component: Untriaged → General
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.