Search completed in 0.92 seconds.
65 results for "xpidl":
Your results are loading. Please wait...
XPIDL
xpidl is an interface description language used to specify xpcom interface classes. interface description languages (idl) are used to describe interfaces in a language- and machine-independent way. idls make it possible to define interfaces which can then be processed by tools to autogenerate language-dependent interface specifications. xpidl is expected to converge towards webidl in the future. note: starting in gecko 9.0, the older xpidl utility, which was previously used to generate c++ header files, typelib information, and so forth has been replaced with pyxpidl in the gecko sdk. pyxpidl has been used for some time now, but now the older tool has been fully retired. ...
...e language-dependent interface specifications. xpidl is expected to converge towards webidl in the future. note: starting in gecko 9.0, the older xpidl utility, which was previously used to generate c++ header files, typelib information, and so forth has been replaced with pyxpidl in the gecko sdk. pyxpidl has been used for some time now, but now the older tool has been fully retired. writing xpidl interface files xpidl closely resembles omg idl, with extended syntax to handle iids and additional types. some examples are in the xpcom/base and xpcom/ds directories of the mozilla tree. ...
...e c++ header files, typelib information, and so forth has been replaced with pyxpidl in the gecko sdk. pyxpidl has been used for some time now, but now the older tool has been fully retired. writing xpidl interface files xpidl closely resembles omg idl, with extended syntax to handle iids and additional types. some examples are in the xpcom/base and xpcom/ds directories of the mozilla tree. xpidl:syntax (now up to date again) xpidl syntax (out of date) xpidl author's guide (not as out of date) explanation of idl semantics a full guide to the syntax can be found at xpidl:syntax, which is written in an abnf form. an xpidl file is essentially just a series of declarations. at the top level, we can define typedefs, native types, or interfaces. interfaces may furthermore contain typedefs...
...And 9 more matches
nsXPIDLCString
class declaration nstxpidlstring extends nststring such that: (1) mdata can be null (2) objects of this type can be automatically cast to |const chart*| (3) getter_copies method is supported to adopt data allocated with ns_alloc, such as "out string" parameters in xpidl. ...
... class declaration nstxpidlstring extends nststring such that: (1) mdata can be null (2) objects of this type can be automatically cast to |const chart*| (3) getter_copies method is supported to adopt data allocated with ns_alloc, such as "out string" parameters in xpidl. ...
... class declaration nstxpidlstring extends nststring such that: (1) mdata can be null (2) objects of this type can be automatically cast to |const chart*| (3) getter_copies method is supported to adopt data allocated with ns_alloc, such as "out string" parameters in xpidl. ...
...And 6 more matches
XPIDL Syntax
Mozilla › Tech › XPIDL › Syntax
simplifications, conventions and notation the syntax is specified according to abnf as defined by rfc 5234, although a few productions use prose for clarity of understanding. ...
...simplifications, conventions and notation the syntax is specified according to abnf as defined by rfc 5234, although a few productions use prose for clarity of understanding. ...
...simplifications, conventions and notation the syntax is specified according to abnf as defined by rfc 5234, although a few productions use prose for clarity of understanding. ...
...And 6 more matches
nsXPIDLString
class declaration nstxpidlstring extends nststring such that: (1) mdata can be null (2) objects of this type can be automatically cast to |const chart*| (3) getter_copies method is supported to adopt data allocated with ns_alloc, such as "out string" parameters in xpidl. ...
... class declaration nstxpidlstring extends nststring such that: (1) mdata can be null (2) objects of this type can be automatically cast to |const chart*| (3) getter_copies method is supported to adopt data allocated with ns_alloc, such as "out string" parameters in xpidl. ...
... class declaration nstxpidlstring extends nststring such that: (1) mdata can be null (2) objects of this type can be automatically cast to |const chart*| (3) getter_copies method is supported to adopt data allocated with ns_alloc, such as "out string" parameters in xpidl. ...
...And 5 more matches
pyxpidl
the pyxpidl tool suite has been built to replace the older xpidl tool which, in the past, was used to turn xpidl files into c++ headers and xpcom typelibs (xpt files). the newer utility has the advantage of not needing any code to be compiled in order to use it, and let us remove a bunch of old code from the tree. pyxpidl has been in use for a while, but replaced xpidl in the gecko sdk starting in gecko 9.0. using pyxpidl pyxpidl is in the sdk in the sdkdir/sdk/bin/ directory. unlike xpidl, which combined all the functions into a single utility, pyxpidl is comprised of two utilities: header.py, which generates c++ headers from idl, and typelib.py, which generates xpt files. pyxpidl requires a directory to cache certain information in. you can use a temporary directory or the curren...
... or the current directory or whatever works best for you. ...
...urrent directory or whatever works best for you. ...
...And 4 more matches
xpidl
Mozilla › Tech › XPIDL › xpidl
xpidl is a tool for generating xpcom interface information, based on xpidl interface description files. it generates: c++ header files (.h), with a commented template for full c++ implementation of the interface xpconnect typelib files (.xpt), with runtime type information to dynamically call xpcom objects through xpconnect note: starting in gecko 9.0, xpidl has been replaced with pyxpidl in the gecko sdk. pyxpidl has been used for some time now, but now this older tool has been fully retired. xpidl is based on the libidl idl compiler from the gnome project. the libidl compiler depends on glib, also from the gnome project. the xpidl compiler is now part of the build process, allowing us to generate headers used by the xpcom components. please check the build documentation for f...
..., but now this older tool has been fully retired. xpidl is based on the libidl idl compiler from the gnome project. the libidl compiler depends on glib, also from the gnome project. the xpidl compiler is now part of the build process, allowing us to generate headers used by the xpcom components. please check the build documentation for further information on where to get libidl and glib. using xpidl to add an idl file to the build, use the xpidlsrcs makefile variable. ...
...iler depends on glib, also from the gnome project. the xpidl compiler is now part of the build process, allowing us to generate headers used by the xpcom components. please check the build documentation for further information on where to get libidl and glib. using xpidl to add an idl file to the build, use the xpidlsrcs makefile variable. ...
... the xpidl compiler is now part of the build process, allowing us to generate headers used by the xpcom components. please check the build documentation for further information on where to get libidl and glib. using xpidl to add an idl file to the build, use the xpidlsrcs makefile variable. for testing purposes, or one-off interface compilation, xpidl can be run from the command line: usage: ./xpidl -m mode [-w] [-v] [-t version number] [-d filename.pp] [-i path] [-o basename | -e filename.ext] filename.idl -a emit annotations to typelib -w turn on warnings (recommended) -v verbose mode (nyi) -t create a typelib of a specific version number -i add entry to start of include path for ``#include "nsithing.idl" -o use basename (e.g. ``/tmp/nsit...
Introduction to XPCOM for the DOM
interface, and you don't have to care if the implementation of the interface (the concrete class) changes. xpcom pushes this concept to the extreme. pure virtual methods are declared with the following syntax: virtual nsresult functionfoo() = 0; an interface is thus simply a c++ class where all the member functions are declared as pure virtual functions. an interface can also be defined using xpidl. this is described in section 1.e, "how to add an interface". since an interface doesn't have any implementation, it has to be implemented by a non-abstract class -- a concrete class. if the interface is called nsifoo and the class is called nsfoo, we say that "nsfoo implements nsifoo", or that "nsfoo inherits from nsifoo". the c++ code is the following: class nsfoo : public nsifoo for those ...
...face introduction the purpose of this tutorial is to describe the process of adding a new interface to the dom and then implementing it. a good understanding of the previous sections is preferred to understand this tutorial. you could want to add a new interface for several reasons, like the addition of a new dom object, or to respect an eventual "interface freeze". first we will take a look at xpidl and how it can help you define interfaces. next we will describe the build system, makefiles, etc... and finally, we will look at the implementation of our new interface through the creation of an nsidomfabian interface (fabian is my first name ;-). xpidl xpidl stands for cross-platform interface definition language. instead of coding interfaces directly in c++ , one can use xpidl. it simplifie...
...mplifies greatly the task of defining interfaces, and offers some interesting features, like automatic generation of documentation, and xpt generation. the first thing to do is to decide what our interface, nsidomfabian, will do. for the purpose of this document, i have chosen to implement a new html interface called nsidomfabian. it will be implemented by the class nshtmldocument. the syntax of xpidl is straightforward: #include "domstubs.idl"; [scriptable, uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)] interface nsidomfabian : nsisupports { void fabian(); readonly attribute boolean neat; }; this is the definition of the nsidomfabian interface. the uuid of the interface is a unique identifier. every interface needs one. you can generate them using guidgen on windows, or by...
...And 10 more matches
Starting WebLock
nterface for the weblock component must answer is: how should weblock look to the outside world? what, in other words, is the interaction of clients with the weblock component? in this section, we enumerate the basic functionality the component should expose and create the single interface that organizes and provides this functionality. instead of starting with the implementation, developers use xpidl (see xpidl and type libraries for more information about xpidl) to define the interface to the component: how the functionality should be organized, expressed, and exposed to its clients. in general, the weblock service interface needs to include the following functionality: lock - enable web locking so that any browser in the gecko application is restricted to the white list of website domai...
...he interface for the weblock component in this way. for example, addsite is supposed to add the current url to the white list, but is the url an input parameter to the method, is it the topmost web page in the gecko application, or is it something more random-a url picked from global history or that's been given context in some other way? as a strongly typed and implementation-agnostic language, xpidl requires that you be quite specific about the apis, the list of parameters, their order, and their types. xpidl requires that you spell it all out, in other words. and it's this formality that makes the interfaces in xpcom effective contracts between services and clients. the next section shows the interface of the weblock component, iweblock, in xpidl. once the interface has been described in t...
...quires that you be quite specific about the apis, the list of parameters, their order, and their types. xpidl requires that you spell it all out, in other words. and it's this formality that makes the interfaces in xpcom effective contracts between services and clients. the next section shows the interface of the weblock component, iweblock, in xpidl. once the interface has been described in the xpidl language, the interface file can be used to generate the header files needed for the implementation code, the binary type library files that let you use the interface of the weblock component from javascript, and even broken linkjavadoc style html documentation. ...
...And 9 more matches
How to build an XPCOM component in JavaScript
aces and components. you can download an old version of xpcomviewer that works with firefox 1.5 from mozdev mirrors. if an interface exists that meets your needs, then you do not need to write an idl, or compile a typelib, and may skip to the next section. if you don't find a suitable pre-existing interface, then you must define your own. xpcom uses a dialect of idl to define interfaces, called xpidl. here's the xpidl definition for our helloworld component: helloworld.idl #include "nsisupports.idl" [scriptable, uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)] interface nsihelloworld : nsisupports { string hello(); }; note that you must generate a new uuid for each xpcom component that you create. see generating guids for more information. compiling the typelib your interface definition m...
...ed into a binary format (xpt) in order to be registered and used within mozilla applications. the compilation can be done using the gecko sdk. you can learn how to get mac, linux, and windows versions of the gecko sdk by reading the article gecko sdk. for code outside the tree note: on windows if you download the gecko sdk without the whole build tree, you will be missing some required dlls for xpidl.exe and it will run with no errors but not do anything. to fix this download the mozilla build tools for windows and copy the dlls from windows\bin\x86 within the zip into the bin directory of the gecko sdk. note: the mac version of the sdk provided for download is powerpc-only. if you need an intel version, you'll need to compile it yourself as described on that page. execute this command to c...
... windows and copy the dlls from windows\bin\x86 within the zip into the bin directory of the gecko sdk. note: the mac version of the sdk provided for download is powerpc-only. if you need an intel version, you'll need to compile it yourself as described on that page. execute this command to compile the typelib. here, {sdk_dir} is the directory in which you unpacked the gecko sdk. {sdk_dir}/bin/xpidl -m typelib -w -v -i {sdk_dir}/idl -e helloworld.xpt helloworld.idl note: on windows you must use forward slashes for the include path. note: (the -i flag is an uppercase i, not a lowercase l.) this will create the typelib file helloworld.xpt in the current working directory. for a new component in firefox/thunderbird/b2g if you are adding a new feature to applications in the mozilla-central...
...And 3 more matches
Gecko SDK
be accessed from xul using javascript. note that in order to develop such components, you do not need the full sources of e.g. firefox, since you do not access parts of the front end from within a component. furthermore, since a component contains basic functionality, it is intended to run with every product of the mozilla platform. therefore it makes no sense to use a particular product to build general functionality. that's the reason why the gecko sdk was devised. do not confuse the gecko/xulrunner sdk with xulrunner itself. ...
...unner itself. the gecko sdk is a collection of header files and tools used to develop general xpcom components which add functionality to the existing platform, whereas xulrunner is a framework which can be used to run standalone or embedded applications based on the mozilla framework. the gecko sdk contains all of the necessary tools and headers for making scriptable npapi plugins including the xpidl compiler/linker and the latest npapi.h. get the sdk updates there is no need to download or rebuild the gecko sdk corresponding to security updates of mozilla (e.g., mozilla 1.7.3) since the headers and glue libs in the gecko sdk are usually not changed as a result of security updates. you do have to get and distribute the newest gecko components (gklayout.dll etc.), though. downloading for ...
...download download download download download the sdk is not officially released for other platforms; if you need it, you will probably need to build it yourself. note: you can subscribe to a calendar of the firefox release schedule. also, you can view the schedule on the web. unpack the sdk tarball to some suitable location. ...
...And 2 more matches
An Overview of XPCOM
isupports interface is that you can support other interfaces as they are introduced. as we'll show when we discuss nsiclassinfo, some factories support querying information about the underlying implementation, such as what language the object is written in, interfaces that the object supports, etc. this kind of "future-proofing" is a key advantage that comes along with deriving from nsisupports. ...
...oofing" is a key advantage that comes along with deriving from nsisupports. xpidl and type libraries an easy and powerful way to define an interface - indeed, a requirement for defining interfaces in a cross-platform, language neutral development environment - is to use an interface definition language (idl). xpcom uses its own variant of the corba omg interface definition language (idl) called xpidl, which allows you to specify methods, attributes and constants of a given interface, and also to define interface inheritance. there are some drawbacks to defining your interface using xpidl. there is no support for multiple inheritance, for one thing. ...
...ion language (idl) called xpidl, which allows you to specify methods, attributes and constants of a given interface, and also to define interface inheritance. there are some drawbacks to defining your interface using xpidl. there is no support for multiple inheritance, for one thing. if you define a new interface, it cannot derive from more than one interface. another limitation of interfaces in xpidl is that method names must be unique. you can not have two methods with the same name that take different parameters, and the workaround - having multiple function names - isn't pretty: void foowithint(in int x); void foowithstring(in string x); void foowithuri(in nsiuri x); however, these shortcomings pale in comparison to the functionality gained by using xpidl. ...
...And 2 more matches
Setting up the Gecko SDK
public idl files exported by the module. the includes directory contains c++ header files used by your component. xpcom exports a number of binaries that should be mentioned at this point. the table below refers to the windows file names for the executables. application name description of functionality regxpcom.exe registers or unregisters components with xpcom xpidl.exe generates typelib and c++ headers from xpidl xpt_dump.exe prints out information about a given typelib xpt_link.exe combines multiple typelibs into a single typelib library name description of functionality xpcomglue.lib xpcom glue library to be used by xpcom components. building a microsoft visual cpp project once you set up t...
...dows\v7.0\lib;c:\program files (x86)\microsoft visual studio 9.0\vc\lib;d:\projects\xulrunner-sdk\lib this tells the linker where the default libraries to bind to are. this allows you to created the component without sending any extra dlls set path=%path%;d:\projects\xulrunner-sdk\sdk\bin;d:\projects\xulrunner-sdk\bin this tells the command prompt where to find the gecko tools, importantly (xpidl, regxpcom, and gmake). building the sample built sample in d:\projects\sample the idl this step is fairly straight forward. first create the idl file. ispecialthing.idl #include "nsisupports.idl" [scriptable, uuid(263ed1ba-5cc1-11db-9673-00e08161165f)] interface ispecialthing : nsisupports { attribute astring name; long add(in long a, in long b); }; next is to build the .h file to ...
...sample the idl this step is fairly straight forward. first create the idl file. ispecialthing.idl #include "nsisupports.idl" [scriptable, uuid(263ed1ba-5cc1-11db-9673-00e08161165f)] interface ispecialthing : nsisupports { attribute astring name; long add(in long a, in long b); }; next is to build the .h file to compile against and the .xpt for gecko to understand your new interface. xpidl -m header ispecialthing.idl xpidl -m typelib ispecialthing.idl the code add the main code, the real work horse. cspecialthing.h #ifndef __specialthing_impl_h__ #define __specialthing_impl_h__ #include "ispecialthing.h" #include "nsstringapi.h" #define specialthing_contractid "@starkravingfinkle.org/specialthing;1" #define specialthing_classname "specialthing" #define specialthing_cid { 0x2...
...And 2 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
de gets loaded more than once into memory, and the code won't be available from javascript or other non-c++ languages) and encourage the use of xpcom wherever possible. the makefile in the public/ directory should follow this model: depth = ../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ vpath = @srcdir@ include $(depth)/config/autoconf.mk module = myextension xpidl_module = myextension xpi_name = myextension exports = \ myheader.h \ $(null) xpidlsrcs = \ myifirstcomponent.idl \ myisecondcomponent.idl \ $(null) include $(topsrcdir)/config/rules.mk xpidl_module is the name of the generated xpt file that contains type information about your idl interfaces. if you have multiple modules, make absolutely sure that you use a different value fo...
...otherwise the first module's xpt file will be overwritten by the second and you'll get ns_error_xpc_bad_iid errors when you try to access its idl interfaces from your code. ...
...idl_module for each one. otherwise the first module's xpt file will be overwritten by the second and you'll get ns_error_xpc_bad_iid errors when you try to access its idl interfaces from your code. the files under exports are copied directly to the /mozilla/$(moz_objdir)/dist/include/ directory and are thus accessible from other modules (the value of moz_objdir is defined in /mozilla/.mozconfig). xpidlsrcs are run through the idl processor, and the generated c++ headers are copied into the same include directory. in addition, an xpt (type library) file is generated and placed in the components/ subdirectory of your extension. source files now it's time to create the makefile and source files in the src/ subdirectory. if you're implementing interfaces that you've described using id...
...le. every makefile that generates anything should define the xpi_name variable to make sure generated files go into your extension and not into the global components/ directory. in fact, just define this in every makefile to be safe. you can use the same module in both base/ and advanced/ so that all the generated include files go into the same directory, but make sure that you don't use the same xpidl_module in the two public/ directories or one of the component type libraries (i.e. xpt files) will overwrite the other one and all hell will break loose. each module must also have a different value for the library_name variable. this is the name of the generated dynamic library, so if we call the libraries "mybase" and "myadvanced", we'll end up with mybase.dll and myadvanced.dll (on wind...
nsAdoptingCString
take the value of what's given, and make what's given forget its value. note that this class violates constness in a few places. ...
... methods constructors void nsadoptingcstring() - source void nsadoptingcstring(char*, pruint32) - source parameters char* str pruint32 length void nsadoptingcstring(const nsadoptingcstring&) - source parameters nsadoptingcstring& str operator= nsadoptingcstring& operator=(const nsadoptingcstring&) - source parameters nsadoptingcs...
...embers no public members. ...
...ods constructors void nsadoptingcstring() - source void nsadoptingcstring(char*, pruint32) - source parameters char* str pruint32 length void nsadoptingcstring(const nsadoptingcstring&) - source parameters nsadoptingcstring& str operator= nsadoptingcstring& operator=(const nsadoptingcstring&) - source parameters nsadoptingcstring& str nsxpidlcstring& operator=(const nsxpidlcstring&) - source parameters nsxpidlcstring& str nscstring& operator=(const nscstring&) - source parameters nscstring& str nsacstring_internal& operator=(char) - source parameters char c nsacstring_internal& operator=(const char*) - source parameters char* data nsacstring_internal& operator=(const nsacstring_internal&) - source parameters nsacstring_internal& str nsa...
nsAdoptingString
take the value of what's given, and make what's given forget its value. note that this class violates constness in a few places. ...
... methods constructors void nsadoptingstring() - source void nsadoptingstring(prunichar*, pruint32) - source parameters prunichar* str pruint32 length void nsadoptingstring(const nsadoptingstring&) - source parameters nsadoptingstring& str operator= nsadoptingstring& operator=(const nsadoptingstring&) - source parameters nsadopting...
...bers no public members. ...
...ds constructors void nsadoptingstring() - source void nsadoptingstring(prunichar*, pruint32) - source parameters prunichar* str pruint32 length void nsadoptingstring(const nsadoptingstring&) - source parameters nsadoptingstring& str operator= nsadoptingstring& operator=(const nsadoptingstring&) - source parameters nsadoptingstring& str nsxpidlstring& operator=(const nsxpidlstring&) - source parameters nsxpidlstring& str nsstring& operator=(const nsstring&) - source parameters nsstring& str nsastring_internal& operator=(prunichar) - source parameters prunichar c nsastring_internal& operator=(const prunichar*) - source parameters prunichar* data nsastring_internal& operator=(const nsastring_internal&) - source parameters nsastring_internal& ...
XPCOM Objects - Archive of obsolete content
rown. passing parameters passing parameters to xpcom methods is no different from other js objects, with some exceptions. in general, you can rely on javascript's ability to transform values to the correct type, but it's usually best to pass the right type in the first place. this section is a quick guide on how to read xpcom documentation, which basically amounts to understanding the syntax of xpidl, the language used to specify xpcom interfaces. at mdc, you'll see stuff like this: void setcharpref(in string aprefname, in string avalue); one of the most important details to notice is that both paratemers have the in keyword. this specifies that these are input parameters, values that the method will use to perform its actions. when is a parameter not an in parameter? in some methods t...
... to long. most pr* types have an easier to read equivalent, so it is better to use those. floating point float boolean boolean, prbool void void timestamps prtime this type is used to pass timestamps measured in milliseconds, such as the output of the gettime() method in a javascript date object. there are more details about xpidl in the xpdil syntax definition. creating your own components javascript xpcom components as we've said before, we recommend using jsm whenever you can. yet there are some cases where you don't have a choice and you have to create xpcom components to add a specific feature. in these cases you can choose between compiled xpcom components, written in c++, or js xpcom components. you should favor ...
...very time the interface changes. in this case you're forced to use uuid, the email address format used for extension ids won't work. we included a constant, an attribute and a method to display examples of the 3, but this is clearly an overly elaborate way to keep a simple counter. you can define numeric and boolean constants in idl files, but not string constants. this is a known limitation of xpidl, and a simple workaround is to define a readonly attribute instead. this means you have to define a getter in the implementation file, though. you can access constants through a reference of the component, or directly from the interface: // these are equivalent. max = ci.xsihellocounter.max_count; max = counterreference.max_count; the implementation file, xshellocounter.js, is much longer. ...
Modularization techniques - Archive of obsolete content
e an id struct you declare them like this: id = {0x221ffe10, 0xae3c, 0x11d1, {0xb6, 0x6c, 0x00, 0x80, 0x5f, 0x8a, 0x26, 0x76}}; why the b66c couplet gets broken up and grouped with the last set of bytes is probably a footnote somewhere. on windows you can use the programs uuidgen and guidgen, which ship with visual c++, to generate ids. a simple example it is recommended that you use xpidl to define your interfaces. this sample code should be updated to reflect this, but it gives you a good basic understanding of com from the c++ perspective. file nsisample.h nsisample.h defines an extremely simple interface and its interface id (iid). the important things to notice are that the interface inherits from nsisupports, and all member functions are pure virtual methods. #include "ns...
...fice. unix support for com is scarce. why not com on windows? because it's not a cross platform solution, and that's what we need. we're going to make every effort to make our interfaces compatible with com on platforms that support it, so it may not matter. but no promises, yet. what are the major differences? instead of microsoft's midl compiler, we are using a corba-compliant idl compiler, xpidl. it outputs nspr types when generating c++ headers. it also generates typelibraries that are not compatible with microsoft's .tlb format. xpcom uses these typelibraries to allow other languages, such as javascript, to implement and call xpcom objects. we also do cross-thread proxying calls using the typelib and nspr's event queues. microsoft provides an extensive support infrastructure for com. ...
...but not most other platforms. the technology can be licensed from microsoft, but for obvious reasons we are not going to be doing that. in house equivalents to the important elements of this technology will be developed as needed. ...
String Quick Reference - Archive of obsolete content
tack-based strings what: use of special stack-oriented classes why: to avoid excess heap allocations and memory leaks wrong: use nsstring/nscstring or raw characters // call getstringvalue(nsastring& out); nsstring value; getstringvalue(value); // call getstringvalue(char** out); char *result; getstringvalue(&result); // don't forget to free result! ...
...ings what: use of special stack-oriented classes why: to avoid excess heap allocations and memory leaks wrong: use nsstring/nscstring or raw characters // call getstringvalue(nsastring& out); nsstring value; getstringvalue(value); // call getstringvalue(char** out); char *result; getstringvalue(&result); // don't forget to free result! ...
... ...
2006-10-06 - Archive of obsolete content
summary: mozilla.dev.builds - september 30th to october 6th 2006 tb mozilla_1_8_branch build problem on mac os x (10.4.7, universal build) ludwig hügelschäfer stated that he has been encountering an error when he executes a "make export" operation on thunderbird (part of the mozilla_1_8_branch) since september 15th. ../../dist/host/bin/host_xpidl -m header -w -i~mozilla/xpcom/base -i../../dist/idl -o _xpidlgen/nsiconsolelistener ~/mozilla/xpcom/base/nsiconsolelistener.idl gmake[2]: *** [_xpidlgen/nsiconsolelistener.h] bus error gmake[2]: *** deleting file `_xpidlgen/nsiconsolelistener.h' gmake[1]: *** [export] error 2 make: *** [all] error 2:: on octorber 4th ludwig hügelschäfer responded to his original post with the solution to his own problem. he found out th...
...he then was able to successfully build thunderbird. ludwig hügelschäfer response to the posting. ...
...he then was able to successfully build thunderbird. ludwig hügelschäfer response to the posting. ...
Makefile - variables
files. module instructs the build system where to install exported headers. simple_programs suppress_default_rules inhibit processing of makefile tier targets/directory processing will be unordered. tier build order dependencies - subdirectories for make to traverse prior to building current. ...
... simple_programs suppress_default_rules inhibit processing of makefile tier targets/directory processing will be unordered. tier build order dependencies - subdirectories for make to traverse prior to building current. xpidl_module module name to use when generating .xpt files, default to module. xpidlsrcs internal: a list of .idl files to generate exported headers from. ...
...ng of makefile tier targets/directory processing will be unordered. tier build order dependencies - subdirectories for make to traverse prior to building current. xpidl_module module name to use when generating .xpt files, default to module. xpidlsrcs internal: a list of .idl files to generate exported headers from. xpidl_name name of extension to build see also configure.sh variables description build_project_arg command line/environment override configure_env_args command line/environment override directory variable dirs a list of subdirectories to build recursively. ...
Installing headers using EXPORTS
public headers and idl files are copied during the export phase of the build. this is accomplished by setting make variables telling the build system which module the headers are for (since headers are organized by module under <tt>dist/include</tt>), and which headers need to be created from idl files by xpidl. for all <tt>makefile.in</tt>s which export public headers, you should set module to the module name where the files should be copied to in <tt>dist/include</tt>. for normal headers that are to be exported, you should set exports to the list of headers to be exported. they will be copied to <tt>dist/include/$(module)</tt>. for xpidl-generated headers, you should set xpidlsrcs to the list of idl files to export. these idl files will be copied to <tt>dist/idl</tt>, and the gen...
...include</tt>. for normal headers that are to be exported, you should set exports to the list of headers to be exported. they will be copied to <tt>dist/include/$(module)</tt>. for xpidl-generated headers, you should set xpidlsrcs to the list of idl files to export. these idl files will be copied to <tt>dist/idl</tt>, and the generated headers will be copied to <tt>dist/include/$(module)</tt>. for xpidl-generated headers, you may also set xpidl_module to determine which typelib file is produced from the idl files. the distinction between xpidl_module and module is that each directory with idl files must have a unique typelib file, but several directories may export headers to the same location. here is an example <tt>makefile.in</tt> which has both c++ and idl headers: module = content xpid...
... the idl files. the distinction between xpidl_module and module is that each directory with idl files must have a unique typelib file, but several directories may export headers to the same location. ...
Using XPCOM Utilities to Make Things Easier
you, so you don't need to do something like this: ns_impl_isupports2(classname, interface1, nsisupports) take a close look at the above example. note that it uses the actual name of the interface and not an iid. inside the macro, the interface name expands to ns_get_iid(), which is another macro that extracts the iid from the generated header of the interface. when an interface is written in xpidl, the headers include static declarations of their iids. on any interface that is generated by xpidl, you can call ns_get_iid() to obtain the iid which is associated with that interface. // returns a reference to a shared nsiid object\ static const nsiid iid1 = ns_get_iid(nsisupports); // constructs a new nsiid object static const nsiid iid2 = ns_isupports_iid; in order to use ns_impl_isupport...
...os ns_decl_nsisupports declares addref, release, and queryinterface for you, and it also defines the mrefcnt required by ns_impl_isupports. furthermore, ns_decl_ appended with any interface name in all caps will declare all of the methods of that interface for you. for example, ns_decl_nsifoo will declare all of the methods of nsifoo provided that it exists and that nsifoo.h was generated by the xpidl compiler. consider the following real class: class myenumerator : public nsisimpleenumerator { public: ns_decl_isupports ns_decl_nsisimpleenumerator myenumerator(); virtual ~myenumerator() {} }; the declaration of this nsisimpleenumerator class doesn't include any methods other than the contructor and destructor. instead, the class uses the ns_decl_ macro[nsisupports-warning...
...common xpcom macros ns_impl_isupportsn implements nsisupports for a given class with n number of interfaces ns_decl_isupports declares methods of nsisupports including mrefcnt ns_init_isupports initializes mrefcnt to zero. must be called in class's constructor ns_get_iid returns the iid given the name of an interface. interface must be generated by xpidl using the macros described here, the code for the weblock component has gone from around 340 lines of code to just under 40. clearly from a code maintenance point of view, this kind of reduction is outstanding. the entire source file with these macros included appears in weblock2.cpp. weblock2.cpp the listing below shows the generic module code from weblock1.cpp using the macros describe...
Creating XPCOM components
with mozilla - prompts a discussion of the relationship between components and modules, of xpcom interfaces, and of the registration process in general. note: in general, you should try to avoid having to create xpcom components. add-ons should try to use the new add-on sdk as much as possible; however, there may be cases when it's unavoidable. ...
... method that uses xpidl but you should use webidl instead. ...
...mmon implementation macros declaration macros weblock2.cpp string classes in xpcom using strings nsembedstring and nsembedcstring smart pointers starting weblock getting called at startup registering for notifications getting access to the category manager providing access to weblock creating the weblock programming interface defining the weblock interface in xpidl the xpidl syntax scriptable interfaces subclassing nsisupports the web locking interface implementing weblock declaration macros representing return values in xpcom xpidl code generation getting the weblock service from a client implementing the iweblock interface the directory service modifying paths with nsifile manipulating files with nsifile using nsilocalfi...
How to build a binary XPCOM component using Visual Studio
he tutorial assumes the folder is called xulrunner-1.8.0.4, but you can call yours whatever you want. you also need a couple of pre-built libraries (glib-1.2.dll & libidl-0.6.dll) from the wintools.zip archive. copy glib-1.2.dll & libidl-0.6.dll into the bin subfolder of gecko-sdk. note: wintools.zip seems old and lots of newer mdc documentation refers to moztools.zip archive, but the version of xpidl.exe that comes with the gecko-sdk crashes with the dll’s from moztools. recap: use the right gecko sdk for your xulrunner release use a microsoft compiler use pre-built glib-1.2.dll & libidl-0.6.dll libraries from wintools.zip download the sample project here is what the folder structure looks like: create a vc++ project visual studio project and file templates (or wizards) for creati...
...dll project. then make the following tweaks: add "..\gecko-sdk\include" to additional include directories add "..\gecko-sdk\lib" to additional library directories add "nspr4.lib xpcom.lib xpcomglue_s.lib" to additional dependencies add "xp_win;xp_win32″ to preprocessor definitions turn off precompiled headers (just to keep it simple) use a custom build step for the xpcom idl file (spawns xpidl-build.bat to process the idl with mozilla toolset, not midl) vc++ express project: xpcom-test.zip note: the project uses xpcom_glue. it also uses frozen linkage (dependent on xpcom). i am not defining xpcom_glue and i am linking against xpcomglue_s.lib create an xpcom component a full tutorial of xpcom is beyond the scope of this posting. check out the resources at the end of the tutorial for...
...8161165f)] interface ispecialthing : nsisupports { attribute astring name; long add(in long a, in long b); }; remember to generate your own guid. the next step is to compile the idl into a type-library (*.xpt) and a c++ header file (*.h), which we can use to define our implementation object. the blank vc++ project has a bat file that will create the xpt and the h files. the command executes xpidl.exe twice, like this: {path_to_geckosdk}\bin\xpidl.exe -m header -i..\gecko-sdk\idl {your_idl_file} {path_to_geckosdk}\bin\xpidl.exe -m typelib -i..\gecko-sdk\idl {your_idl_file} the generated h file actually has a skeleton implementation (commented out). you can take the code and create implementation h and cpp files. they could look like this: h file: #ifndef __specialthing_impl_h__ #define ...
Setting Up a Development Environment - Archive of obsolete content
can skip this section and keep it present as a reference in case you do need to use xpcom in your project. xpcom interfaces are defined using idl files. these are text files that define the attributes and methods in one or more interfaces. these idl files are compiled into binary form and included in the extension as xpt files. to compile an idl file to xpt, you need a command line tool called xpidl. ...
...d line tool called xpidl. this tool is included in the mozilla gecko sdk. if you need to compile idls, go to the sdk page and download a compiled version for your system. also note any prerequisites you may need. if your system is not listed in the supported builds, you'll have to build the sdk yourself from the mozilla source. good luck with that. you should also set up your environment so that xpidl.exe (or just xpidl on other systems) is in the default executable path, and also add a variable called gecko_sdk, that points to your sdk build: export gecko_sdk=/path/to/your/sdk our build system should pick it up from there. to make it work in komodo in unix-based systems, we add the command to the .bash_login file in the home directory, and we modify the commands to this: bash -c ". ~...
Source code directories overview - Archive of obsolete content
d idl directories. thus, the scheme is recursive; it can apply to submodules, sub-submodules and so on. base contains the basic (core) functionality for the module. base contains all the source code that cannot be categorized into a submodule. build contains any special makefiles for building the particular module. doc contains any documentation associated with this module. idl contains the xpidl (cross platform interface definition language) interface files. interfaces are used so functionality can be available to both javascript scripts and c code with as little effort as possible. xpidl files have their own mini-language and processing tools. public contains source code that will be exported to the dist/include directory. they are not all necessarily public in the general sense; some ...
... src contains the bulk of the source code. tests contains c harnesses, html or xul that exercise this module. tools contains scripts for automatically generating certain source code and other special tools for building this module. ...
A XUL Bestiary - Archive of obsolete content
the application object model in the hierarchy of xul widgets: browser, menu, menuitem, and so on. the dom and the aom form a kind of continuum, the whole of which is manipulable from the standards upon which xul is based. near synonyms for xul there is much confusion about the words that begin with "x" in the mozilla open source project. the mozilla xparchitecture section below describes xpcom, xpidl, and xpconnect, three somewhat related technologies for getting access to application code from the interface. this section describes xul, xptoolkit, and xpfe, which are in some respects synonymous and in others quite different. in briefest terms, xul is the xml-based language used for creating interfaces, xptoolkit is the set of xul widgets (menus, toolbar, etc.) actually assembed for this purp...
...hat provides for a truly cross-platform component object model, whence the technology gets its name. based on com, xpcom insists that chunks of code provide language- and platform-neutral interfaces that other objects can use to access its services. xpcom enforces rules for design and compilation that make it possible to use the services of an object without knowing anything about implementation. xpidl, the cross-platform interface definition language, is a language in which these interfaces insisted upon by xpcom can be described. when xpidl is used to describe the xpcom interfaces, it makes those interfaces available in special header files. finally, xpconnect is the technology that connects these xpcom/xpidl interfaces to javascript, the scripting language xul uses. these three cross-platfor...
Resources
this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this documen...
...this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this document is pr...
Mozilla technologies
h to javascript and c++/xpcom users. the xml extras module is built by default on all platforms, and is included in the browser installers so it is available in the nightly builds.xpcomxpcom is a cross platform component object model, similar to microsoft com. ...
...javascript and c++/xpcom users. the xml extras module is built by default on all platforms, and is included in the browser installers so it is available in the nightly builds.xpcomxpcom is a cross platform component object model, similar to microsoft com. ...
Finding window handles - Archive of obsolete content
javascript. comparing to the method above, by using this method, you don't have to compile your component with nsiwidget.h and other bunchs of h files that should not be exposed to outside, and could change every time firefox updates, all you need is nsibasewindow.idl(it's not in gecko_sdk, get this from the latest firefox source, or http://mxr.mozilla.org/mozilla/sourc...basewindow.idl), and use xpidl to compile it to .h file, although that's stll a unfrozen interface, but it should be a lot better. notice that by using only the c++ part of this code will get the the parent window handle of the nsibasewindow you give as a param. that means if you use the top level nsibasewindow as a param, null will be returned in the chain and cause crash of firefox, that's a bug of firefox.(https://bugzilla...
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
shouldn't be: nsstringfwd.h(60) : fatal error c1001: internal compiler error to debug this error, make in the failing directory, adding the /showincludes directive to figure out what is being included incorrectly: make -c directory/that/failed os_cppflags=-showincludes the frozen string api is similar but not identical to the nonfrozen string api. the frozen string api does not have (or need) nsxpidlstring: - nsxpidlstring value; + nsstring value; ptr->gettermethod(getter_copies(value)); - const prunichar *strvalue = value; + // nsstring doesn't cast directly to prunichar*, use .get()+ const prunichar *strvalue = value.get(); the frozen string api doesn't accept a length for .truncate(). use .setlength() instead: nsstring mystring = somestring; - mystring.truncate(4); + mystring.setleng...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
sions as well. sometimes an extension will be packaged with a special xpcom component developed specifically for it. note: if you're developing components in c++ or other compiled languages, be sure to include binaries for every platform. reference materials to get an idea of what kinds of functions embedded xpcom can handle, take a look at the api reference and the interface definitions from xpidl in the actual source code. note: interface definition language (idl) is a language for giving standard definitions of objects, methods, and so forth. the xpidl (cross-platform idl) used by mozilla is a partial extension to the corba idl. you can perform a full-text search of the firefox source code in mozilla cross-reference using character strings, filenames, etc as search keys. if you’re h...
Mozilla Application Framework in Detail - Archive of obsolete content
ifferent platforms can make your application development faster, more productive, and easier to maintain. the networking library, for example, is a set of xpcom components that can be accessed and used by any mozilla application. file i/o, security, password management, and profiles are also separate xpcom components that you can use in your own application development. other features of xpcom: xpidl, a language for defining interfaces in a language-neutral way and the xpidl compiler can create header files, binary type libraries, documentation, and even generate stub c++ code for your component implementations. tools including various xpcom manager interfaces, smart pointers, special string classes, and an extensive collection of macros that make your c++ implementations easy to write and ex...
2006-09-22 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - sept 22-29, 2006 announcements none during this week. discussions java vs. xpcom discussion of the limitation and merits of java in place of xpcom. xpidl.exe crashes on windows problem with creating header files from idl's in 1.8 branch due to wrong compiler. meetings none during this week. ...
2006-11-17 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - nov 11-nov 17, 2006 announcements none during this week. discussions xpidl crashes imycomp.h problems: "xpidl.exe has encountered a problem and needs to close" meetings none during this week. ...
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
ms devstudio midl must not be used. (let's assume 'testplugin' as a plugin name-place holder.) compile nsitestplugin.idl with the idl compiler. this will generate nsitestplugin.h and nsitestplugin.xpt files. put nsitestplugin.xpt to the components folder. build nptestplugin.dll with nsitestplugin.h included for compiling scriptable instance class implementaion. put nptestplugin.dll to the p...
A bird's-eye view of the Mozilla framework
ine extending from an object and terminated by an open circle indicates an interface to the object. the client object does not need to know anything about the internal structure or implementation of the provider object in order to take advantage of its services. the client simply queries the provider for a particular service, and if available, accesses that service through an interface defined in xpidl (cross-platform idl), derived from the corba idl. the xpidl interface description is independent of the programming language used to implement the object itself. for example, a javascript object or c++ class could both implement the same xpidl interface. scripting languages such as javascript cannot directly access xpcom components, but access them indirectly using xpconnect. xpconnect also prov...
Chrome registration
nents/mycomponent.dll [flags] instructs mozilla to register and use a binary component. it should be combined with the abi flag, since binary components are abi-specific. prior to firefox 4, files in the components directory were registered automatically. interfaces interfaces component/mycomponent.xpt [flags] instructs mozilla to load interface information from a typelib file produced by xpidl. prior to firefox 4, files in the components directory were registered automatically. component component {00000000-0000-0000-0000-000000000000} components/mycomponent.js [flags] informs mozilla about a component cid implemented by an xpcom component implemented in javascript (or another scripting language, if applicable). the classid {0000...} must match the classid implemented by the comp...
How Mozilla's build system works
t character on a line allows the variable definition to be continued on the next line. the extra whitespace is compressed. the terminating $(null) is a method for consistency; it allows you to add and remove lines without worrying about whether the last line has an ending backslash or not. ...
Interface development guide
idl interface rules design guidelines and rules when creating and changing xpcom interfaces. ...
Embedding Tips
watch) { wwatch->setwindowcreator(mywindowcreator); } i need the javascript inside the browser window to talk to my embedding client. how do i do it? at startup use the category manager to register properties of the global object in javascript like this: nscomptr<nsicategorymanager> catman = do_getservice(ns_categorymanager_contractid); if (!catman) return ns_error_failure; nsxpidlcstring previous; catman->addcategoryentry(javascript_global_property_category, "my_prop_name", "my_prop_contract_id", pr_true, pr_true, getter_copies(previous)); this will cause a component with the contract id my_prop_contract_id to be lazily created when the my_prop_name is resolved in any javascript window scope. if you want to create your...
Mozilla DOM Hacking Guide
a string that can be passed to sethref() rv = location->sethref(href); ns_ensure_success(rv, rv); // after this, we effectively mapped .location to .location.href return wrapnative(cx, obj, location, ns_get_iid(nsidomlocation), vp); // create a wrapper for the location object with vp (the url) as value. } it's that simple. and the possibilities are endless. resources of interest the xpidl reference mapping dom objects to their c++ class modularization techniques scriptable helper flags this chapter has not been written yet. if you want to help please contact me! security features implementation this chapter has not been written yet. if you want to help please contact me! original document information author(s): fabian guisset last updated date: september 27, 2007 cop...
Creating a Python XPCOM component
attention to types here - python and javascript are both loosely-typed, so it's fairly easy to pass information from one to the other. note: there are exceptions; see this discussion for information on the use of string and wstring for unicode transfer. see here for info on describing interfaces, and on which types can be used. registering the interface in the "components" directory, execute : ../xpidl -m typelib -w -v -i /usr/share/idl/mozilla/ nsipysimple.idl on windows you must point to the idl directory as part of your mozilla build. for example: xpidl.exe -m typelib -w -v -i c:\source\mozilla\obj-i686-pc-mingw32\dist\idl foo.idl xpidl will then create nsipysimple.xpt, which should be placed correctly (e.g., in the 'components' directory). implementing the component unlike c++, pyxpcom do...
Component Internals
rray or another publicly available class instead of writing your own linked list, but this may prove to be a fatal mistake. the class can change at any time and give you unexpected behavior. xpcom makes for a very open environment. at runtime you can acquire any service or component by merely knowing a cid or contract id along with an iid. at last count there were over 1300 interfaces defined in xpidl. of those 1300 interfaces, less than 100 were frozen, which means that a developer is likely to stumble upon useful interfaces that aren't frozen. unless an interface is explicitly marked "frozen" in the idl comments, your component may possibly break or crash along with a version change. the glue library in general, you should avoid any interfaces, symbols in xpcom, or other part of gecko libr...
Finishing the Component
simply create a new directory in the gecko sdk named unfrozen. copy the headers and idl files that you need from the content/base/public source directory of the gecko build into this new directory. (for weblock, all you need are the headers for nsicontentpolicy and the nsicontentpolicy.idl.) then, using the same steps you used to create the weblock.h, create a header from this idl file using the xpidl compiler. once you have these interface and header files, you can modify the weblock class to implement the nsicontentpolicy interface. the weblock class will then support four interfaces: nsisupports, nsiobserver, nsicontentpolicy, and iweblock. weblock interfaces interface name defined by status summary nsisupports xpcom frozen provides interface discover...
Preface
om component called weblock, which provides site blocking functionality to gecko-based browsers. each one of these steps has its own chapter, in which a number of topics associated with the step are discussed. create the generic module code for the component. use c++ macros, special string classes and smart pointers to optimize your code. define the functionality for the component; create an xpidl interface for that functionality; create the implementation code specific to the custom weblock component interface. finish implementing the weblock component: nsicontentpolicy, file i/o, locking, etc. creating the user interface for the weblock component. packaging weblock for distribution and installation. following along with the examples there are a couple of different ways to get xpcom...
Using XPCOM Components
cmgr.remove(deletedcookies[c].host, deletedcookies[c].name, deletedcookies[c].path); } deletedcookies.length = 0; } connecting to components from the interface the mozilla user interface uses javascript that has been given access to xpcom components in the application core with a technology called xpconnect. xpconnect allows interface methods defined via xpidl to be called from javascript, as part of javascript objects that represent instances of components like the cookiemanager. xpconnect is what binds the application code to the user interface of the mozilla browser, to other gecko-based xul, and to javascript environments like xpcshell, which is a command-line javascript interpreter and xpcom tool is built with mozilla. see http://www.mozilla.org...
Mozilla internal string guide
lasses. the major string classes the list below describes the main base classes. once you are familiar with them, see the appendix describing what class to use when. nsastring/nsacstring: the abstract base class for all strings. it provides an api for assignment, individual character access, basic manipulation of characters in the string, and string comparison. this class corresponds to the xpidl astring parameter type. nsastring is not necessarily null-terminated. nsstring/nscstring: builds on nsastring by guaranteeing a null-terminated storage. this allows for a method (.get()) to access the underlying character buffer. the remainder of the string classes inherit from either nsastring or nsstring. thus, every string class is compatible with nsastring. since every string derives from...
Index
Mozilla › Tech › XPCOM › Index
nsstring external needscontent, reference, référence(2), strings class declaration 1225 nsstringcontainer (external) needscontent, reference, référence(2), strings class declaration 1226 nssupportsweakreference xpcom, xpcom api reference inherit from this c++ class to add canonical support for nsisupportsweakreference. 1227 nsxpidlcstring class declaration 1228 nsxpidlstring class declaration 1229 xpcom primitive xpcom, xpcom api reference an xpcom primitive is an xpcom object that "boxes" a value of a primitive type. all xpcom primitives are scriptable, and they all implement an xpcom interface from the table below. 1230 xpcom string functions landing, mo...
Components.interfaces
umerated using a for...in loop. usage accessing an interface object properties of the components.interfaces object are indexed by interface name. you can retrieve an interface object using: var iface = components.interfaces.nsisupportsarray; this will return you the interface object for the nsisupportsarray interface. accessing constants defined in an interface interface descriptions (cf. xpidl) may not only contain method declarations, but also constants. for example, assume we have the following interface declaration: interface nsifoo : nsisupports { const pruint32 myflag = 5; }; the constant myflag can then be accessed using var myflag = components.interfaces.nsifoo.myflag; ...
Other Resources
other resources embedding mozilla xpconnect - javascript-xpcom bridge blackconnect - java-xpcom bridge (no longer supported) xpidl to java types - from blackconnect ...
JavaXPCOM
javaxpcom allows for communication between java and xpcom, such that a java application can access xpcom objects, and xpcom can access any java class that implements an xpcom interface. javaxpcom is not actively maintained. with javaxpcom, a developer can talk to xpcom or embed gecko from a java application. javaxpcom is very similar to xpconnect (javascript-xpcom bridge), and uses xpidl. note: javaxpcom was included in xulrunner up through version 1.9.2. it has been removed in xulrunner 2, and is not actively maintained. documentation javaxpcom development how to get and build the source, as well as how to view and report bugs. sample code there are several java test applications checked in to the tree that give examp...
XPConnect
and xpcom. with xpconnect, you can use xpcom components from javascript code, and interact with javascript objects from within xpcom components. xpconnect is part of firefox and is actively used in xul applications. documentation architecture basics xpconnect, javascript, xpcom, xul... using components how to talk with xpcom components. xpconnect and xpidl faq a faq about using xpconnect and xpidl. this page needs to migrate to mdn. wrappers what sorts of wrappers xpconnect generates and uses xpconnect security membranes tools xpcshell join the xpcom community choose your preferred method for joining the discussion: mailing list ne...
nsACString
section of the string's internal buffer. operators operator= this operator is a shortcut for the assign family of functions. operator+= this operator is a shortcut for the append family of functions. remarks the nsacstring class is never instantiated directly. it should be instantiated using a subclass, such as nsembedcstring. nsacstring corresponds to the acstring and autf8string xpidl data types. nsacstring by itself does not imply a particular character encoding. that is, it may be used to store utf-8 characters, ascii characters, or any random binary data. the character encoding in use for a particular nsacstring instance depends on the context in which it is used. if used with xpidl, then the character encodings of the corresponding xpidl data types applies. nsacstring may...
nsACString_internal
org/en/nscstring" shape="rect" title="nscstring"> <area alt="" coords="521,101,689,149" href="http://developer.mozilla.org/en/nsdependentcsubstring" shape="rect" title="nsdependentcsubstring"> <area alt="" coords="172,197,289,245" href="http://developer.mozilla.org/en/nsfixedcstring" shape="rect" title="nsfixedcstring"> <area alt="" coords="315,197,437,245" href="http://developer.mozilla.org/en/nsxpidlcstring" shape="rect" title="nsxpidlcstring"> <area alt="" coords="461,197,611,245" href="http://developer.mozilla.org/en/nsdependentcstring" shape="rect" title="nsdependentcstring"> <area alt="" coords="635,197,787,245" href="http://developer.mozilla.org/en/nspromiseflatcstring" shape="rect" title="nspromiseflatcstring"> <area alt="" coords="173,293,285,341" href="http://developer.mozilla.org/en/...
nsAString
a section of the string's internal buffer. operators operator= this operator is a shortcut for the assign family of functions. operator+= this operator is a shortcut for the append family of functions. remarks the nsastring class is never instantiated directly. it should be instantiated using a subclass, such as nsembedstring . nsastring corresponds to the astring and domstring xpidl data types. nsastring by itself does not imply a particular character encoding. that is, it may be used to store utf-16 characters, ucs-2 characters, or any random double-byte data. the character encoding in use for a particular nsastring instance depends on the context in which it is used. if used with xpidl, then the character encodings of the corresponding xpidl data types applies. nsastring m...
nsAString_internal
zilla.org/en/nsstring" shape="rect" title="nsstring"> <area alt="" coords="475,101,635,149" href="http://developer.mozilla.org/en/nsdependentsubstring" shape="rect" title="nsdependentsubstring"> <area alt="" coords="151,197,257,245" href="http://developer.mozilla.org/en/nsfixedstring" shape="rect" title="nsfixedstring"> <area alt="" coords="284,197,396,245" href="http://developer.mozilla.org/en/nsxpidlstring" shape="rect" title="nsxpidlstring"> <area alt="" coords="420,197,559,245" href="http://developer.mozilla.org/en/nsdependentstring" shape="rect" title="nsdependentstring"> <area alt="" coords="583,197,727,245" href="http://developer.mozilla.org/en/nspromiseflatstring" shape="rect" title="nspromiseflatstring"> <area alt="" coords="152,293,253,341" href="http://developer.mozilla.org/en/nsauto...
XPCOM glue classes
e functions addref() and release(), which respectively modify a variable of type nsautorefcnt, which basically is a wrapper around a count of the number of references refering to the class.nsstringclass declarationnsstring externalclass declarationnsstringcontainer (external)class declarationnssupportsweakreferenceinherit from this c++ class to add canonical support for nsisupportsweakreference.nsxpidlcstringclass declarationnsxpidlstringclass declarationpromiseflatcstring (external)class declarationpromiseflatstring (external)class declaration ...
imgIContainer
olete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the rectangle defining the location and size of the currently displayed frame. should be an attribute, but cannot be because of reference/pointer conflicts with native types in xpidl. void getcurrentframerect( in nsintrect aframerect ); parameters aframerect missing description exceptions thrown missing exception missing description native code only!getframe get a surface for the given frame. this may be a platform-native, optimized surface, so you cannot inspect its pixel data. gfxasurface getframe( in pruint32 awhichframe, in pruint32 aflags ); ...
nsIPushMessage
parameters none. binary() extracts the message data as a byte array. void binary( [optional] out uint32_t datalen, [array, retval, size_is(datalen)] out uint8_t data ); parameters datalen the data size. data the byte array containing the data. datalen and data are out parameters. when called from javascript, nsipushmessage.binary() returns data. please see method parameters in xpidl for more details on using out parameters in javascript. see also nsipushservice nsipushsubscription pushmessagedata ...
nsIPushSubscription
[optional] out uint32_t keylen, [array, size_is(keylen), retval] out uint8_t key ); parameters name the encryption key name. keylen the keying material length. key the byte array containing the keying material. keylen and key are out parameters. when called from javascript, nsipushsubscription.getkey() only takes name as a parameter, and returns key. please see method parameters in xpidl for more details on using out parameters in javascript. quotaapplies() indicates whether this subscription is subject to the background message quota. bool quotaapplies(); nsipushsubscription.quotaapplies() always returns false for system subscriptions. parameters none. isexpired() indicates whether this subscription has expired and must be renewed. a subscription expires if its servi...
Weak reference
erface you actually care about, e.g., // note: _not_ the implementation we have... nsweakptr<nsifoo> weakfooptr = fooptr; // ... if ( weakfooptr ) status = weakfooptr->somefoomethod(...); this is a reasonable thing to want. it's expensive to implement automatically, however. neither inheritance, nor templates, nor macros can help automatically forward all the method calls to the real object. xpidl could write an implementation for you (if we modified it), or you could write one by hand as i discuss below. there are other, mostly negligible, costs: it's an extra indirection per call, and the easy implementation requires adding an extra pointer per interface to the target implementation. why can't i just queryinterface between the pair? it really feels like the nsiweakreference that you ar...
wrappedJSObject
h are used to protect the chrome code working with content objects. see xpcnativewrapper for detailed documentation. regular xpconnect wrappers which you can encounter, for example, when using xpcom components implemented in js. this article focuses on the latter kind of wrappers, which hide any properties or methods on the component that are not part of the supported interfaces as declared in xpidl. the rest of this article demonstrates what xpconnect wrappers do and how wrappedjsobject can be used to bypass them. example component to see how the wrappedjsobject property works, we need an example xpcom component implemented in js. see how to build an xpcom component in javascript for details on creating one. for simplicity we omit the component registration code. suppose we register the...
XPCOM
xpcom itself provides a set of core components and classes, e.g. file and memory management, threads, basic data structures (strings, arrays, variants), etc. ...
WebIDL bindings
ceptions from setsomenumber, say. acallback.setsomenumber(2*number, rv, erethrowexceptions); if (rv.failed()) { // the exception is now stored on rv. this code must report // it usefully; otherwise it will assert. } } external interfaces external interfaces are represented in c++ as objects that xpconnect knows how to unwrap to. this can mean xpcom interfaces (whether declared in xpidl or not) or it can mean some type that there's a castable native unwrapping function for. the c++ type to be used should be the nativetype listed for the external interface in the bindings.conf file. the exact representation depends on how the type is being used. arguments become nsifoo*. return values can be already_addrefed<nsifoo> or nsifoo* as desired. the pointer form is preferred because...