Question

I'm working on a profile switching addon and came across nsICategoryManager.

I was wondering what is this? What are some practical uses for it?

I read the MDN article but can't think of any uses for it.

Was it helpful?

Solution

The purpose of nsICategoryManager is to add entries (typically XPCOM components) to categories. The manager itself merely provides that registration mechanisms, how the categories are used depends entirely on the code that reads out the category entries. For example, there it the profile-after-change category for components that need to be activated when Firefox starts up.

Most extensions should no longer be using nsICategoryManager explicitly, adding a category entry can be done with a line in chrome.manifest:

category profile-after-change MyComponent @foobar/mycomponent;1

This will call nsICategoryManager.addCategoryEntry() implicitly when the extension is activated.

Edit: Just out of curiosity, I decided to search for nsCategoryCache in the Firefox source code to see what other categories there are. Here the list:

These are only the categories being cached and monitored for changes, the complete list is much longer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top