Execute Script on Firefox Exit

Discussion of general topics about Mozilla Firefox
Post Reply
.tommygun.
Posts: 17
Joined: November 6th, 2017, 8:03 am

Execute Script on Firefox Exit

Post by .tommygun. »

I have a very simple script that I would like to execute automatically when Firefox exits.
Is this somehow possible ?
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Execute Script on Firefox Exit

Post by morat »

Do you want to use an XPCOM interface in a script?

XPCOM Interface Reference
http://developer.mozilla.org/en-US/docs ... /Interface

Someone in a german forum got the userChromeJS extension working in Firefox 57.

userChromeJS
http://userchromejs.mozdev.org/

More info: http://forums.mozillazine.org/viewtopic ... #p14747866

It's easier to run a script at startup, then at shutdown.
.tommygun.
Posts: 17
Joined: November 6th, 2017, 8:03 am

Re: Execute Script on Firefox Exit

Post by .tommygun. »

....... thanks for your reply.
I'm running the script at startup now and it's working fine.
The script just replaces the webappsstore.sqlite with a saved copy of mine.
It's because my Privacy & Security settings are for cookies:
Keep until I close Firefox and Clear history when Firefox closes with all settings checked.
With this the saved settings for an installed add-on reverted back to default on the next start of Firefox.
Still I would like to execute this script when Firefox exits, because now if links in e-mails for example are clicked, Firefox starts normal without using my script.
Hopefully I will find a solution to this sooner or later, as this is a privacy issue that bugs me.
My knowledge and time is too limited to get this done with XPCOM or userChromeJS, but I'll check it out again when I find the time.
Thanks again for your help .......
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Execute Script on Firefox Exit

Post by morat »

tommygun wrote:I'll check it out again when I find the time.
I heard the topic is difficult.
Lithopsian wrote:Accessing local storage from an addon is a nightmare.
More info
http://discourse.mozilla.org/t/8000

Reference
http://dxr.mozilla.org/mozilla-release/ ... ncipal.idl
http://dxr.mozilla.org/mozilla-release/ ... anager.idl
http://dxr.mozilla.org/mozilla-release/ ... anager.idl
Post Reply