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.
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:
"content-policy"
for nsIContentPolicy
instances."net-content-sniffers"
and "content-sniffing-services"
for nsIContentSniffer
instances."vacuum-participant"
for mozIStorageVacuumParticipant
instances."bookmark-observers"
for nsINavBookmarkObserver
instances."history-observers"
for nsINavHistoryObserver
instances."idle-daily"
for observers managed by nsIIdleService
.These are only the categories being cached and monitored for changes, the complete list is much longer.