Search completed in 0.89 seconds.
nsIComponentRegistrar
xpcom/components/
nsicomponentregistrar.idlscriptable this interface provides methods to access and modify the xpcom component registry.
Creating the Component Code
includes and constants in weblock1.cpp #include <stdio.h> // may be defined at the project level // in the makefile #define mozilla_strict_api #include "nsimodule.h" #include "nsifactory.h" #include "nsicomponentmanager.h" #include "
nsicomponentregistrar.h" // use classes to handle iids // classes provide methods for comparison: equals, etc.
...the two other includes, nsicomponentmanager.h and
nsicomponentregistrar.h, provide functions such as registerfactorylocation that are required to implement the module and factory classes in your code.
... the many faces of the xpcom component manager the three core component management interfaces, nsicomponentmanager, nsiservicemanager, and
nsicomponentregistrar, are described below: nsicomponentmanager - creates objects and gets implementation details about objects nsiservicemanager - provides access to singleton objects and discovers singleton state
nsicomponentregistrar - registers and unregisters factories and components; handles autoregistration and the discovery and enumeration of registered components.
...And 8 more matches
CommandLine - Archive of obsolete content
define your own command line handler component: components/clh.js const nsisupports = components.interfaces.nsisupports; const nsicategorymanager = components.interfaces.nsicategorymanager; const
nsicomponentregistrar = components.interfaces.
nsicomponentregistrar; const nsicommandline = components.interfaces.nsicommandline; const nsicommandlinehandler = components.interfaces.nsicommandlinehandler; const nsifactory = components.interfaces.nsifactory; const nsimodule = components.interfaces.nsimodule; const class_id = components.id("178cfbb6-503c-11dc-8314-0800200c9a...
... this; throw components.results.ns_error_no_interface; }, /* nsimodule */ getclassobject : function mod_gch(acompmgr, acid, aiid) { if (acid.equals(class_id)) return apphandler.queryinterface(aiid); throw components.results.ns_error_failure; }, registerself : function mod_regself(acompmgr, afilespec, alocation, atype) { var compreg = acompmgr.queryinterface(
nsicomponentregistrar); compreg.registerfactorylocation(class_id, class_name, contract_id, afilespec, alocation, atype); var catman = components.classes["@mozilla.org/categorymanager;1"] .getservice(nsicategorymanager); catman.addcategoryentry("command-line-handler", cld_category, contract_id, true, true); }, ...
...unregisterself : function mod_unreg(acompmgr, alocation, atype) { var compreg = acompmgr.queryinterface(
nsicomponentregistrar); compreg.unregisterfactorylocation(class_id, alocation); var catman = components.classes["@mozilla.org/categorymanager;1"] .getservice(nsicategorymanager); catman.deletecategoryentry("command-line-handler", cld_category); }, canunload : function (acompmgr) { return true; } }; function nsgetmodule(acompmgr, afilespec) { return apphandlermodule; } create an observer that will get notified when arguments change: chrome/content/cmdline.js function commandlineobserver() { this.register(); } commandlineobserver.prototype = { observe: function(asubject, atopic, adata) { var cmdline = asubject.queryinterface(components.i...
Component Internals
as this section and the next describe, you can register your component explicitly during installation, or with the regxpcom program, or you can use the autoregistration methods in the service manager to find and register components in a specified components directory: xpinstall apis regxpcom command-line tool
nsicomponentregistrar apis from service manager the registration process is fairly involved.
... a gecko embedding application may also provide its own way of registering xpcom components using the interface that is in fact used by both xpinstall and regxpcom,
nsicomponentregistrar.
...sometimes, applications use the
nsicomponentregistrar interface and create their own code for watching a particular directory and registering new components that are added there, which is what's often referred to as autoregistration.
platform/xpcom - Archive of obsolete content
to access the replacement factory you need to do something like this: var id = components.manager.queryinterface(ci.
nsicomponentregistrar).
...see
nsicomponentregistrar.autoregister() for details.
NS_GetComponentRegistrar
#include "nsxpcom.h" #include "
nsicomponentregistrar.h" nsresult ns_getcomponentregistrar( nsicomponentmanager** aresult ); parameters aresult [out] a reference to the xpcom component registrar.
...see also
nsicomponentregistrar ...
Custom about: URLs - Archive of obsolete content
const {classes: cc, interfaces: ci, manager: cm, results: cr, utils: cu, constructor: cc} = components; cm.queryinterface(ci.
nsicomponentregistrar); components.utils.import("resource://gre/modules/services.jsm"); // globals const aboutpage_description = 'this is my custom about page'; const aboutpage_id = 'aa132730-2278-11e5-867f-0800200c9a66'; // make sure you generate a unique id from https://www.famkruithof.net/uuid/uuidgen const aboutpage_word = 'myaboutpage' const aboutpage_uri = 'data:text/html,hi this is the page that is shown when...
XPCOM Objects - Archive of obsolete content
the add and delete calls to the category manager would have to be done in the registerself and unregisterself methods: registerself : function(acompmgr, alocation, aloaderstr, atype) { let categorymanager = cc[@mozilla.org/categorymanager;1].getservice(ci.nsicategorymanager); acompmgr.queryinterface(ci.
nsicomponentregistrar); acompmgr.registerfactorylocation( class_id, class_name, contract_id, alocation, aloaderstr, atype); categorymanager.addcategoryentry( "content-policy", "xulschool hello world", contract_id, true, true); }, in this case the component would need to implement nsicontentpolicy.
How to implement a custom autocomplete search component
if (aouter != null) throw components.results.ns_error_no_aggregation; if (this.singleton == null) this.singleton = new simpleautocompletesearch(); return this.singleton.queryinterface(aiid); } }; // module var simpleautocompletesearchmodule = { registerself: function(acompmgr, afilespec, alocation, atype) { acompmgr = acompmgr.queryinterface(components.interfaces.
nsicomponentregistrar); acompmgr.registerfactorylocation(class_id, class_name, contract_id, afilespec, alocation, atype); }, unregisterself: function(acompmgr, alocation, atype) { acompmgr = acompmgr.queryinterface(components.interfaces.
nsicomponentregistrar); acompmgr.unregisterfactorylocation(class_id, alocation); }, getclassobject: function(acompmgr, acid, aiid) { if (!aiid.equals(componen...
Downloads.jsm
components.manager.queryinterface(components.interfaces.
nsicomponentregistrar) .registerfactory(components.id("{1b4c85df-cbdd-4bb6-b04e-613caece083c}"), "", "@mozilla.org/transfer;1", null); ...
Index
415
nsicomponentregistrar component manager, components, interfaces, interfaces:scriptable, xpcom, xpcom api reference, xpcom interface reference register a component (.manifest) file or all component files in a directory.
CIDToContractID
this content is now available at
nsicomponentregistrar.cidtocontractid().
autoRegister
this content is now available at
nsicomponentregistrar.autoregister().
autoUnregister
this content is now available at
nsicomponentregistrar.autounregister().
contractIDToCID
this content is now available at
nsicomponentregistrar.contractidtocid().
enumerateCIDs
this content is now available at
nsicomponentregistrar.enumeratecids().
isCIDRegistered
this content is now available at
nsicomponentregistrar.iscidregistered().
registerFactory
this content is now available at
nsicomponentregistrar.registerfactory().
unregisterFactory
this content is now available at
nsicomponentregistrar.unregisterfactory().
XPCOM Interface Reference
sitornsicachingchannelnsicancelablensicategorymanagernsichannelnsichanneleventsinknsichannelpolicynsicharsetresolvernsichromeframemessagemanagernsichromeregistrynsiclassinfonsiclipboardnsiclipboardcommandsnsiclipboarddragdrophooklistnsiclipboarddragdrophooksnsiclipboardhelpernsiclipboardownernsicollectionnsicommandcontrollernsicommandlinensicommandlinehandlernsicommandlinerunnernsicomponentmanager
nsicomponentregistrarnsicompositionstringsynthesizernsiconsolelistenernsiconsolemessagensiconsoleservicensicontainerboxobjectnsicontentframemessagemanagernsicontentprefnsicontentprefcallback2nsicontentprefobservernsicontentprefservicensicontentprefservice2nsicontentsecuritypolicynsicontentsniffernsicontentviewnsicontentviewmanagernsicontentviewernsicontrollernsicontrollersnsiconverterinputstreamnsiconverteroutputstrea...
XPCOM Interface Reference by grouping
nsiidleservice internal command nsicommandline nsicommandlinehandler nsicommandlinerunner component nsicomponentmanager preferences nsicontentprefobserver nsicontentprefservice
nsicomponentregistrar internationalization nsibidikeyboard nsilocale io filesystem nsidirectoryenumerator nsidirectoryiterator nsidirectoryservice nsidirectoryserviceprovider nsidirectoryserviceprovider2 nsidirindex nsidirindexlistener nsi...
Setting HTTP request headers
if (iid.equals(components.interfaces.nsiobserver) || iid.equals(components.interfaces.nsisupports)) return this; components.returncode = components.results.ns_error_no_interface; return null; }, }; var mymodule = { registerself: function (compmgr, filespec, location, type) { var compmgr = compmgr.queryinterface(components.interfaces.
nsicomponentregistrar); compmgr.registerfactorylocation(this.mycid, this.myname, this.myprogid, filespec, location, type); log("----------------------------> registerself"); var catmgr = compo...