Click here to Skip to main content
13,559,184 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 4 Jan 2011
Licenced CPOL

JavaScript listens to Enable/Disable event of an extension in Firefox4

, 5 Jan 2011
Rate this:
Please Sign up or sign in to vote.
JavaScript can listen to the enable/disable event from Firefox4 and can send to XPCOM components


This article explains how a script will receive a notification whenever user will enable or disable an extension in Firefox 4.


The background is in a previous version of Firefox displayed extensions in a separate window but in case of Firefox4, an Add-ons Manager Tab will display all attached extensions with enable/disable button.

JavaScript code

A developer first needs to add addEventListener for the main window and needs to add an addon listener which will listen to each event of the extensions. Refer to the below code:

var listener = {
    onDisabling: function(addon,needsRestart) {  
    if ( == "{{9974FB49-725B-4e4b-AE33-3C0781F1F41D}}") {
    var observerService = Components.classes[";1"]
    observerService.notifyObservers(null, "user-notification-disable", "Ext is disabled");
var listener = {
    onEnabling: function(addon,needsRestart) {  
    if ( == "{{9974FB49-725B-4e4b-AE33-3C0781F1F41D}}") {
    var observerService = Components.classes[";1"]
    observerService.notifyObservers(null, "user-notification-disable", "Ext is Enabled");
  }  }
var Hide = { 
onLoad: function() { 
	try { 
	catch (ex) {} 
window.addEventListener("load", function(e) { Hide.onLoad(e); }, false);

Points of Interest

Script can send a notification to XPCOM component for further action on enable/disable event.


This is the first version of the article.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

India India
This member doesn't quite have enough reputation to be able to display their biography and homepage.

You may also be interested in...

Comments and Discussions

GeneralReason for my vote of 5 nice going to user it Pin
Pranay Rana5-Jan-11 20:58
memberPranay Rana5-Jan-11 20:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01-2016 | 2.8.180515.1 | Last Updated 5 Jan 2011
Article Copyright 2011 by Monu_TCS
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid