[Project_owners] Initialising an extension once per session

Eric H. Jung eric.jung at yahoo.com
Tue Jul 15 09:48:58 PDT 2008


----- Original Message ----

> From: Eric H. Jung <eric.jung at yahoo.com>
> To: Mozdev Project Owners List <project_owners at mozdev.org>
> Sent: Tuesday, July 15, 2008 12:08:35 PM
> Subject: Re: [Project_owners] Initialising an extension once per session
> 
> ----- Original Message ----
> 
> > From: Brian King 
> > I initialise my Firefox extensions the standard way as outlined here 
> > (using addEventListener):
> > 
> > 
> http://developer.mozilla.org/en/docs/Code_snippets:On_page_load#Running_code_on_an_extension.27s_first_run_or_after_an_extension.27s_update
> > 
> > However, this is fired for every new browser window. Is there a way to 
> > make it happen only once per browser session?
> > 
> > Notes:
> > 
> > -> this is not about first run, but rather run per session
> > -> removing the event listener as in the example does not do it
> > -> i'd like to avoid using prefs if possible
> 
> Perhaps there's a notification fired when a session starts that you can observe?

To follow-up on my own suggestion:
http://mxr.mozilla.org/seamonkey/source/browser/components/sessionstore/src/nsSessionStore.js
shows a few dispatchEvent() calls, dispatching SSTabRestoring, SSTabRestored, SSTabClosing, etc.

Would observing one or more of these suffice?


      


More information about the Project_owners mailing list