API to call handler unconditionally when tab becomes ready or is already ready

RESOLVED DUPLICATE of bug 1026543

Status

P2
normal
RESOLVED DUPLICATE of bug 1026543
5 years ago
4 years ago

People

(Reporter: myk, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
It's useful to be able to either open a tab or activate an existing tab and then execute some code when the tab becomes ready or is already ready.

The "open tab" case is easy, because the tab will never be ready at that point, so one can simply set a "ready" handler: |Tabs.open({ onReady: callback })|.

But the "activate existing tab" case is hard, because the tab may or may not be ready yet, so a "ready" handler may or may not be called; and it isn't currently possible to determine whether or not the tab is ready.

It should be possible to set a "ready" handler on a new or existing tab that is called unconditionally when the tab becomes ready or immediately (perhaps after a turn of the event loop for consistency) if the tab is already ready.
Seems like we could at least expose the document's readyState to say whether the tab was done loading or not. Not sure if this should be an event handler though, feels more like exactly what promises are for.

Updated

5 years ago
Priority: -- → P2
Bug 1026543 exposed `tab.readyState`
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1026543
You need to log in before you can comment on or make changes to this bug.