Open Bug 1411603 Opened 2 years ago Updated 9 days ago

Impossible for WebExtension to detect when FF has done restoring tabs from previous session (new API request)

Categories

(WebExtensions :: General, enhancement, P5)

56 Branch
enhancement

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: p, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Build ID: 20170926190823

Steps to reproduce:

My extension needs to make sure there is one particular tab always open.


Actual results:

When Firefox restores tabs from previous session, it's sometimes done **after** my WebExtension's background script has started.

So if I call browser.tabs.query from my background script, it's going to return nothing, because WebExtension has been loaded before FF restored all tabs.


Expected results:

We need an API (event) that fires when FF has finished restoring all tabs.
It could be named "onTabsRestored", "onAllTabsRestored", "onSessionRestored", "onRestored", I'm not sure which one would suit the best.

Current workaround is to delay browser.tabs.query call with window.setTimeout, but it's hacky solution and I think not always guarantees success.
Summary: Impossible for WebExtension to detect when FF has done restoring tabs from previous session in WebExtension (new API request) → Impossible for WebExtension to detect when FF has done restoring tabs from previous session (new API request)
See also: bug 1396399
Severity: normal → enhancement
Component: Untriaged → WebExtensions: General
Product: Firefox → Toolkit
Priority: -- → P5
Sorry, got the wrong bug in comment 1, should have been bug 1378459.
Product: Toolkit → WebExtensions
Blocks: 1476144
No longer blocks: Session_managers
Is Bug 1413263 a duplicate of this bug (Bug 1411603)?
See Also: → 1413263
You need to log in before you can comment on or make changes to this bug.