Maybe here are experts around to answer his question:
A way to determine that no tab is currently loading?
Hi there,
I'm trying to delay some activation code in my addon to only execute
after all tabs are finished loading. I'm not sure of the best way to do
this. I tried to add some onLoad listeners to get called when all
counted tabs finished loading, but in some cases there could be many
tabs but they are not all set to load at startup (depending on user
configuration).
So instead I thought, when my addon starts up it could just quickly scan
all tabs; if any were still in the process of loading, it would continue
to wait. Only when it determined that there were no tabs currently in a
state of loading would it execute the logic.
So my question is - is there a way to query across all tabs to see if
any are in a loading state?
Thanks
Tom
> I'm trying to delay some activation code in my addon to only execute
> after all tabs are finished loading. I'm not sure of the best way to
> do this.
Session store sends out a "sessionstore-windows-restored" observer
notification when all tabs have finished loading.
--
Warning: May contain traces of nuts.
Thanks for the tip. I gave that a try and that event fires way too
early it seems (a known behavior I guess, as the documentation
mentions such a caveat). That seems to fire as soon as the browser
comes up, even though tabs are still loading.
So I'm not sure if there's an event that I can listen to with relative
accuracy; that's why I was looking into some sort of polling solution
where I could check the state of each tab myself, and check if it's
currently in a LOADING state. Does some API like that exist?
-Tom
> neandr wrote:
>
>> I'm trying to delay some activation code in my addon to only execute
>> after all tabs are finished loading. I'm not sure of the best way to
>> do this.
>
> Session store sends out a "sessionstore-windows-restored" observer
> notification when all tabs have finished loading.
My bad, it sends it out when all windows have opened. But (unless you
set the preference to load all tabs immediately) it won't have even
started loading all tabs, let alone finished.
Maybe the status of that button(s) could be polled somehow?
Anyone having an idea here?
Günter
> There should be an event/observer with finishing loading. If you use
> the "Reload current page" button as part of the url box it turns to a
> X with red background and only after finishing loading it turns to the
> circled arrow with white background.
>
> Maybe the status of that button(s) could be polled somehow?
You could look at the browser's docShell.isLoadingDocument which will
tell you if it's currently busy (and you could then attach a web
progress listener or other event handler to notify when it stops) but
that won't help with tabs that haven't started loading yet.