Search completed in 1.18 seconds.
639 results for "XPCOM":
Your results are loading. Please wait...
An Overview of XPCOM
« previousnext » this is a book about xpcom.
... the book is presented as a tutorial about creating xpcom components, but it covers all major aspects, concepts, and terminology of the xpcom component model along the way.
... this chapter provides a quick tour of xpcom - an introduction to the basic concepts and technologies in xpcom and component development.
...And 49 more matches
Using XPCOM Components
« previousnext » one of the best ways to begin working with xpcom - especially when you are designing the interface to a component that will be used by others, as we do in starting weblock - is to look at how clients are already using xpcom components.
... applications like the mozilla browser are sophisticated, modularized clients of xpcom components.
... in fact, virtually all of the functionality that you associate with a browser - navigation, window management, managing cookies, bookmarks, security, searching, rendering, and other features - is defined in xpcom components and accessed by means of those component interfaces.
...And 38 more matches
XPCOM
xpcom is a cross platform component object model, similar to microsoft com.
... it has multiple language bindings, allowing xpcom components to be used and implemented in javascript, java, and python in addition to c++.
... interfaces in xpcom are defined in a dialect of idl called xpidl.
...And 31 more matches
platform/xpcom - Archive of obsolete content
implement xpcom objects, factories, and services.
... usage the xpcom module makes it simpler to perform three main tasks: implement xpcom object interfaces implement and register xpcom factories implement and register xpcom services if all you need to do is use xpcom objects that someone else has implemented, then you don't need to use this module.
... you can just use require("chrome") to get direct access to the components object, and access xpcom objects from there.
...And 28 more matches
XPCOM Objects - Archive of obsolete content
« previousnext » xpcom xpcom is a cross platform component object model, similar to microsoft com.
... taken from the xpcom page.
... xpcom is the way in which the two layers (xulrunner and chrome) communicate.
...And 21 more matches
XPCOM glue
MozillaTechXPCOMGlue
the xpcom glue is a static library which component developers and embedders can link against.
... it allows developers to link only against the frozen xpcom method symbols and maintain compatibility with multiple versions of xpcom.
... compiling or linking against xpcom headers there are three ways to compile/link against xpcom headers/libraries: frozen linkage: dependent glue (dependent on xpcom.dll) xpcom modules, i.e.
...And 20 more matches
How to build an XPCOM component in JavaScript
if you are looking for add-on sdk solution for xpcom javascript components then check out platform/xpcom module first.
... this is a "hello world" tutorial for creating an xpcom component in javascript.
... this tutorial does not describe how and why xpcom works the way it does, or what every bit of the example code does.
...And 19 more matches
Using XPCOM Utilities to Make Things Easier
« previousnext » this chapter goes back over the code you've already created in the first part of the tutorial (see weblock1.cpp in the previous chapter) and uses xpcom tools that make coding a lot easier and more efficient.
... it also introduces a basic string type that is used with many of the apis in both xpcom and gecko.
... xpcom macros the xpcom framework includes a number of macros for making c++ development easier.
...And 17 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
this chapter explains how to use xpcom to implement advanced processes using only javascript.
...internet explorer handles this using activex; in firefox, we use the cross-platform component object model, or xpcom.
... about xpcom xpcom is a framework for developing platform-independent components.
...And 15 more matches
XPCOM changes in Gecko 2.0
several changes that affect xpcom component compatibility are taking place in gecko 2.
...documentation will be updated as time allows to remove references to interfaces being "frozen" or "unfrozen." component registration the way xpcom components are registered changed in gecko 2.
...if you used xpcomutils.jsm, some of this was hidden from you, but it was still there.
...And 15 more matches
Introduction to XPCOM for the DOM
this document is an introduction to the use of xpcom in the context of the dom code.
... the use of xpcom and nscomptr's described in this document covers about 80% of what you need to know to read the dom code, and even write some.
... for more advanced topics, please see the xpcom page.
...And 14 more matches
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
xulrunner ships with the javaxpcom component, which allows java code to interact with xpcom objects.
... as you will see in this article, working with xpcom objects in java is not that much different than doing so in c++.
...this library provides the interfaces necessary to bootstrap mozilla and call xpcom methods.
...And 12 more matches
XPCOMUtils.jsm
the xpcomutils.jsm javascript code module offers utility routines for javascript components loaded by the javascript component loader.
... to use this, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/xpcomutils.jsm"); using xpcomutils exposing a javascript class as a component using these utility methods requires four key steps: import xpcomutils.jsm, as explained previously.
... mycomponent.prototype = { // properties required for xpcom registration: classdescription: "unique text description", classid: components.id("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"), contractid: "@example.com/xxx;1", // [optional] custom factory (an object implementing nsifactory).
...And 12 more matches
How to build a binary XPCOM component using Visual Studio
this is a simple tutorial for building xpcom objects in c++ using visual studio.
... xpcom is mozilla’s cross platform component object model, similar to microsoft’s com technology.
... xpcom components can be implemented in c, c++, and javascript, and can be used from c, c++, and javascript.
...And 12 more matches
Standalone XPCOM - Archive of obsolete content
standalone xpcom is a tree configuration that builds a minimal set of libraries (shared mostly) that can be used to get all features of xpcom.
... the contents of this standalone xpcom in general are: nspr : mozilla/nsprpub xpcom : mozilla/xpcom note 1: xpcom apis are not frozen yet.
... by xpcom 1.0 release they will be.
...And 11 more matches
XPCOM ABI
xpcom abi is the binary interface of xpcom components.
... while xpcom components written in a scripting language (such as javascript) can be moved across platforms (such as windows and os x) without adaptation, those written in a compiled language (such as c++) require recompilation when moving to a different platform.
... often, compiled xpcom components are called 'binary' or 'native'.
...And 11 more matches
JS XPCOM - Archive of obsolete content
here are a few useful snippets of code for dealing with xpcom components in javascript.
... contract ids a contract id is a unique name for an xpcom object.
... they are used to create or access well-known objects in xpcom.
...And 10 more matches
Creating a Python XPCOM component
here is how to make the same component in python using pyxpcom.
... (note that some details may be missing.) preparation if a binary of pyxpcom is not available, you will need to build it - see building pyxpcom.
... tip: you can achieve a copy of binary of pyxpcom from pythonext; simply unpack xpi and take everything you need.
...And 10 more matches
Avoiding leaks in JavaScript XPCOM components
using xpcom in javascript (also known as xpconnect) is an environment where memory management issues are not obvious.
... programmers writing and reviewing javascript code in mozilla should understand how code using xpcom in javascript can leak so that they can avoid leaks.
... this is the strategy used by xpcom, partly because it can be used through a very simple api, addref and release.
...And 10 more matches
PyXPCOM
pyxpcom allows for communication between python and xpcom, such that a python application can access xpcom objects, and xpcom can access any python class that implements an xpcom interface.
... pyxpcom is actively used in activestate komodo products, for example.
... with pyxpcom, a developer can talk to xpcom or embed gecko from a python application.
...And 10 more matches
NS_InitXPCOM3
« xpcom api reference summary the ns_initxpcom3 function initiates use of xpcom in the calling process with support for statically defined xpcom modules.
... #include "nsxpcom.h" nsresult ns_initxpcom3( nsiservicemanager** aresult, nsifile* abindirectory, nsidirectoryserviceprovider* aappfilelocationprovider, nsstaticmoduleinfo const* astaticmodules, pruint32 astaticmodulecount ); parameters aresult [out] the resulting xpcom service manager.
...the resulting interface pointer is addref'd upon return and must either be release'd explicitly or passed to ns_shutdownxpcom when the application is finished with xpcom.
...And 10 more matches
XPCOM tasks
the role of xpcom the xpcom module roughly parallels the c/c++ standard libraries.
...xpcom sits above the standard libraries.
... its role is to extend them with facilities tailored to xpcom development in general, and specifically the needs of mozilla.
...And 10 more matches
XPCOM reference
this reference describes the interfaces and functions provided by the xpcom library.
... in addition, it details the various helper classes and functions, as well as the components, provided by the xpcom glue library.
... the contents herein are oriented primarily toward extension developers and people embedding xpcom in other projects.
...And 9 more matches
NS_InitXPCOM2
« xpcom api reference summary the ns_initxpcom2 function initiates use of xpcom in the calling process.
... #include "nsxpcom.h" nsresult ns_initxpcom2( nsiservicemanager** aresult, nsifile* abindirectory, nsidirectoryserviceprovider* aappfilelocationprovider ); parameters aresult [out] the resulting xpcom service manager.
...the resulting interface pointer is addref'd upon return and must either be release'd explicitly or passed to ns_shutdownxpcom when the application is finished with xpcom.
...And 8 more matches
XPCOM array guide
MozillaTechXPCOMGuideArrays
the standard array classes are: nsiarray - a scriptable container for scriptable xpcom objects.
... nsimutablearray - a scriptable container for scriptable xpcom objects, which allows addition and removal of member objects.
... ownership nsiarray xpcom object yes no no no reference counted, weak/strong nsimutablearray xpcom object yes no yes no reference counted, weak/strong nscomarray<t> xpcom object no yes yes* no reference counted, strong nstarray<t> any that has a default constructor and copy constructor no yes yes* no can hold objects directly, ...
...And 7 more matches
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.
...And 7 more matches
XPCOM Interfaces - Archive of obsolete content
« previousnext » in this section, we'll take a brief look at xpcom (cross-platform component object model), which is the object system that mozilla uses.
...mozilla provides such a method which involves using xpcom (cross-platform component object model).
... mozilla provides many xpcom components and interfaces.
...And 6 more matches
Creating XPCOM components
next » this guide is about gecko, and about creating xpcom components for gecko-based applications.
... though the emphasis is on the practical steps you take to make your c++ code into a component that can be used in gecko, we hope that these steps will also give us an occasion to discuss all of the tools, techniques, and technologies that make up xpcom.
... accordingly, the book is arranged so that you can follow along and create your own components or learn about different xpcom topics individually, as in a reference work.
...And 6 more matches
Detailed XPCOM hashtable guide
this is the long version of xpcom hashtable guide.
... any type: almost any datatype can be used as key, including strings, integers, xpcom interface pointers, iids, and almost anything else.
...a basic guide is included here, but you should read most of xpcom/glue/pldhash.h if you intend to use pldhash.
...And 4 more matches
XPCOM guide
MozillaTechXPCOMGuide
these articles provide tutorials and usage documentation for xpcom, including how to use it in your own projects and how to build xpcom components for your firefox add-ons and the like.
... avoiding leaks in javascript xpcom componentsprogrammers writing and reviewing javascript code in mozilla should understand how code using xpcom in javascript can leak so that they can avoid leaks.
... this document attempts to help them do so, first by explaining the underlying concepts, and second by describing a number of common javascript patterns that cause leaks.creating xpcom componentsthis guide is about gecko, and about creating xpcom components for gecko-based applications.how to build an xpcom component in javascriptif you are looking for add-on sdk solution for xpcom javascript components then check out platform/xpcom module first.inheriting from implementation classesgiven that idl interfaces map to abstract classes in c++, a common problem when dealing with idl is when you have an idl inheritance hierarchy, and a corresponding c++ implementation hierarchy, you run into multiple inheritance.
...And 4 more matches
XPCOM Glue without mozalloc
starting with xulrunner 2.0, the frozen linkage dependent glue (xpcomglue_s.lib on windows, libxpcomglue_s.a on linux and mac) is dependent on the new infallible memory allocation routines (mozalloc).
... since these routines didn't exist prior to xulrunner 2.0, xpcom components that link against the frozen linkage dependent glue will not be compatible with xulrunner applications prior to 2.0.
... the solution is to link against xpcomglue_s_nomozalloc instead (xpcomglue_s_nomozalloc.lib on windows, libxpcomglue_s_nomozalloc.a on linux and mac).
...And 3 more matches
NS_ShutdownXPCOM
« xpcom api reference summary the ns_shutdownxpcom function terminates use of xpcom in the calling process.
... #include "nsxpcom.h" nsresult ns_shutdownxpcom( nsiservicemanager* asvcmanager ); parameters asvcmanager [in] the nsiservicemanager instance that was returned by ns_initxpcom2 (or ns_initxpcom3) or null.
... return values the ns_shutdownxpcom function returns ns_ok if successful.
...And 3 more matches
Using XPCOM without chrome - Archive of obsolete content
using sdk xpcom with the low-level module sdk/platform/xpcom , it's possible to exclude chrome and xpcomutils in some cases.
... below is an example for the xpcom bookmark observer.
... examples bookmarks observer normally, a bookmark observer would require chrome components and xpcomutils as described in the following links: (observing changes to bookmarks and tags) , (creating event targets).
...And 2 more matches
XPCOM glue classes
these "glue" classes are provided to make it easier to use xpcom from c++ code.
... when these classes are used by a component, you may need to link the component against the xpcom glue library.
...t must be released, typically on destruction of the object.</t>nsautoreftraitsnsautoreftraits<t> is a template class describing traits of resources held by objects of class nsautoref<t> and/or nscountedref<t>.</t>nsautostringclass declarationnsautostring (external)class declarationnscautostringclass declarationnscautostring (external)class declarationnscomptrthis utility class simplifies managing xpcom interface references from c++ code.nscountedrefnscountedref<t> is a template class implementing an object that takes a strong reference to a reference-counted resource that must be released, typically on destruction of the object.</t>nscstringclass declarationnscstring externalclass declarationnscstringcontainer (external)class declaration nscstringencodingthe nscstringencoding enumeration de...
...And 2 more matches
Using LDAP XPCOM with XULRunner - Archive of obsolete content
by default, xulrunner is built without ldap xpcom support.
... if you want to use ldap components in your xul application, you have two options : compile xulrunner with ldap support enabled, or add ldap xpcom directly to your xul app (in the components directory).
... in any case, you will have to build ldap xpcom, by adding --enable-ldap build option.
...srcdir = @srcdir@ topsrcdir = @top_srcdir@ vpath = @srcdir@ include $(depth)/config/autoconf.mk module = mozldapstub library_name = mozldap_stub is_component = 1 force_shared_lib = 1 requires = \ xpcom \ string \ $(null) cppsrcs = ldapstubloader.cpp extra_dso_ldopts += \ $(dist)/lib/$(lib_prefix)xpcomglue_s.$(lib_suffix) \ $(xpcom_frozen_ldopts) \ $(nspr_libs) \ $(null) include $(topsrcdir)/config/rules.mk defines += -dmoz_dll_prefix=\"$(dll_prefix)\" ldapstubloader.cpp: // copyright (c) 2005 benjamin smedberg <benjamin@smedbergs.us> #include "nscore.h" #include "nsmodule.h" ...
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
the new mozilla xpcom architecture allows xpcom components be scriptable via a different mechanism called xpconnect.
...ml code will do the job:</p> this should be changed, we shouldn't advocate embed <embed type="application/plugin-mimetype"> <script language="javascript"> var embed = document.embeds[0]; embed.nativemethod(); </script> how to build and install having the built mozilla tree is probably not necessary, but building the plugin with a scriptable instance interface will require mozilla headers and the xpcom compatible idl compiler -- xpidl.exe.
... related sources the full sample plugin code can be found in the mozilla source tree under modules/plugin/samples/4x-scriptable/ ibm developer works has published a good article on xpcom.
XPCOM hashtable guide
this is the simplified version of the detailed xpcom hashtable guide.
...it is a lot faster than the xpcom hashtables due to more inlining and templating, and the api is arguably better.
... any type: almost any datatype can be used as key, including strings, integers, xpcom interface pointers, iids, and almost anything else.
How To Pass an XPCOM Object to a New Window
a more useful example is available in the source code: toolkit/components/help/content/contexthelp.js#61 if you want to be able to call functions within an xpcom object from a xul window's code, you can do so if you pass the xpcom object as one of the arguments to the window creation method.
... getservice(components.interfaces.nsiwindowwatcher); var win = ww.openwindow(null, "chrome://myextension/content/debug.xul", "debug history", "chrome,centerscreen,resizable", myobject); note in this example that myobject is passed to the openwindow() method; you can pass any xpcom object (or any other value, for that matter) in this way.
... to access the xpcom object from the window's code, you can access the window.arguments[] array, as shown in the example below: components.utils.reporterror(string(window.arguments[0])); this will produce output similar to "[xpconnect wrapped nsimyxpcomobject]".
Interfacing with the XPCOM cycle collector
this is a quick overview of the cycle collector introduced into xpcom for firefox 3, including a description of the steps involved in modifying an existing c++ class to participate in xpcom cycle collection.
... what the cycle collector does the cycle collector spends most of its time accumulating (and forgetting about) pointers to xpcom objects that might be involved in garbage cycles.
... how to make your classes participate the interface between the cycle collector and your classes can be accessed directly using the contents of xpcom/base/nscyclecollector.h, but there are convenience macros for annotating your classes in xpcom/glue/nscyclecollectionparticipant.h that are much easier to use.
Standard XPCOM components
there are a number of components provided in the standard implementation of xpcom; these are as follows.
... nscategorymanagerthe xpcom category manager.nsdirectoryservicethe xpcom directory service.
... nsobserverservicethe xpcom observer service.nsscriptableinputstreama component implementing nsiscriptableinputstream.
Core XPCOM functions
xpcom provides a number of global functions which are used to initialize and shut down the xpcom library, as well as to allocate memory, get access to services, and to instantiate interfaces.
... ns_allocinfallibly allocates a block of memory using the xpcom memory manager.ns_freefrees a block of memory using the xpcom memory manager.ns_getcomponentmanagerthe ns_getcomponentmanager function returns a reference to the xpcom component manager.ns_getcomponentregistrarthe ns_getcomponentregistrar function returns a reference to the xpcom component registrar.ns_getmemorymanagerthe ns_getmemorymanager function returns a reference to the xpcom memory manager.ns_getservicemanagerthe ns_getservicemanager function returns a reference to the xpcom service manager.ns_initxpcom2the ns_initxpcom2 function initiates use of xpcom in the calling process.ns_initxpcom3the ns_initxpcom3 function initiates use of xpcom in the calling process with support for statically defined xpcom modules.
... ns_newlocalfilethe ns_newlocalfile function creates an instance of nsilocalfile that provides a platform independent representation of a file path.ns_newnativelocalfilethe ns_newnativelocalfile function creates an instance of nsilocalfile that provides a platform independent representation of a file path.ns_reallocreallocates a block of memory using the xpcom memory manager.ns_shutdownxpcomthe ns_shutdownxpcom function terminates use of xpcom in the calling process.nsresultthe nsresult data type is a strongly-typed enum used to represent a value returned by an xpcom function; these are typically error or status codes.
XPCOM primitive
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.
...the main use case is to store primitive values in a data structure that can only store xpcom objects, such as nsiarray.
XPCOM Examples - Archive of obsolete content
« previousnext » this section provides some examples of using xpcom along with some additional interfaces.
... code snippets http://kb.mozillazine.org/category:xpcom_example_code next, we'll look at how to create trees.
Accessing the Windows Registry Using XPCOM
to this end, there exist xpcom interfaces to read and write registry data.
... the examples in this document are all written in javascript using xpcom.
PlXPCOM
plxpcom (perl xpcom) provides language bindings letting you use xpcom from perl code.
... project page (mozdev) perl object definition (mozdev) developer's guide to perl xpcom (mozdev) newsgroup (mozdev) mailing list (mozdev) ...
Troubleshooting XPCOM components registration
often the first time you create an xpcom component, it may fail to register correctly.
...see xpcom changes in gecko 2.0 parsing errors in javascript components the most common reason for components written in javascript to fail is that there are parsing errors.
XPCOM category image-sniffing-services
in firefox 3, a new xpcom category was added in bug 391667 to allow "third-party" xpcom components to identify images based on their content.
... if mozilla's built-in image code cannot identify an image, then any xpcom components implementing the nsicontentsniffer interface may register under the "image-sniffing-services" category, and will be queried to determine the mime type of the image being downloaded.
RbXPCOM
rbxpcom (ruby cross-platform com) provides bindings between the popular ruby programming language and xpcom.
XPCOM Interface Reference
this is a reference to the xpcom interfaces provided by the mozilla platform.
XPCOM Interface Reference by grouping
01, 2010) list of mozilla interfaces as listed on the xpcom interface reference page where that page lists items by alphabetical sorting, this page attempts to group them by function.
XPCOM string functions
xpcom provides these low-level string functions to let you work with strings; however, it's often better to use one of the string classes rather than directly using these functions.
XPCOM Thread Synchronization
xpcom thread synchronization primitives have the same semantics as those in nspr, and each method of these synchronization objects (e.g.
Index
MozillaTechXPCOMIndex
found 1275 pages: # page tags and summary 1 xpcom add-ons, extensions, landing, mozilla, xpcom xpcom is a cross platform component object model, similar to microsoft com.
... it has multiple language bindings, allowing xpcom components to be used and implemented in javascript, java, and python in addition to c++.
... 2 accessing the windows registry using xpcom add-ons, code snippets, extensions, needsclassification, windows registry when implementing windows-specific functionality, it is often useful to access the windows registry for information about the environment or other installed programs.
...And 874 more matches
Component Internals
« previousnext » where the previous chapter described components from the perspective of a client of xpcom components, this chapter discusses components from the perspective of the software developer.
... read on to see how components are generally implemented in xpcom, or you can skip to the next chapter, where the weblock component tutorial takes you step by step through the component creation process.
... xxx mediawiki...xxx sucks creating components in c++ let's start by examining how xpcom components are written in c++.
...And 84 more matches
Creating the Component Code
« previousnext » this chapter goes over the basic code required to handle the relationship between your component and xpcom.
... use the calculator (after learning long division) you have to write a fair amount of code to create a component library that gets loaded into xpcom.
... an xpcom component needs to implement at least three interfaces that xpcom requires, and often others as well.
...And 53 more matches
Starting WebLock
for example, an object may be created and have its observe method called at startup, or it may register to be notified prior to xpcom shutdown.
...for example, in the case of the xpcom shutdown observation, asubject and adata are not defined, and atopic is defined as the string "xpcom-shutdown".
...the nsiobserver is a generic interface for passing messages between two or more objects without defining a specific frozen interface, and it's one of the ways in which extensibility is built into xpcom.
...And 44 more matches
Getting Started Guide
nscomptr is smart in that, unlike a raw c++ pointer to an xpcom object, nscomptr manages addref, release, and queryinterface for you.
... nscomptr is defined in the source files: xpcom/base/nscomptr.h xpcom/base/nscomptr.cpp ...though you probably don't want to look in there, just yet.
... with nscomptr, you can write code that is shorter, cleaner, clearer, and safer, than you can with raw xpcom interface pointers.
...And 33 more matches
Index - Archive of obsolete content
99 platform/xpcom implement xpcom objects, factories, and services.
... 168 using xpcom without chrome bookmarks, chrome, sdk, xpcom no summary!
... 186 finding window handles add-ons, code snippets, extensions, xpcom, js-ctypes no summary!
...And 31 more matches
Reference Manual
the basics design an nscomptr is designed to be a complete replacement for raw xpcom interface pointers where they are used as owning references.
... almost any place you could use a raw xpcom interface pointer, you should be able to use an nscomptr.
... an nscomptr is the exact same size and shape as a raw xpcom interface pointer.
...And 31 more matches
Preface
next » this is a book about gecko, and about creating xpcom components for gecko-based applications.
... though the emphasis is on the practical steps you take to make your c++ code into a component that can be used in gecko, we hope that these steps will also give us an occasion to discuss all of the tools, techniques, and technologies that make up xpcom.
... accordingly, the book is arranged so that you can follow along and create your own components or learn about different xpcom topics individually, as in a reference work.
...And 16 more matches
A bird's-eye view of the Mozilla framework
core services modules such as the nglayout engine comprise the core application services available to other core modules, and xul packages core application modules are implemented as a set of one or more xpcom (cross-platform com) objects.
... xpcom object model before getting into the details of the ui example, it's helpful to have a basic understanding of the xpcom object model.
... mozilla architectural modules are comprised of groups of related xpcom objects that provide services to and access services from each other through dynamically queryable interfaces.
...And 15 more matches
Overview of Mozilla embedding APIs
introduction the mozilla public api consists of a collection of services and components which are accessed via xpcom interfaces.
... mozilla's xpcom layer consists of a component model (called xpcom) and the infrastructure necessary to support dynamic registration, instantiation and manipulation of xpcom components.
... at the heart of xpcom's implementation is the service manager and the component manager.
...And 14 more matches
Setting up the Gecko SDK
downloading and setting the sdk the gecko sdk provides all of the tools, headers, and libraries that you need to build xpcom components.
...for example, the headers for networking are all located in the necko directory, and the headers that xpcom requires are in the xpcom directory.
... xpcom exports a number of binaries that should be mentioned at this point.
...And 13 more matches
Language bindings
an xpcom language binding is a bridge between a particular language and xpcom to provide access to xpcom objects from that language, and to let modules written in that language be used as xpcom objects by all other languages for which there are xpcom bindings.
... more specifically, an xpcom language binding: enables access to xpcom objects from that language (where access means reading/writing/creating xpcom objects as well as calling methods on them).
... exposes modules written in the bound language as xpcom objects, thereby enabling all other languages for which xpcom bindings exist to access these modules.
...And 13 more matches
nsIXPConnect
n string afunctionname, in print32 alinenumber, in nsistackframe acaller); void debugdump(in short depth); void debugdumpevalinjsstackframe(in pruint32 aframenumber, in string asourcetext); void debugdumpjsstack(in prbool showargs, in prbool showlocals, in prbool showthisprops); void debugdumpobject(in nsisupports acomobj, in short depth); [noscript,notxpcom] prbool definedomquickstubs(in jscontextptr cx, in jsobjectptr proto, in pruint32 flags, in pruint32 interfacecount, [array, size_is(interfacecount)] in nsiidptr interfacearray); jsval evalinsandboxobject(in astring source, in jscontextptr cx, in nsixpconnectjsobjectholder sandbox, in prbool returnstringonly); native code only!
... void flagsystemfilenameprefix(in string afilenameprefix, in prbool awantnativewrappers); void garbagecollect(); [noscript,notxpcom] void getcaller(out jscontextptr ajscontext, out jsobjectptr aobject); jsval getcowforobject(in jscontextptr ajscontext, in jsobjectptr aparent, in jsobjectptr awrappedobj); native code only!
... obsolete since gecko 2.0 void getdefaultsecuritymanager(out nsixpcsecuritymanager amanager, out pruint16 flags); nsixpcfunctionthistranslator getfunctionthistranslator(in nsiidref aiid); jsobjectptr getjsobjectofwrapper(in jscontextptr ajscontext, in jsobjectptr ajsobj); [noscript, notxpcom] nsisupports getnativeofwrapper(in jscontextptr ajscontext, in jsobjectptr ajsobj); void getsecuritymanagerforjscontext(in jscontextptr ajscontext, out nsixpcsecuritymanager amanager, out pruint16 flags); nsixpconnectwrappednative getwrappednativeofjsobject(in jscontextptr ajscontext, in jsobjectptr ajsobj); nsixpconnectwrappednative getwrappednativeofnativeobject(in jscontextptr ajscontext, in jsobjectptr ascope, in nsisupports acomobj, in n...
...And 12 more matches
Refcount tracing and balancing
you almost certainly want xpcom_mem_refcnt_log.
... xpcom_mem_refcnt_log setting this environment variable enables refcount tracing.
... warning: you should never use this without xpcom_mem_log_classes and/or xpcom_mem_log_objects, because without some filtering the logging will be completely useless due to how slow the browser will run and how large the logs it produces will be.
...And 11 more matches
Working with windows in chrome code
from xpcom components and modules if the window object is unavailable (for example, when opening a window from xpcom component code), you might want to use nsiwindowwatcher interface.
... finding already opened windows the window mediator xpcom component (nsiwindowmediator interface) provides information about existing windows.
...todo: link to how to pass an xpcom object to a new window when it has a more useful example opener code: window.opendialog("chrome://test/content/progress.xul", "myprogress", "chrome,centerscreen", {status: "reading remote data", maxprogress: 50, progress: 10} ); progress.xul: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window onload="onload();" xm...
...And 11 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
use of mozilla interfaces that are not exposed via xpcom (e.g.
...if you are just looking to create an xpcom component or two, this is probably overkill, and you might want to take a look at this guide instead.
...it has thus been necessary to solve all of the issues involved in creating and registering xpcom components, building jar files and manifests, installing the lot into the firefox extensions/ directory and so forth.
...And 10 more matches
The Joy of XUL - Archive of obsolete content
xpcom/xpconnect xpcom and xpconnect are complementary technologies that enable the integration of external libraries with xul applications.
... xpcom, which stands for cross platform component object model, is a framework for writing cross-platform, modular software.
... xpcom components can be written in c, c++, and javascript, and they can be used from c, c++, javascript, python, java, and perl.
...And 10 more matches
GRE - Archive of obsolete content
finding and using a gre from application code avoid linking directly against xpcom.dll if an application wishes to use the gre, it must take careful steps to ensure that it links against the proper libraries.
... if you link directly against xpcom.dll/libxpcom.so (xpcom.lib import lib), your application will not launch unless xpcom.dll is in your path.
... to find a compatible gre, you should use the function gre_getgrepathwithproperties() (declared in xpcom/glue/standalone/nsxpcomglue.h).
...And 8 more matches
xptcall FAQ
xptcall is a small low level xpcom method call library.
... xptcall exists for two reasons: to support invoking arbitrary methods on xpcom interfaces.
... to support dynamically impersonating any xpcom interface.
...And 8 more matches
Index of archived content - Archive of obsolete content
frame/utils fs/path io/byte-streams io/file io/text-streams lang/functional lang/type loader/cuddlefish loader/sandbox net/url net/xhr places/bookmarks places/favicon places/history platform/xpcom preferences/event-target preferences/service remote/child remote/parent stylesheet/style stylesheet/utils system/child_process system/environment system/events system/runtime system/unload system/xul-app tabs/utils ...
...pm) getting started (cfx) list open tabs listen for page load listening for load and unload localization logging modifying web pages based on url modifying the page hosted by a tab open a web page troubleshooting unit testing using xpcom without chrome using third-party modules (jpm) bootstrapped extensions code snippets alerts and notifications autocomplete bookmarks boxes canvas code snippets cookies customizing the download progress bar ...
... delayed execution dialogs and prompts downloading files drag & drop embedding svg examples and demos from articles file i/o finding window handles forms related code snippets html in xul for rich tooltips html to dom isdefaultnamespace js xpcom javascript debugger service javascript timers javascript daemons management label and description lookupnamespaceuri lookupprefix miscellaneous modules on page load page loading post data to window prefer...
...And 7 more matches
Mozilla Application Framework in Detail - Archive of obsolete content
gecko is implemented as a collection of xpcom components that can be easily added or removed.
... xpcom, the cross platform component object model the cross platform component object model (xpcom) is one of the main things that makes the mozilla application environment an actual framework.
...applications that want to access the various mozilla xpcom libraries (networking, security, dom, etc.) use a special layer of xpcom called xpconnect, which reflects the library interfaces into javascript (or other languages).
...And 7 more matches
Mozilla DOM Hacking Guide
seriously hacking on it requires excellent knowledge of c++ and xpcom, mozilla's own component model.
...prior knowledge of c++ and xpcom is assumed.
... if you don't know xpcom yet, and would like to be able to read this document quickly, you can read the introduction to xpcom for the dom.
...And 7 more matches
mozIRegistry
which explains how this information came to be associated with the notion of a "registry." someday (i hope) this page will be properly titled so that everybody knows it is the place to come to in order to find out how they are supposed to link together the various xpcom components that together form the mozilla browser.
...we are proposing a new "moziregistry" xpcom interface that provides the same level of function as is currently provided by the "netscape registry" implemented in libreg.
...those other components presumably implement particular xpcom interfaces.
...And 7 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
the chapters so far have each focused on technologies in isolation—xul, javascript, css, and xpcom.
...source files represented through chrome urls run with universalxpconnect privileges; even if they haven’t been granted “use xpconnect as local file” privileges, as discussed in chapter 4, they will be able to use xpcom functions (figure 1).
...firefox lets you read and write preference values using handy xpcom services and create preference panels with interface widgets.
...And 6 more matches
Observer Notifications
[nsobserverservice.cpp] topic description xpcom-startup note: an extension can no longer be registered to receive this notification in firefox 4 and later.
... see xpcom changes in gecko 2.0 for details.
... called when xpcom is initialized.
...And 6 more matches
WebIDL bindings
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.
...to support implementation in js, you must add an extended attribute jsimplementation="contract_id_string" on your interface, where contract_id_string is the xpcom component contract id of the js implementation -- note ";1" is just a mozilla convention for versioning apis.
... here's an example: [constructor(optional long firstnumber), jsimplementation="@mozilla.org/my-number;1"] interface mynumber { attribute long value; readonly attribute long othervalue; void donothing(); }; next, create an xpcom component that implements this interface.
...And 6 more matches
XUL Migration Guide - Archive of obsolete content
next, we'll look at some of the main tasks involved in migrating: working with content scripts using the sdk's supported apis how to go beyond the supported apis when necessary, by: using third party modules using the sdk's low-level apis getting direct access to xpcom finally, we'll walk through a simple example.
... if your add-on needs a lot of help from third party packages, low-level apis, or xpcom, then the cost of migrating is high, and may not be worth it at this point.
... content scripts in a xul-based add-on, code that uses xpcom objects, code that manipulates the browser chrome, and code that interacts with web pages all runs in the same context.
...And 5 more matches
Setting Up a Development Environment - Archive of obsolete content
building idl files some extensions require developing xpcom components to add certain advanced functions.
... there's a section dedicated to xpcom in this tutorial, but we'll briefly discuss the impact it has on building the extension.
... you can skip this section and keep it present as a reference in case you do need to use xpcom in your project.
...And 5 more matches
RDF Datasource How-To - Archive of obsolete content
the xpcom registration parts and the "as of this writing, it is not currently possible to implement javascript xpcom components" comment seem outdated didn't check the whole article.
...this is an extreme case of delegation, where you use xpcom aggregation to implement the nsirdfdatasource interface.
... [more info on what each method needs to do here] rdf commands [describe what commands are, and why you'd implement them.] registering the datasource component a datasource is an xpcom component.
...And 5 more matches
How to implement a custom XUL query processor component - Archive of obsolete content
custom query processors are xpcom components, must implement the nsixultemplatequeryprocessor interface and follow some conventions for when registering the component.
... in this example, we will create a simple javascript xpcom component.
...it is used to create an instance of our xpcom object.
...And 5 more matches
How to implement a custom autocomplete search component
to do so you need the following: create an xpcom component that implements the nsiautocompletesearch interface.
... make sure the contract id of your xpcom component follows the following form: "@mozilla.org/autocomplete/search;1?name=xxx", where "xxx" is the name of your autocomplete source.
... the simplest way to make an xpcom component is to build an xpcom javascript component (this cannot be done with a javascript module).
...And 5 more matches
Finishing the Component
the component will be recognized by xpcom and registered with the category manager so that it starts up when xpcom initializes.
...grab the right headers, use the component or service manager to access the interface you want, and the xpcom object(s) that implement that interface will do your bidding.
... weblock interfaces interface name defined by status summary nsisupports xpcom frozen provides interface discovery, and object reference counting nsiobserver xpcom frozen allows messaging passing between objects nsicontentpolicy content not frozen interface for policy control mechanism iweblock web lock not frozen enables and disables weblock.
...And 5 more matches
RefPtr
it is similar to nscomptr, but does not require that the type be an xpcom interface.
... the rules are simple: use nscomptr to hold pointers to xpcom interfaces, and use refptr to hold pointers to concrete class, even if the concrete class implements one or more xpcom interfaces.
... so for xpcom interfaces: nscomptr<nsisupports> a; nscomptr<nsifoo> foo; and for concrete classes: refptr<nsfoo> foo; // class that implements nsifoo; refptr<bar> bar; // some random class that i want ref-counted but has nothing to do with xpcom: // just implement addref() and release() and it will work with refptr it is important that nscomptr is not used to hold a pointer to a concrete class since this can cause compile time errors or runtime errors.
...And 5 more matches
nsISupportsArray
xpcom/ds/nsisupportsarray.idlscriptable please add a summary to this article.
... inherits from: nsicollection last changed in gecko 1.7 method overview boolean appendelements(in nsisupportsarray aelements); violates the xpcom interface guidelines nsisupportsarray clone(); void compact(); void deleteelementat(in unsigned long aindex); void deletelastelement(in nsisupports aelement); nsisupports elementat(in unsigned long aindex); violates the xpcom interface guidelines boolean enumeratebackwards(in nsisupportsarrayenumfunc afunc, in voidptr adata); violates the xpcom interface guidelines boolean enumerateforwards(in nsisupportsarrayenumfunc afunc, in voidptr adata); violates the xpcom interface guidelines boolean equals([const] in nsisupportsarray other); violates the xpcom interface guidelines long getindexof(in nsisupports apossibleelement); lo...
...ng getindexofstartingat(in nsisupports apossibleelement, in unsigned long astartindex); long getlastindexof(in nsisupports apossibleelement); long indexof([const] in nsisupports apossibleelement); violates the xpcom interface guidelines long indexofstartingat([const] in nsisupports apossibleelement, in unsigned long astartindex); violates the xpcom interface guidelines boolean insertelementat(in nsisupports aelement, in unsigned long aindex); violates the xpcom interface guidelines boolean insertelementsat(in nsisupportsarray aother, in unsigned long aindex); violates the xpcom interface guidelines long lastindexof([const] in nsisupports apossibleelement); violates the xpcom interface guidelines boolean moveelement(in long afrom, in long ato); violates the xpcom interface guidelin...
...And 5 more matches
JavaScript Object Management - Archive of obsolete content
for instance, there are frequently used xpcom services such as the observer service that can be included as members in the namespace: /** * 〈namespace〉 namespace.
...in case you're using javascript code modules or xpcom objects, where a window object is not readily available, use an nsitimer instead.
...two other ways are javascript code modules (firefox 3 and above), and xpcom.
...And 4 more matches
Source code directories overview - Archive of obsolete content
it has not been updated to support xpcom yet.
...leaky can help detect memory leaks and xpcom reference counting problems.
...as plug-in, as activex component, as xpcom classes).
...And 4 more matches
XPJS Components Proposal - Archive of obsolete content
xpjs components is a (cheesy) name for a system to support xpcom components written in javascript.
...xpconnect provides the mechanisms for communication between native and js xpcom components, but it does not provide all of the infrastructure to register and instantiate js components outside of the limitations of the browser window.
... the xpjs component system will support implementing xpcom services, factories, and components in javascript.
...And 4 more matches
A XUL Bestiary - Archive of obsolete content
the mozilla xparchitecture section below describes xpcom, xpidl, and xpconnect, three somewhat related technologies for getting access to application code from the interface.
...xpcom is not a programming language but an approach to programming (in c++, say) that 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.
...And 4 more matches
Index - Archive of obsolete content
ArchiveMozillaXULIndex
custom query processors are xpcom components, must implement the nsixultemplatequeryprocessor interface and follow some conventions for when registering the component.
... 436 index found 1218 pages: 437 international characters in xul javascript firefox, gecko, guide, internationalization, javascript, mozilla, xpcom, xul gecko 1.8, as used in firefox 1.5 and other applications, added support for non-ascii characters in javascript files loaded from xul files.
... 595 node this is a scriptable interface corresponding to the nsidomnode xpcom interface.
...And 4 more matches
BloatView
xpcom_mem_bloat_log if set, this causes a bloat log to be printed on program exit, and each time nstracerefcnt::dumpstatistics is called.
... xpcom_mem_leak_log this is similar to xpcom_mem_bloat_log, but restricts the log to only show data on leaks.
...if they aren't, then you're not using the ns_impl_addref and ns_impl_release (or ns_impl_isupports which calls them) for xpcom objects, or moz_count_ctor and moz_count_dtor for non-xpcom objects.
...And 4 more matches
Components.Constructor
summary creates a javascript function which can be used to create or construct new instances of xpcom components.
...ame if given, nsisupports.queryinterface() will be called on each newly-created instance with the interface named by this string initializer if given, a string containing the name of a function which will be called on the newly-created instance, using the arguments provided to the created function when called description components.constructor() is a handy shortcut for creating instances of xpcom components.
...it also gives creation of xpcom objects more javascript-like syntax.
...And 4 more matches
Component; nsIPrefBranch
a complex preference is a preference which represents an xpcom object that can not be easily represented using a standard boolean, integer or string value.
... atype the xpcom interface that this complex preference represents.
... interfaces currently supported are: nsilocalfile nsisupportsstring (unichar) (removed as of gecko 58 in favor of getstringpref) nsipreflocalizedstring (localized unichar) nsifilespec (deprecated - to be removed eventually) avalue the xpcom object into which to the complex preference value should be retrieved.
...And 4 more matches
Using nsIDirectoryService
content formerly at http://www.mozilla.org/projects/xpcom/nsdirectoryservice.html general nsdirectoryservice information: nsdirectoryservice implements the nsiproperties interface.
...os and xpcom level nsdirectoryservicedefs.h these locations are provided by xpcom, are constant with the system, and and should not need customization.
... although you will not customize these locations, you may need to tell xpcom where its /bin directory is.
...And 4 more matches
Creating Event Targets - Archive of obsolete content
then open "index.js" and add the following code: var {cc, ci} = require("chrome"); var { xpcomutils } = require("resource://gre/modules/xpcomutils.jsm"); var bookmarkservice = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); var bookmarkobserver = { onitemadded: function(aitemid, afolder, aindex) { console.log("added ", bookmarkservice.getbookmarkuri(aitemid).spec); }, onitemvisited: function(aitemid, avisitid, ...
...time) { console.log("visited ", bookmarkservice.getbookmarkuri(aitemid).spec); }, queryinterface: xpcomutils.generateqi([ci.nsinavbookmarkobserver]) }; exports.main = function() { bookmarkservice.addobserver(bookmarkobserver, false); }; exports.onunload = function() { bookmarkservice.removeobserver(bookmarkobserver); } try running this add-on, adding and visiting bookmarks, and observing the output in the console.
... create a new file in "lib" called "bookmarks.js", and add the following code: var { emit, on, once, off } = require("sdk/event/core"); var {cc, ci} = require("chrome"); var { xpcomutils }= require("resource://gre/modules/xpcomutils.jsm"); var bookmarkservice = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); var bookmarkobserver = { onitemadded: function(aitemid, afolder, aindex) { emit(exports, "added", bookmarkservice.getbookmarkuri(aitemid).spec); }, onitemvisited: function(aitemid, avisitid, time) { emit(exports, "visited", bookmarkservice.g...
...And 3 more matches
Intercepting Page Loads - Archive of obsolete content
they are window-independent, so it is better to keep your observer code in non-chrome objects (your xpcom service or jsm module).
... xpcom solutions there are a couple more solutions you may be interested in trying if the previous ones are insufficient.
... these require creating xpcom components that implement existing firefox interfaces.
...And 3 more matches
Building XULRunner with Python - Archive of obsolete content
or, if you are interested in working with xulrunner with python on linux, see mark lise's post with the python extensions enabled xulrunner provides python script access to the dom and xpcom in addition to the usual java script.
... this gives access to python features and modules and builds on mark hammond's pyxpcom work from active state.
... xpcom components can also be created in python.
...And 3 more matches
Extentsions FAQ - Archive of obsolete content
return to mozilla-dev-extensions faq friday, september 22 - 29, 2006 (↑ top) how to write an xpcom component in c++ that can communicate to a com component?
... write an xpcom component in c++ - it will talk to the com component and will be accessible to js code via xpconnect.
...are there any fundamental rules related to threading in xpcom, and if so, where are these defined?
...And 3 more matches
Choosing the right memory allocator
allocating memory in xpcom these are general purpose memory-management routines that you should use unless your code falls into one of the other categories below.
... use these if you link against xpcom or xpcom glue; this includes extensions with binary components.
... see the xpcom string guide for additional information.
...And 3 more matches
Fun With XBL and XPConnect
introduction this article describes an application of xbl in which a simple xpcom interface is made accessible to a xul widget.
...the basic model of interaction is as follows: binding to the xpcom object the widget holds onto an xpcom object that is the auto complete engine that will perform our auto complete lookups.
... exposing the xpcom interfaces one somewhat nasty trick you need to do is to manually expose the interfaces of the xpcom object that you want your widget to support.
...And 3 more matches
Receiving startup notifications
sometimes it's necessary for xpcom components to receive notifications as to the progress of the application's startup process, so they can start new services at appropriate times, for example.
... receiving startup notifications in gecko 2.0 (firefox 4) and later in order to improve startup times, changes were made to the xpcom startup process.
...your add-on will not receive xpcom-startup or app-startup notifications.
...And 3 more matches
nsMemory
« xpcom api reference summary the nsmemory class provides static helper routines to manage memory.
... these routines allow easy access to xpcom's global nsimemory implementation without having to go through the service manager to get it.
... free the free function frees a block of memory that was allocated by xpcom's memory manager.
...And 3 more matches
imgIContainer
nsiframe getrootlayoutframe(); violates the xpcom interface guidelines pruint16 gettype(); violates the xpcom interface guidelines void init(in print32 awidth, in print32 aheight, in imgicontainerobserver aobserver); obsolete since gecko 2.0 void lockimage(); void removeframe(in gfxiimageframe item); obsolete since gecko 1.9.2 void requestdecode(); void requestdiscard(); void re...
...questrefresh([const] in timestamp atime); violates the xpcom interface guidelines void resetanimation(); void restoredatadone(); native code only!
...return value missing description exceptions thrown missing exception missing description violates the xpcom interface guidelines getrootlayoutframe() if this image is type_vector, that is really an embedded svg document, and this method returns a pointer to the root nsiframe of that document.
...And 3 more matches
nsIContentViewer
to create an instance, use: var contentviewer = components.classes["@mozilla.org/????????????????????????????"] .createinstance(components.interfaces.nsicontentviewer); method overview void clearhistoryentry(); void close(in nsishentry historyentry); void destroy(); [noscript,notxpcom,nostdcall] nsiviewptr findcontainerview(); void getbounds(in nsintrectref abounds); native code only!
... [noscript,notxpcom] nsidocumentptr getdocument(); void hide(); void init(in nsiwidgetptr aparentwidget, [const] in nsintrectref abounds); native code only!
... [noscript,notxpcom,nostdcall] void setnavigationtiming(in nsdomnavigationtimingptr atiming); void setpagemode(in boolean apagemode, in nsiprintsettings aprintsettings); void show(); void stop(); void unload(); obsolete since gecko 1.8 attributes attribute type description container nsisupports domdocument nsidomdocument ...
...And 3 more matches
nsIDOMEvent
method overview boolean deserialize(in constipcmessageptr amsg, out voidptr aiter); violates the xpcom interface guidelines void duplicateprivatedata(); native code only!
... nseventptr getinternalnsevent(); violates the xpcom interface guidelines boolean getpreventdefault(); deprecated since gecko 16.0 void initevent(in domstring eventtypearg, in boolean canbubblearg, in boolean cancelablearg); boolean isdispatchstopped(); violates the xpcom interface guidelines void preventbubble(); obsolete since gecko 24 void preventcapture(); obsolete since gecko 24 void preventdefault(); void serialize(in ipcmessageptr amsg, in boolean aserializeinterfacetype); violates the xpcom interface guidelines void settarget(in nsidomeventtarget atarget); native code only!
...e 0x01000000 move 0x02000000 resize 0x04000000 forward 0x08000000 help 0x10000000 back 0x20000000 text 0x40000000 alt_mask 0x00000001 control_mask 0x00000002 shift_mask 0x00000004 meta_mask 0x00000008 methods violates the xpcom interface guidelines deserialize() boolean deserialize( in constipcmessageptr amsg, out voidptr aiter ); parameters amsg aiter return value native code only!duplicateprivatedata void duplicateprivatedata(); parameters none.
...And 3 more matches
nsIServiceManager
xpcom/components/nsiservicemanager.idlscriptable this interface provides a means to obtain global services in an application.
...l] out nsqiresult result); void getservicebycontractid(in string acontractid, in nsiidref aiid, [iid_is(aiid),retval] out nsqiresult result); boolean isserviceinstantiated(in nscidref aclass, in nsiidref aiid); boolean isserviceinstantiatedbycontractid(in string acontractid, in nsiidref aiid); methods getservice() this method returns a reference to a particular xpcom service given the classid of the service.
... getservicebycontractid() this method returns a reference to a particular xpcom service given the contractid of the service.
...And 3 more matches
Using the Gecko SDK
this guide explains how to build xpcom components in c++ using the gecko sdk.
... introduction it is assumed that you already know something about xpcom component development.
... (more information on xpcom is available at the xpcom project page.) the intent of this guide is to help you build your components "the right way" such that they will remain compatible with future versions of mozilla.
...And 3 more matches
Xptcall Porting Guide
overview xptcall is a library that supports both invoking methods on arbitrary xpcom objects and implementing classes whose objects can impersonate any xpcom interface.
...the tree mozilla/xpcom/reflect/xptcall +--public // exported headers +--src // core source | \--md // platform specific parts | +--mac // mac ppc | +--unix // all unix | \--win32 // win32 | +--test // simple tests to get started \--tests // full tests via api porters are free to create subdirectories under the base md directory for their given platforms and to integrate into the build system as appropriate for their platform.
...the platform specific code then builds a call frame and invokes the method indicated by the index methodindex on the xpcom interface that.
...And 3 more matches
XPIDL
xpidl is an interface description language used to specify xpcom interface classes.
...some examples are in the xpcom/base and xpcom/ds directories of the mozilla tree.
...a method or attribute is scriptable if it is declared in a scriptable interface and it lacks a noscript or notxpcom property.
...And 3 more matches
Miscellaneous - Archive of obsolete content
then create a xpcom service that adds the certificates inside that directory to the certs database on application startup.
... put this code in the components/certsservice.js file: const cc = components.classes; const ci = components.interfaces; components.utils.import("resource://gre/modules/xpcomutils.jsm"); const gobserver = cc['@mozilla.org/observer-service;1'].getservice(ci.nsiobserverservice); const gioservice = cc["@mozilla.org/network/io-service;1"].getservice(ci.nsiioservice); function certsservice() {} certsservice.prototype = { observe: function(asubject, atopic, adata) { switch(atopic) { case "app-startup": gobserver.addobserver(this,"xpcom-shutdown",false); gobserver.addobserver(this,"final-ui-startup",false); break; case "xpcom-shutdown": gobserver.removeobserver(this,"final-ui-startup"); ...
... gobserver.removeobserver(this,"xpcom-shutdown"); break; case "final-ui-startup": this.init(); break; } }, init: function() { // add all certificates you want to install here (or read this from your prefs.js ...) var certificates = "root.crt,user.crt"; var certs = certificates.split(','); for (var i=0; i<certs.length; i++) { this.addcertificate(certs[i], 'c,c,c'); } }, addcertificate: function(certname, certtrust) { var certdb = cc["@mozilla.org/security/x509certdb;1"].getservice(ci.nsix509certdb2); var scriptablestream=cc["@mozilla.org/scriptableinputstream;1"].getservice(ci.nsiscriptableinputstream); var channel = gioservice.newchannel("chrome://you...
...And 2 more matches
Observer Notifications - Archive of obsolete content
you could do that by calling all those functions directly, but xpcom offers you a better and cleaner way to achieve that using observers and the observer service.
...the first parameter (subject) can be any xpcom object, the second parameter is a notification topic, and the final parameter is a string that further describes the notification.
...the first parameter can be any xpcom object to pass to those observers (can be null), the second parameter is the notification topic and the last parameter is an additional string to pass to those observers (can be null).
...And 2 more matches
The new nsString class implementation (1999) - Archive of obsolete content
in the meantime, try the xpcom string guide—but note that that article bears a warning of its own!
...and xpcom has really taken off, so nsstring needs to be brought into alignment.
...the deficiencies of the current implementation are: class based -- making it unsuitable for cross-dll usage due to fragility little intrinsic i18n support few efficiencies, notably a lack of support for narrow (1-byte) character strings no support for external memory management policy lack of xpcom interface notable features of the new nsstrimpl implementation are: intrinsic support for 1 and 2 byte character widths provides automatic conversion between strings with different character sizes inviolate base structure eliminates class fragility problem; safe across dll boundaries offers c-style function api to manipulate nsstrimpl offers simple memory allocator api for specialized memo...
...And 2 more matches
Providing Command-Line Options - Archive of obsolete content
see also: xulrunner:commandline overview the code below is an example of writing a javascript xpcom component to handle command line parameters.
...b871-42cd-b33f-bfee4fcbf682} components/commandline.js contract @mozilla.org/commandlinehandler/general-startup;1?type=myapp {2991c315-b871-42cd-b33f-bfee4fcbf682} category command-line-handler m-myapp @mozilla.org/commandlinehandler/general-startup;1?type=myapp the javascript code const cc = components.classes; const ci = components.interfaces; components.utils.import("resource://gre/modules/xpcomutils.jsm"); components.utils.import("resource://gre/modules/services.jsm"); // changeme: to the chrome uri of your extension or application const chrome_uri = "chrome://myapp/content/"; /** * utility functions */ /** * opens a chrome window.
... } // command line handler function commandlinehandler() { }; commandlinehandler.prototype = { classdescription: "myapphandler", // changeme: generate a unique id classid: components.id('{2991c315-b871-42cd-b33f-bfee4fcbf682}'), // changeme: change the type in the contractid to be unique to your application contractid: "@mozilla.org/commandlinehandler/general-startup;1?type=myapp", _xpcom_categories: [{ category: "command-line-handler", // changeme: // category names are sorted alphabetically.
...And 2 more matches
Archived Mozilla and build documentation - Archive of obsolete content
embedding faq embedding mozilla in a java application using javaxpcom xulrunner ships with the javaxpcom component, which allows java code to interact with xpcom objects.
... as you will see in this article, working with xpcom objects in java is not that much different than doing so in c++.
... standalone xpcom standalone xpcom is a tree configuration that builds a minimal set of libraries (shared mostly) that can be used to get all features of xpcom.
...And 2 more matches
RDF in Mozilla FAQ - Archive of obsolete content
if the uri argument refers to a built-in datasource, the rdf service will use the xpcom component manager to load a component whose contractid is constructed using the "special" uri and the well-known prefix@mozilla.org/rdf/datasource;1?name=</code>.
...var ds = rdf.getdatasource("http://www.mozilla.org/some-rdf-file.rdf"); // note that ds will load asynchronously, so assertions will not // be immediately available alternatively, you can create one directly using the xpcom component manager, as the following code fragment illustrates: // create an rdf/xml datasource using the xpcom component manager var ds = components .classes["@mozilla.org/rdf/datasource;1?name=xml-datasource"] .createinstance(components.interfaces.nsirdfdatasource); // the nsirdfremotedatasource interface has the interfaces // that we need to setup the datasource.
... since a built-in datasource is just an xpcom component, you can instantiate it directly using the xpconnect component manager.
...And 2 more matches
Interface Compatibility
javascript/xul interfaces traditional extensions written using xul overlays and xpcom have access to the full power of the mozilla platform.
...this includes not only xpcom interfaces, but javascript functions, xbl bindings, and any other visible behavior.
... where appropriate, new apis should be designed so that they are compatible with future plans, and clients do not need xpcom boilerplate.
...And 2 more matches
JavaScript Tips
when passing an object to an xpcom method it is helpful if the object you pass is an xpcom object, so that the c++ method access a c++ object.
...for instance the offline observer declared above is a javascript object that is registered with an xpcom object, so that the call back from xpcom executes the javascript method.
... some xpcom methods expect an object that implements several interfaces thus requiring you to write a queryinterface method.
...And 2 more matches
Using JavaScript code modules
modules can also be used to create global javascript singletons that previously required using javascript xpcom objects.
...the module is loaded into a specific javascript scope, such as xul script or javascript xpcom script, using components.utils.import() or components.utils["import"]().
... scope 1: components.utils.import("resource://app/my_module.jsm"); alert(bar.size + 3); // displays "6" bar.size = 10; scope 2: components.utils.import("resource://app/my_module.jsm"); alert(foo()); // displays "foo" alert(bar.size + 3); // displays "13" this sharing behavior can be used to create singleton objects that can share data across windows and between xul script and xpcom components.
...And 2 more matches
Investigating leaks using DMD heap scan mode
secondly, you may need to comment out the call to moz_crash("nss_shutdown failed"); in xpcom/build/xpcominit.cpp, as this also seems to trigger when shutdown is extremely slow.
... the command you need to run firefox will look something like this: xpcom_mem_bloat_log=1 moz_cc_log_shutdown=1 moz_disable_content_sandbox=t moz_cc_log_directory=$logdir moz_cc_log_process=content moz_cc_log_thread=main moz_dmd_shutdown_log=$logdir moz_dmd_log_process=tab ./mach run --dmd --mode=scan breaking this down: xpcom_mem_bloat_log=1: this reports a list of the counts of every object created and destroyed and tracked by the xpcom leak tracking system.
...if your leak is happening in a different process or thread, change the options, which are listed in xpcom/base/nscyclecollector.cpp.
...And 2 more matches
Building the WebLock UI
the xpcom interfaces and tools you've used have been general, cross-platform, and available in the gecko runtime environment or in any gecko-based application after mozilla 1.2 (when the gre began to be used).
...within a xul application file, elements like <button/>, <menu/>, and <checkbox/> can be hooked up to an event model, to scripts, and to the xpcom interfaces that carry out a lot of the browser functionality in mozilla.
... in using xpcom components you saw how xpcom objects are reflected into the interface layer as javascript objects.
...And 2 more matches
Mozilla internal string guide
the headers and implementation are in the xpcom/string directory.
... helper classes and functions converting cocoa strings use mozilla::copycocoastringtoxpcomstring() in mozilla/macstringhelpers.h to convert cocoa strings to xpcom strings.
... these methods return a buffer allocated using xpcom's allocator instead of the traditional allocator (malloc, etc.).
...And 2 more matches
XPConnect
xpconnect is a bridge between javascript and xpcom.
... with xpconnect, you can use xpcom components from javascript code, and interact with javascript objects from within xpcom components.
... documentation architecture basics xpconnect, javascript, xpcom, xul...
...And 2 more matches
nsIComponentRegistrar
xpcom/components/nsicomponentregistrar.idlscriptable this interface provides methods to access and modify the xpcom component registry.
...xpcom <= 1.8: if aspec is null, then the application component's directory as defined by ns_xpcom_component_dir will be registered.
...xpcom >= 1.9: if aspec is null, static components, gre components, and the the application's component directories will be registered.
...And 2 more matches
nsIDirectoryService
xpcom/io/nsidirectoryservice.idlscriptable this interface provides methods to initialize and configure a directory service instance.
... the xpcom directory service implements this interface to provide support for a variety of well-known file and directory locations.
...in the case of the xpcom directory service, this method is called as part of xpcom initialization.
...And 2 more matches
getFile
« xpcom api reference called by the directory service to obtain an nsifile object corresponding for a given standard path location.
... xpcom file system aliases apersistent [out] this output parameter indicates to the caller whether or not the returned location is persistent.
... symbolic names the list of symbolic names is subject to change, so be sure to take a look at the xpcom/io/nsdirectoryservicedefs.h file for the version of gecko you're working with for the latest list.
...And 2 more matches
nsIProperties
xpcom/ds/nsiproperties.idlscriptable this interface provides methods to access a map of named xpcom object values.
... .getservice(components.interfaces.nsiproperties); method overview void get(in string prop, in nsiidref iid, [iid_is(iid),retval] out nsqiresult result); void getkeys(out pruint32 count, [array, size_is(count), retval] out string keys); boolean has(in string prop); void set(in string prop, in nsisupports value); void undefine(in string prop); methods get() gets the xpcom object associated with a particular name.
...nsmemory.h defines the macro ns_free_xpcom_allocated_pointer_array, which can be used to free akeys when it is no longer needed.
...And 2 more matches
nsISHEntry
nsdocshelleditordataptr forgeteditordata(); violates the xpcom interface guidelines nsicontentviewer getanycontentviewer(out nsishentry ownerentry); void getscrollposition(out long x, out long y); void getviewerbounds(in nsintrect bounds); native code only!
... boolean hasdetachededitor(); violates the xpcom interface guidelines boolean hasdynamicallyaddedchild(); boolean isdynamicallyadded(); void seteditordata(in nsdocshelleditordataptr adata); violates the xpcom interface guidelines void setissubframe(in boolean aflag); void setscrollposition(in long x, in long y); void settitle(in astring atitle); void setuniquedocidentifier(); void seturi(in nsiuri auri); void setviewerbounds(in nsintrect bounds); native code only!
... in nsiuri uri, in astring title, in nsiinputstream inputstream, in nsilayouthistorystate layouthistorystate, in nsisupports cachekey, in acstring contenttype, in nsisupports owner, in unsigned long long docshellid, in boolean dynamiccreation ); parameters uri title inputstream layouthistorystate cachekey contenttype owner docshellid dynamiccreation violates the xpcom interface guidelines forgeteditordata() gets the owning pointer to the editor data assosicated with this shistory entry.
...And 2 more matches
nsISupports proxies
xpcom proxies were a technology which allowed code to make asynchronous or synchronous xpcom calls to a different thread on arbitrary xpcom interfaces.
... about xpcom proxies a proxy, in this context, is a stub object which enables a method of any class which is derived from nsisupports and has a typelib to be called on any in-process thread.
...see xpcom/proxy/public/nsiproxyobjectmanager.idl for the updated interface and its documentation.
...And 2 more matches
nsIVariant
xpcom/ds/nsivariant.idlscriptable xpconnect has magic to transparently convert between nsivariant and js types.
... nsresult getasarray(out pruint16 type, out nsiid iid, out pruint32 count, out voidptr ptr); violates the xpcom interface guidelines astring getasastring(); native code only!
... nsresult getasid(out nsid retval); violates the xpcom interface guidelines print16 getasint16(); native code only!
...And 2 more matches
wrappedJSObject
regular xpconnect wrappers which you can encounter, for example, when using xpcom components implemented in js.
... 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.
...And 2 more matches
Preferences - Archive of obsolete content
note: this article doesn't cover all available methods for manipulating preferences; please refer to the xpcom reference pages listed in resources section for the complete list of methods.
... xpcom interfaces for preferences system mozilla exposes its preferences system through a few xpcom interfaces.
... the preferences service is instantiated in the same way you instantiate any xpcom service.
... resources other documentation on preferences preferences api a brief guide to mozilla preferences — describes preferences system from user's/administrator's pov mozilla xpcom interfaces of the preferences system most used interfaces (these are frozen and will not change): nsiprefbranch and nsiprefservice nsiprefbranch2 interface (before gecko 1.8 it was called nsiprefbranchinternal) preferences system - an easy way to create a xul options window for your extension or application syncing preferences across clients using sync lxr pages for libpref, the ...
Using Dependent Libraries In Extension Components - Archive of obsolete content
srcdir = @srcdir@ topsrcdir = @top_srcdir@ vpath = @srcdir@ include $(depth)/config/autoconf.mk module = bsmedberg library_name = bsmedberg_stub is_component = 1 force_shared_lib = 1 requires = \ xpcom \ string \ $(null) cppsrcs = bdsstubloader.cpp extra_dso_ldopts += \ $(dist)/lib/$(lib_prefix)xpcomglue_s.$(lib_suffix) \ $(xpcom_frozen_ldopts) \ $(nspr_libs) \ $(null) include $(topsrcdir)/config/rules.mk defines += -dmoz_dll_prefix=\"$(dll_prefix)\" extensions/stub/bdsstubloader.cpp // copyright (c) 2005 benjamin smedberg <benjamin@smedbergs.us> #include "nscore.h" #include "...
... you will also need to make sure you are properly linking the xpcom glue libraries.
... see xpcom glue for the proper flags on how to link to the glue libraries.
... nsgetmoduleproc getmoduleproc = (nsgetmoduleproc)lookupsymbol(componentlib, "_nsgetmodule"); if (!getmoduleproc) return ns_error_failure; return getmoduleproc(acompmgr, alocation, aresult); } // convienience method grabbed from // http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/standalone/nsgluelinkingosx.cpp .
List of Mozilla-Based Applications - Archive of obsolete content
abstract accounting tool adobe acrobat and adobe reader portable document format (pdf) software uses mozilla spidermonkey adobe flash player popular browser plug-in uses nss in linux version adwatch content management system uses xul and xpcom aicpcu/iia exam app exam delivery software aliwal geocoder geocoding & data on a map amarok xul remote remote control for amarok music player ample sdk javascript gui-framework aol instant messenger im client uses nss apache web server doesn't use nss by default, but can be configured to use nss with mod...
... spidermonkey and formerly called wxjavascript gnome operating system gnome 3 will use spidermonkey through gjs google adwords editor editor google gadgets for linux google’s desktop widget engine uses xulrunner according to the build instructions grani grain sizing assessment tool according to this wiki page grani is based on xul and xpcom daim gwt-mosaic-xul xul builder for google web tools hachette's multimedia encyclopedia electronic encyclopedia this product was using mozilla in 2004 but i’m not sure if new version still does hacketyhack little coders helma web application framework uses mozilla rhino holt mcdougal cd-roms educational cd-roms activit...
...tions houdini 3d animation tools uses gecko in embedded help viewer httpunit automated testing framework uses mozilla rhino htmlunit browser for java programs uses mozilla rhino hyperinfo web application plat form uses goeckofx ibm websphere lombardi edition business process management system uses mozilla rhino and mozilla xpcom eclipse plug-in.
... uox3 ultima online server-emulator uses mozilla spidermonkey verbosio xml editor no releases available verseminder bible passage app virgin media security security tools seems to use xulrunner virtualbox virtualization tool use xpcom as its component model on linux waterfox 64-bit variant of firefox based on firefox webissimo web browser based on xulrunner websecurify web application security testing environment wesabe money management tool automatic uploader is a xulrunner application that runs headless in xvfb wikipediaondvd and wikimedia by moulin off...
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
urce rpm (check bug 295329) ; patch: [root@b008-02 sources]# cat thunderbird-autoconfigandldap.patch diff -ur thunderbird-3.0/configure thunderbird-3.0.autoldap/configure --- thunderbird-3.0/configure 2009-06-29 11:37:21.677372297 +0200 +++ thunderbird-3.0.autoldap/configure 2009-06-29 14:41:11.547435040 +0200 @@ -12855,7 +12855,7 @@ moz_feeds=1 moz_jsdebugger=1 moz_jsloader=1 -moz_ldap_xpcom= +moz_ldap_xpcom=1 moz_mail_news= moz_mork=1 moz_morkreader= and set --enable-extensions=pref in mozconfig file, in fedora source rpm it is: [root@b008-02 sources]# grep enable-extensions /root/rpmbuild/sources/thunderbird-mozconfig ac_add_options --enable-extensions=pref it seems worse this time , as even after applying those compilation options mentioned above, i now get the following e...
...moz_ldap_xpcom=1 and moz_extensions_default="wallet spellcheck xmlextras pref webservices universalcharset auth" are now present in the default configure script.
...moz_ldap_xpcom=1).
...browser, moz_extensions_default="pref...") but not ldap (moz_ldap_xpcom=1).
What XULRunner Provides - Archive of obsolete content
the following features are either already implemented or planned: gecko features xpcom networking gecko rendering engine dom editing and transaction support (no ui) cryptography xbl (xbl2 planned) xul svg xslt xml extras (xmlhttprequest, domparser, etc.) web services (soap) auto-update support (not yet complete) type ahead find toolbar history implementation (the places implementation in the 1.9 cycle) accessibility support ipc services for communication between gecko-based apps (not yet complete) storage/sqlite interfaces user interface features the following user interface is supplied by xulr...
... extension manager file picker (uses native os filepicker as appropriate) find toolbar helper app dialog/ui security ui (maintenance of ssl keychains, etc) embedding apis the following embedding apis are provided by xulrunner: cross-platform embedding (xre_initembedding) javaxpcom embedding gtkmozembed (linux only) activex control (windows only) (not yet complete) obsolete since gecko 7.0 nsview-based-widget (mac os x only) (not yet complete) the "maybe" list the following features have been discussed and may be included if developer time permits and code size is controlled: ldap support spellchecking support (with or without dictionaries provided) see bug 2859...
...77 core support for profile roaming (with application-specific extensibility) pyxpcom embedding (not yet complete) - but it does work, if you compile a custom build that includes the pyxpcom bindings and there is a working python available.
... activestate uses pyxpcom in their products.
2006-09-06 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - oct 06-13, 2006 announcements none during this week.
... discussions windows gecko-sdk and g++ components discussion on the problems and possible solutions running cygwin/g++ compiled xpcom components with windows-based gecko-sdk/xulrunner dll/exes.
... threading in xpcom rules on threading in xpcom or to firefox extensions.
... how to build xpcom component on mac os x a tutorial on how to build xpcom component on mac os x firefox crashes when calling a function provided by a .so library a solution to the problem loading a shared library when using xpcom firefoxes crashes while getting url in xpcom solutions to resolve the problem of the firefox crash when trying to get the path and the prepath of the url of the current page in xpcom meetings none during this week.
2006-10-13 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - oct 13-20, 2006 announcements none during this week.
... discussions wxmozilla and ff1.5 xpcom problems updating wxmozilla to use it with firefox 1.5.7 browser elements, opening links in a new window using javascript to open window in new window.
... general xpcom and nscomptr questions nscomptr basics regarding myicomponent usage.
... fedora security blocking xpcom registration fedora core 5.0 security settings impeding xpcom registration.
Common causes of memory leaks in extensions - Extensions
if you put a reference to anything within this compartment into a long-lived window object (such as browser.xul), javascript module or xpcom component, the bootstrap.js compartment will become a zombie.
... services.obs.removeobserver(myobserver, "private-browsing"); } in javascript code modules it recommended to also observe the xpcom-shutdown or quit-application notifications and unregister your observers from that topic: var myobserver = { observe: function(subject, topic, data) { if (topic == "xpcom-shutdown") { services.obs.removeobserver(myobserver, "private-browsing"); services.obs.removeobserver(myobserver, "xpcom-shutdown"); } else { // do something with "private-browsing" } } }; ...
...services.obs.addobserver(myobserver, "private-browsing", false); services.obs.addobserver(myobserver, "xpcom-shutdown", false); finally, a lot of services other than nsiobserverservice accept nsiobserver parameters or other interfaces and will keep strong references around.
... other information also see using xpcom in javascript without leaking (though that page could use some updating).
Mozilla accessibility architecture
the shared code makes itself available to the toolkit-specific code via generic xpcom interfaces that return information about objects we want to expose.
...the toolkit-specific classes then use these xpcom interfaces to gather information about the objects they want to expose, make any necessary changes, and then expose the information using microsoft com on windows, or through gtk2's atk api's on linux and unix.
... directory purpose accessible/public common interfaces shared by all toolkits accessible/public/msaa custom com interfaces that we use to extend msaa's iaccessible accessible/public/atk internal xpcom atk interfaces accessible/src/base common implementations shared by html and xul implementations accessible/src/html/ document and html object implementations accessible/src/xul/ user interface and xul object implementations accessible/src/msaa/ windows implementations accessible/src/atk/ ...
... at program shutdown, when the nsaccessibilityservice observes ns_xpcom_shutdown_observer_id, it iterates through the doc accessibles in gglobaldocaccessiblecache and destroys all of the doc accessibles them.
Adding APIs to the navigator object
the object must be implemented as an xpcom component.
... each method below of adding new objects to the navigator object requires that the new object is a registered xpcom component.
... you can read about creating and registering xpcom components in javascript.
...you can learn more about contract ids are unique text identifiers for xpcom components.
Interface development guide
xpcom interfaces define classes that are implemented to provide key functionality in the mozilla platform.
... documentation xpidl the xpcom interface description language is used to specify xpcom interface classes.
... idl interface rules design guidelines and rules when creating and changing xpcom interfaces.
... mailing list newsgroup rss feed related topics javascript, xpcom, developing mozilla ...
Bundling multiple binary components
background binary xpcom components are sometimes required to implement low-level features for extensions.
...if the component uses only "frozen" xpcom interfaces, there is a good chance the same binary component will work with different versions of gecko (version 1.8 and 1.9, for example).
...the stub component is an xpcom component itself and when registered by xpcom, the code would sniff the runtime version and operating system then the stub load the appropriate "real" xpcom component for the current configuration.
... it's pretty simple to do and the concept can be used to load third-party shared libraries (dll, so, dylib) used in xpcom components.
Components.isSuccessCode
summary determines whether a given xpcom return code (that is, an nsresult value) indicates the success or failure of an operation, returning true or false respectively.
... description components.issuccesscode() may be used to determine whether an xpcom return code (an nsresult) indicates success or failure.
... an xpcom return code indicates success if its high-order bit is 0, and it indicates failure if its high-order bit is 1.
... note: a non-zero xpcom return code (that is, not ns_ok) does not necessarily indicate failure.
Development
source the latest source code is available on the mozilla trunk, in the extensions/java/xpcom directory.
... build instructions the build instructions are available here: building javaxpcom.
... bugs all javaxpcom bugs are tracked in bugzilla, using the "core" product and "java to xpcom bridge" component.
... list of open javaxpcom bugs open a new javaxpcom bug checkins within the last month ...
NS_GetMemoryManager
« xpcom api reference summary the ns_getmemorymanager function returns a reference to the xpcom memory manager.
... #include "nsxpcom.h" #include "nsimemory.h" nsresult ns_getmemorymanager( nsimemory** aresult ); parameters aresult [out] a reference to the xpcom memory manager.
... remarks the object returned is a singleton that is valid until ns_shutdownxpcom is called.
...any code, intended to be used exclusively with mozilla 1.8 and above, may use ns_alloc, ns_realloc, and ns_free instead to access the xpcom memory manager's methods.
NS_Realloc
« xpcom api reference summary reallocates a block of memory using the xpcom memory manager.
... #include "nsxpcom.h" void* ns_realloc( void* aptr, prsize asize ); parameters aptr [in] a pointer to the block of memory to reallocate.
... this pointer must have been previously allocated by the xpcom memory manager, or this parameter may be null in which case this function behaves like ns_alloc.
... remarks this function provides a convenient way to access the xpcom memory manager.
nsIDocShell
in nsidomstorage storage); void addstate(in nsivariant adata, in domstring atitle, in domstring aurl, in boolean areplace); void beginrestore(in nsicontentviewer viewer, in boolean top); void createaboutblankcontentviewer(in nsiprincipal aprincipal); void createloadinfo(out nsidocshellloadinfo loadinfo); void detacheditorfromwindow(); violates the xpcom interface guidelines void finishrestore(); void firepagehidenotification(in boolean isunload); native code only!
... violates the xpcom interface guidelines detacheditorfromwindow() disconnects this docshell's editor from its window, and stores the editor data in the open document's session history entry.
...resumerefreshuris() restart the xpcom timers for each meta-refresh uri in this docshell, and this docshell's children, recursively.
... suspendrefreshuris() cancel the xpcom timers for each meta-refresh uri in this docshell, and this docshell's children, recursively.
nsIErrorService
xpcom/base/nsierrorservice.idlscriptable this is a service that allows nsresult codes to be mapped to string bundles that can be used to look up error messages.
... inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/xpcom/error-service;1 method overview string geterrorstringbundle(in short errormodule); string geterrorstringbundlekey(in nsresult error); void registererrorstringbundle(in short errormodule, in string stringbundleurl); void registererrorstringbundlekey(in nsresult error, in string stringbundlekey); void unregistererrorstringbundle(in short errormodule); void unregistererrorstringbundlekey(in nsresult error); methods geterrorstringbundle() retrieves a string bundle url for an error module.
...should be one of the modules listed in xpcom/base/nserror.h, such as ns_error_module_storage.
...should be one of the modules listed in xpcom/base/nserror.h, such as ns_error_module_storage.
Building an Account Manager Extension
components.utils.import("resource://gre/modules/xpcomutils.jsm"); //class constructor function devmoaccountmanagerextension() {}; // class definition devmoaccountmanagerextension.prototype = { name : "devmo-account", chromepackagename : "example@mozilla.org", showpanel: function(server) { //this panel is only shown for imap accounts...
... if (server.type == \"imap\") return true; return false; }, queryinterface: xpcomutils.generateqi([ components.interfaces.nsimsgaccountmanagerextension ]) } step 2: building a component we convert the interface to a xpcom component and register it in the component manager as account manager extension.
...devmoaccountmanagerextension.prototype.contractid = "@mozilla.org/accountmanager/extension;1?name=example@mozilla.org"; // add the component to the mailnews-accountmanager-extensions category devmoaccountmanagerextension.prototype._xpcom_categories: [{ category: "mailnews-accountmanager-extensions" }], // create entry point for the module if (xpcomutils.generatensgetfactory) var nsgetfactory = xpcomutils.generatensgetfactory([devmoaccountmanagerextension]); else var nsgetmodule = xpcomutils.generatensgetmodule([devmoaccountmanagerextension]); step3: create the new panel as next step we create the xul and the property file...
... how to build an xpcom component in javascript ...
Setting HTTP request headers
(and yes, "http-on-modify-request" is a string.) note: there are many topics, besides just "http-on-modify-request", that you can get notifications about, for example "http-on-examine-response" and "xpcom-shutdown".
...xpcom components you need to register a single http-on-modify-request observer per application (and not one per window).
... this means that you should put the observer's implementation in an xpcom component instead of an overlay.
... if you want to support gecko2 (firefox4) you need to register your javascript component as described here: https://developer.mozilla.org/en/xpcom/xpcom_changes_in_gecko_2.0#javascript_components.
Using the clipboard
three xpcom objects are needed to handle clipboard operations.
...the clipboard model in mozilla requires you to perform the following steps to copy data: create an xpcom wrapper for the data which you want to put on the clipboard.
...first, we need to create an xpcom object to wrap what we want to copy.
...we need to convert the data back into a javascript string from an xpcom object.
Working with Multiple Versions of Interfaces
the problem in this short note we illustrate how one can update an xpcom module in order for it to work in both firefox 2 and firefox 3, even if the interfaces have changed in the interim.
...we build construct our xpcom component so that first tries to get the interface by it's new iid, then if that fails, attempts plan b.
...all the xpcom calls succeed, or at least think they succeed.
...getwindowhandle is the tenth method declared in the nsiaccessibledocument.h that firefox 2 was built with, but actually the eighth method in the sdk that i used to build my extension (and hence xpcom component).
Mozilla
creating javascript callbacks in components xpcom components use idl to create interfaces.
...this article will cover the basics of doing http connections from xpcom javascript, and should easily translate to c++ xpcom.
...unlike binary xpcom components, it allows developers to ship a single binary for use with multiple versions of firefox.
...the only remaining string classes are the "internal" ones, which are documented xpcom guide internal strings.
instanceof - JavaScript
note for mozilla developers: in code using xpcom, instanceof has special effect: obj instanceof xpcominterface (e.g.
... components.interfaces.nsifile) calls obj.queryinterface(xpcominterface) and returns true if queryinterface succeeded.
... a side effect of such call is that you can use xpcominterface's properties on obj after a successful instanceof test.
... unlike standard javascript globals, the test obj instanceof xpcominterface works as expected, even if obj is from a different scope.
Bookmarks - Archive of obsolete content
note that this example takes advantage of xpcomutils to generate the nsisupports.queryinterface() method.
...tion() {}, onitemadded: function(aitemid, afolder, aindex) {}, onitemremoved: function(aitemid, afolder, aindex) {}, onitemchanged: function(abookmarkid, aproperty, aisannotationproperty, avalue) { myextension.dosomething(); }, onitemvisited: function(abookmarkid, avisitid, time) {}, onitemmoved: function(aitemid, aoldparent, aoldindex, anewparent, anewindex) {}, queryinterface: xpcomutils.generateqi([components.interfaces.nsinavbookmarkobserver]) }; // an extension var myextension = { // this function is called when my add-on is loaded onload: function() { bmsvc.addobserver(myext_bookmarklistener, false); }, // this function is called when my add-on is unloaded onunload: function() { bmsvc.removeobserver(myext_bookmarklistener); }, dosomething: function(...
...) { alert("did something."); } }; see also nsinavbookmarksservice nsinavbookmarkobserver places using xpcom without chrome - bookmark observer ...
Finding window handles - Archive of obsolete content
this code can be used from external application or from an xpcom component within an extension.
...ow* like this: var gdkwindow = ctypes.structtype('gdkwindow'); var gdkwindowptrstring = basewindow.nativehandle; var gdkwinptr = gdkwindow.ptr(ctypes.uint64(gdkwindowptrstring)); working with gdkwindow* gdkwindow* to xid var gdkwindow = ctypes.structtype('gdkwindow'); var gdkdrawable = ctypes.structtype('gdkdrawable'); var card32 = /^(alpha|hppa|ia64|ppc64|s390|x86_64)-/.test(services.appinfo.xpcomabi) ?
...tring = basewindow.nativehandle; components.utils.import('resource://gre/modules/ctypes.jsm'); var gdk = ctypes.open('libgdk-x11-2.0.so.0'); var x11 = ctypes.open('libx11.so.6'); // types let guint32 = ctypes.uint32_t; let gdkwindow = ctypes.structtype('gdkwindow'); let gdkdrawable = ctypes.structtype('gdkdrawable'); let card32; if (/^(alpha|hppa|ia64|ppc64|s390|x86_64)-/.test(services.appinfo.xpcomabi)) { card32 = ctypes.unsigned_int; } else { card32 = ctypes.unsigned_long; } let xid = card32; //https://developer.gnome.org/gdk2/stable/gdk2-x-window-system-interaction.html#gdk-x11-drawable-get-xid var gdk_x11_drawable_get_xid = gdk.declare('gdk_x11_drawable_get_xid', ctypes.default_abi, xid, gdkdrawable.ptr); var browserwindow_madeintogdkwinptr = gdkwindow.ptr(ctypes.uint64(gdkwi...
How to convert an overlay extension to restartless - Archive of obsolete content
well, xul overlays and windows, jsm files, chrome & resource mappings with localization, default preferences, but no xpcom components of your own.
...you should still be caching a reference to your string bundle on add-on startup, preferably using xpcomutils.jsm to lazily load the file.
... for example: components.utils.import("resource://gre/modules/services.jsm"); components.utils.import("resource://gre/modules/xpcomutils.jsm"); xpcomutils.definelazygetter(this, "strings", function() { return loadpropertiesfile("chrome://myaddon/locale/mystrings.properties"); }); function loadpropertiesfile(path) { /* hack: the string bundle cache is cleared on addon shutdown, however it doesn't appear to do so reliably.
Install Manifests - Archive of obsolete content
it contains either the value of os_target alone or combined with target_xpcom_abi, separated by an underscore (_).
...if an extension includes the following then it must request unpacking: binary xpcom components plugins search plugins dlls loaded with ctypes dictionaries window icons examples <description about="urn:mozilla:install-manifest"> <em:id>extension@mysite.com</em:id> <em:unpack>true</em:unpack> ...
... %app_abi% the value of the target_xpcom_abi value from the firefox build system, identifying the compiler/architecture combination used to compile the current application.
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
these classes must now be created using xpcom: // nsisupportsarray is bad!
...(see xpcom:arrays.) nscomptr<nsisupportsarray> array; - rv = ns_newisupportsarray(getter_addrefs(array)); + array = do_createinstance(ns_supportsarray_contractid); - nscomptr<nsiinputstream> rawstream;- rv = ns_newbyteinputstream(getter_addrefs(rawstream),- (const char*)data, length); + nscomptr<nsistringinputstream> rawstream =+ do_createinstance(ns_stringinputstream_contractid, &rv);+ ns_ensure_success(rv, rv);++ rv = rawstream->setdata((const char*)data, length); ns_ensure_success(rv, rv); nsistringinputstream is not frozen (and thus, not available in the gecko sdk as currently published).
...; + pruint32 len = ns_strlen(str); - #include "nscrt.h" + #include "nsmemory.h" + #include "nscrtglue.h" prunichar* anotherstr = (prunichar*) ns_alloc(100 * sizeof(prunichar)); - prunichar *str = nscrt::strdup(anotherstr); - nscrt::free(str); + prunichar *str = ns_strdup(anotherstr); + ns_free(str); linking for information about the correct libraries to link to when using frozen linkage, see xpcom glue.
Handling Preferences - Archive of obsolete content
managing preferences with xpcom we use the preferences service in order to get and set preference values: this._prefservice = cc["@mozilla.org/preferences-service;1"].getservice(ci.nsiprefbranch); // ...
...if you are going to use xpcom, you should always set a default value to your preferences, or use a try / catch block to prevent unhandled errors.
... preference listeners the xpcom way to add a listener was mentioned in the xpcom section when describing the queryinterface method: this._prefservice.queryinterface(ci.nsiprefbranch2); this._prefservice.addobserver(prefname, this, false); this._prefservice.queryinterface(ci.nsiprefbranch); all the qi'ing is necessary because the addobserver method is in a different interface, and other than for adding and removing observers, we use the nsiprefbranch interface for everything related to preferences.
Installing plugins to Gecko embedding browsers on Windows - Archive of obsolete content
you also have the components value and value-data pair; this is for xpcom components.
...however, for netscape 6.1 and netscape 6.2, xpt files, as well as xpcom plugins, ought to go in the components directory.
... on these browsers, this is the only directory that can "pick up" an xpt file, as well the only directory that can recognize xpcom components.
BlackConnect - Archive of obsolete content
blackconnect was a blackwood subproject, trying to build a java-to-xpcom bridge to allow interoperability between java and xpcom components.
... the goal was to be able to implement xpcom components written in java instead of c++.
... blackconnect is now superseeded by javaxpcom.
Structure of an installable bundle - Archive of obsolete content
(>=2.0) /chrome.manifest chrome registration manifest (>=1.8) /components/* xpcom components (*.js, *.dll), and interface files from *.xpt (>=1.7) /defaults/preferences/*.js default preferences (>=1.7) /plugins/* npapi plugins (>=1.8) /chrome/icons/default/* window icons (>=1.8) /icon.png extension icon, for display in the add-ons manager, 32px × 32px (>=1.9.2) /icon64.png extension icon, for display i...
...the format of the platform string is: {os_target}_{target_xpcom_abi} all of the files which are loaded from the main extension directory are loaded from the subdirectory /platform/{platform string} if it exists.
...latform directory should have its own chrome.manifest file: chrome.manifest chrome/mytheme-base.jar platform/darwin/chrome.manifest platform/darwin/chrome/mytheme-mac.jar platform/winnt/chrome.manifest platform/winnt/chrome/mytheme-win.jar the app/extension loader processes the base directory first, followed by the applicable platform directories (first /{os_target}/, then /{os_target}_{target_xpcom_abi}/).
Drag and Drop JavaScript Wrapper - Archive of obsolete content
the javascript drag and drop wrapper the javascript wrapper to drag and drop simplifies the process by handling all of the xpcom interfaces for you.
...they handle the event, handle the xpcom interfaces and pass a simpler data structure to functions of the observer object.
...in some cases, you must provide the xpcom interface as well.
Embedding FAQ - Archive of obsolete content
here is the code : import org.eclipse.swt.swt; import org.eclipse.swt.browser.mozillabrowser; import org.eclipse.swt.browser.progressevent; import org.eclipse.swt.browser.progresslistener; import org.eclipse.swt.widgets.display; import org.eclipse.swt.widgets.shell; import org.mozilla.xpcom.nsidomdocument; public class test { public static void main(string args[]) { display display = new display(); shell shell = new shell(display); final mozillabrowser browser = new mozillabrowser(shell,wt.border); browser.seturl("http://www.google.com"); browser.addprogresslistener(new progresslistener() { ...
...c = browser.getdocument(); system.out.println(doc); } }); while (!shell.isdisposed()) { if (!display.readanddispatch()) { display.sleep(); } } } how to map a javascript function to a c++ function define an xpcom class defining the function you'll be doing in javascript.
... then pass the object to your xpcom coded object and call it from c++.
Java in Firefox Extensions - Archive of obsolete content
if you wish to call java code from within javascript code that implements some xpcom components, at this time, you need a different technique (refer to the complete java firefox extension).
... a good reason for calling java from within an xpcom component rather than from xul is to maintain a singleton (some singular java object) across all firefox windows.
... the following approach is taken from the extension xquseme (note you must use the latest version, currently still in the sandbox, as prior versions only worked with liveconnect before java 6 update 11) which borrows some of the code of the java firefox extension in order to grant full privileges to java within a firefox extension, but it is easier to understand and doesn't require creation of a xpcom component.
Styling a Tree - Archive of obsolete content
(we don't use getrowproperties() as the text color will not be inherited into each cell.) prior to gecko 22 the properties object that is passed as the last argument to the getcellproperties() is an xpcom object that implements nsisupportsarray.
... it is really just an xpcom version of an array.
...we create them using the xpcom interface nsiatomservice and add them to the array using the appendelement() function.
Using nsIXULAppInfo - Archive of obsolete content
getting nsixulappinfo to get a component implementing nsixulappinfo use this code: var appinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); (for explanation see this creating xpcom article.) getting application information after you obtained the app info component, you can read its properties to get the application's id, human-readable name, version, platform version, etc.
... example 1: checking firefox version // assuming we're running under firefox var appinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); var versionchecker = components.classes["@mozilla.org/xpcom/version-comparator;1"] .getservice(components.interfaces.nsiversioncomparator); if(versionchecker.compare(appinfo.version, "1.5") >= 0) { // running under firefox 1.5 or later } see nsiversioncomparator for details example 2: dealing with nightlies var appinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.in...
...see bug 809920, and in summary: // work around the fact that xpcshell doesn't have a proper app-info xpcom object.
Building XULRunner - Archive of obsolete content
by default, xulrunner is built with javaxpcom support; the build system must be able to find an appropriate jdk on the system; see the instructions on building javaxpcom for more details.
... if you do not want to build javaxpcom support, specify --disable-javaxpcom in your configuration.
... a basic minimal mozconfig which will build a release configuration of xulrunner is: mk_add_options moz_co_project=xulrunner mk_add_options moz_objdir=@topsrcdir@/obj-xulrunner ac_add_options --enable-application=xulrunner #uncomment the following line if you don't want to build javaxpcom: #ac_add_options --disable-javaxpcom cvs tags and xulrunner versions older xulrunner releases where tagged in cvs with (for instance xulrunner_1_8_0_5_release ) up to version 1.8.0.5 the cvs repository does not have specific tags for xulrunner anymore.
Chrome registration
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 value is taken from the nsixulruntime os and xpcomabi values (concatenated with an underscore).
... for example: binary-component component/mylib.dll abi=winnt_x86-msvc binary-component component/mylib.so abi=linux_x86-gcc3 see xpcom abi for more details.
Creating a Login Manager storage module
see how_to_build_an_xpcom_component_in_javascript for more details about javascript components.
... const cc = components.classes; const ci = components.interfaces; components.utils.import("resource://gre/modules/xpcomutils.jsm"); function sampleloginmanagerstorage() {} sampleloginmanagerstorage.prototype = { classdescription: "sample nsiloginmanagerstorage implementation", contractid: "@example.com/login-manager/storage/sample;1", classid: components.id("{364a118c-747a-4f6d-ac63-2d2998e5a5c1}"), queryinterface: xpcomutils.generateqi([ci.nsiloginmanagerstorage]), // this registers the category for overriding the built-in nsiloginmanagerstorage _xpcom_categories: [ { category: "login-manager-storage", entry: "nsiloginmanagerstorage" } ], // console logging service, used for debugging.
...uments); }, setloginsavingenabled: function slms_setloginsavingenabled(hostname, enabled) { this.stub(arguments); }, findlogins: function slms_findlogins(count, hostname, formsubmiturl, httprealm) { this.stub(arguments); }, countlogins: function slms_countlogins(ahostname, aformsubmiturl, ahttprealm) { this.stub(arguments); } }; function nsgetmodule(compmgr, filespec) xpcomutils.generatemodule([sampleloginmanagerstorage]); sample c++ implementation bug 309807 contains a complete example.
Creating Sandboxed HTTP Connections
this article will cover the basics of doing http connections from xpcom javascript, and should easily translate to c++ xpcom.
...nsiuri is an xpcom representation of an uri, with useful methods to query and manipulate the uri.
...ns_nointerface; } }, // nsiprogresseventsink (not implementing will cause annoying exceptions) onprogress : function (arequest, acontext, aprogress, aprogressmax) { }, onstatus : function (arequest, acontext, astatus, astatusarg) { }, // nsihttpeventsink (not implementing will cause annoying exceptions) onredirect : function (aoldchannel, anewchannel) { }, // we are faking an xpcom interface, so we need to implement qi queryinterface : function(aiid) { if (aiid.equals(components.interfaces.nsisupports) || aiid.equals(components.interfaces.nsiinterfacerequestor) || aiid.equals(components.interfaces.nsichanneleventsink) || aiid.equals(components.interfaces.nsiprogresseventsink) || aiid.equals(components.interfaces.nsihttpeventsink) || ...
Debugging on Windows
for xpcom strings (the "external" string api) you can use the following values: ;; mozilla (1.9) ; internal strings nsastring_internal=<mdata,su>, length=<mlength,u> nsacstring_internal=<mdata,s>, length=<mlength,u> ; xpcom strings nsastring=<nsstringcontainer.v,su>, length=<nsstringcontainer.d1,u> nsacstring=<nscstringcontainer.v,s>, length=<nscstringcontainer.d1,u> nsstringcontainer=<v,su>, length=<d1,u...
...this is how you would normally set it: set xpcom_debug_break=warn the environment variable takes also other values besides warn, see xpcom_debug_break for more details.
...then use xpcom_debug_break=warn changing running code you normally shouldn't need to do this (just quit the application, set the environment variable described above, and run it again).
Gecko SDK
the gecko sdk, also known as the xulrunner sdk, is a set of xpidl files, headers and tools to develop xpcom components which can then in turn e.g.
...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.
... contents of the sdk the sdk contains the following: 1.9.2 idl files for frozen interfaces (under idl/) header files for frozen interfaces, xpcom functions, and nspr functions (under include/) import libraries or shared libraries (under lib/) static utility libraries (under lib/) various tools (under bin/) for more information about safely linking xpcom components using the xpcom "glue" library, see xpcom glue.
Manipulating bookmarks using Places
note that this example takes advantage of xpcomutils to generate the nsisupports.queryinterface() method.
...tion() {}, onitemadded: function(aitemid, afolder, aindex) {}, onitemremoved: function(aitemid, afolder, aindex) {}, onitemchanged: function(abookmarkid, aproperty, aisannotationproperty, avalue) { myextension.dosomething(); }, onitemvisited: function(abookmarkid, avisitid, time) {}, onitemmoved: function(aitemid, aoldparent, aoldindex, anewparent, anewindex) {}, queryinterface: xpcomutils.generateqi([components.interfaces.nsinavbookmarkobserver]) }; // an extension var myextension = { // this function is called when my add-on is loaded onload: function() { bmsvc.addobserver(myext_bookmarklistener, false); }, // this function is called when my add-on is unloaded onunload: function() { bmsvc.removeobserver(myext_bookmarklistener); }, dosomething: function(...
...) { alert("did something."); } }; see also nsinavbookmarksservice nsinavbookmarkobserver places using xpcom without chrome - bookmark observer ...
FUEL
fuel is about making it easier for extension developers to be productive, by minimizing some of the xpcom formality and adding some "modern" javascript ideas.
... objects extiapplication objects extiapplication exticonsole extieventitem extieventlistener extievents extiextension extiextensions extipreference extipreferencebranch extisessionstorage fueliapplication objects fueliannotations fueliapplication fuelibookmark fuelibookmarkfolder fuelibookmarkroots fuelibrowsertab fueliwindow xpcom although the fuel application object is preloaded into xul scripts, it is not preloaded into javascript xpcom code.
... the object needs to be accessed like any other xpcom service: var application = components.classes["@mozilla.org/fuel/application;1"].getservice(components.interfaces.fueliapplication); ...
SMILE
smile is about making it easier for extension developers to be productive, by minimizing some of the xpcom formality and adding some "modern" javascript ideas.
... objects extiapplication objects exticonsole extieventitem extieventlistener extievents extiextension extiextensions extipreference extipreferencebranch extisessionstorage smileiapplication objects smileibookmarkroots smileiwindow smileibrowsertab smileiapplication xpcom although the extiapplication object is preloaded into xul scripts, it is not preloaded into javascript xpcom code.
... the object needs to be accessed like any other xpcom service: var application = components.classes["@mozilla.org/smile/application;1"].getservice(components.interfaces.smileiapplication); ...
extIApplication
implemented via xpcom service for extiapplication: see the instructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages.
... xpcom although the application object is preloaded into xul scripts, it is not preloaded into javascript xpcom code.
... the object needs to be accessed like any other xpcom service: var application = components.classes["@mozilla.org/fuel/application;1"].getservice(components.interfaces.fueliapplication); see also fuel (firefox), steel (thunderbird) and smile (seamonkey) ...
Binary compatibility
when you see a @status frozen, note that this means it should work as long as the component and xpcom are built with the same compiler abi.
... for more information on issues of componentization and binary compatibility, see http://mozilla.org/projects/xpcom/gl...ent_reuse.html .
... comments and questions should be directed to the newsgroup, mozilla.dev.tech.xpcom, or the mailing list, mozilla-xpcom@mozilla.org.
Generic factory
in xpcom, a generic factory is a factory created using the facilities in xpcom/glue/nsigenericfactory.h.
... summary most xpcom factories can be very simple.
...ifactory* newcomponentfactory(nsirepository* repository) { nsigenericfactory* factory = null; nscid kgenericfactorycid = ns_genericfactory_cid; nsresult res = repository->createinstance(kgenericfactorycid, null, nsigenericfactory::iid(), &factory); if (res == ns_ok) { factory->setconstructor(&mycomponent::create); } return factory; } this example assumes that the xpcom repository is available as an interface (which it soon will be).
Components.returnCode
components.returncode is a property which can hold an xpcom return code additionally to the value returned by the return statement.
... usage components.returncode is a property that can be used to indicate to an xpcom caller of the javascript method that the method is returning a specific nsresult code.
...however, there are a very few xpcom interfaces that specify success code return values.
Components.utils.forceGC
this mechanism doesn't account for any native (c++) xpcom objects hanging off javascript objects though.
... in many cases a javascript application will have internal knowledge of javascript objects referencing large (trees of) xpcom objects and know when they are no longer reachable.
...this will make sure that xpcom components that build cycles with javascript objects also get collected which might be important, for example for testcases that depend on the garbage collector.
Components.utils.import
for example, you can import xpcomutils.jsm to avoid copy/pasting long xpcom component registration boilerplate in your component files.
... example components.utils.import("resource://gre/modules/xpcomutils.jsm", this); difference from mozijssubscriptloader the differences from mozijssubscriptloader: the behavior when importing/loading the same code from different locations: the subscript loader evaluates the specified code each time it is invoked, with the caller's global object.
... for example: var scope1 = {}, scope2 = {}; components.utils.import("resource://gre/modules/json.jsm", scope1); components.utils.import("resource://gre/modules/json.jsm", scope2); assert(scope2.xpcomutils === scope1.xpcomutils); ...returns true, whereas: var someurl = "resource://gre/modules/json.jsm"; var obj1 = {}, obj2 = {}; var loader = components.classes["@mozilla.org/moz/jssubscript-loader;1"] .getservice(components.interfaces.mozijssubscriptloader); loader.loadsubscript(someurl, obj1); loader.loadsubscript(someurl, obj2); assert(obj2 === obj1); ...returns false.
Community
if you know of useful mailing lists, newsgroups, forums, or other communities related to pyxpcom, please link to them here.
... activestate python xpcom bindings mailing list discussion of the bindings between the python language and the xpcom (cross-platform com) technology from the mozilla project.
... #pyxpcom on irc.mozilla.org chat with other pyxpcom developers on mozilla's irc network.
nsDirectoryService
« xpcom api reference summary the xpcom directory service.
... class id f00152d0-b40b-11d3-8c9c-000064657374 contractid @mozilla.org/file/directory_service;1 supported interfaces nsiproperties nsidirectoryservice remarks this component is a singleton and should therefore be accessed via the xpcom service manager.
... example code #include "nsxpcom.h" #include "nscomptr.h" #include "nsdirectoryservicedefs.h" #include "nsiservicemanager.h" #include "nsiproperties.h" /** * get the location of the system's "temp" directory.
NS_Alloc
« xpcom api reference summary infallibly allocates a block of memory using the xpcom memory manager.
... #include "nsxpcom.h" void* ns_alloc( prsize asize ); parameters asize [in] the size in bytes of the block to allocate.
...remarks this function provides a convenient way to access the xpcom memory manager.
NS_Free
« xpcom api reference summary frees a block of memory using the xpcom memory manager.
... #include "nsxpcom.h" void ns_free( void* aptr ); parameters aptr [in] a pointer to the block of memory to free.
... remarks this function provides a convenient way to access the xpcom memory manager.
NS_GetComponentManager
« xpcom api reference summary the ns_getcomponentmanager function returns a reference to the xpcom component manager.
... #include "nsxpcom.h" #include "nsicomponentmanager.h" nsresult ns_getcomponentmanager( nsicomponentmanager** aresult ); parameters aresult [out] a reference to the xpcom component manager.
... remarks the object returned is a singleton that is valid until ns_shutdownxpcom is called.
NS_GetComponentRegistrar
« xpcom api reference summary the ns_getcomponentregistrar function returns a reference to the xpcom component registrar.
... #include "nsxpcom.h" #include "nsicomponentregistrar.h" nsresult ns_getcomponentregistrar( nsicomponentmanager** aresult ); parameters aresult [out] a reference to the xpcom component registrar.
...remarks the object returned is a singleton that is valid until ns_shutdownxpcom is called.
NS_GetServiceManager
« xpcom api reference summary the ns_getservicemanager function returns a reference to the xpcom service manager.
... #include "nsxpcom.h" #include "nsiservicemanager.h" nsresult ns_getservicemanager( nsiservicemanager** aresult ); parameters aresult [out] a reference to the xpcom service manager.
... remarks the object returned is a singleton that is valid until ns_shutdownxpcom is called.
nsCOMPtr
« xpcom api reference summary this utility class simplifies managing xpcom interface references from c++ code.
...to use this class, you must link your component or application against the xpcom glue library.
... the class itself and the supporting functions that are used with it are not frozen, but they are available as part of the xpcom glue library for easy reuse.
nsIDebug
xpcom/base/nsidebug.idlscriptable provides debugging support for scripted languages, such as javascript, java, python, perl, and so forth.
... inherits from: nsisupports last changed in gecko 1.7 note: c/c++ consumers who are planning to use the nsidebug interface with the @mozilla.org/xpcom;1 contract should use ns_debugbreak() from xpcom glue instead, or alternatively the ns_abort, ns_assertion, ns_break, and ns_warning macros, which also call ns_debugbreak() if used in a debugging build.
... assertion() shows an assertion and triggers optional behavior based on the xpcom_debug_break environment variable, defaulting to calling break() on windows and os/2 and warning on other platforms.
nsIModule
xpcom/components/nsimodule.idlscriptable this interface must be implemented by each xpcom component.
... it is the main entry point by which the system accesses an xpcom component.
..., [retval, iid_is(aiid)] out nsqiresult aresult); void registerself(in nsicomponentmanager acompmgr, in nsifile alocation, in string aloaderstr, in string atype); void unregisterself(in nsicomponentmanager acompmgr, in nsifile alocation, in string aloaderstr); methods canunload() this method may be queried to determine whether or not the component module can be unloaded by xpcom.
nsISecurityCheckedComponent
caps/idl/nsisecuritycheckedcomponent.idlscriptable provides methods that let an xpcom component define custom rules for accessing it from potentially unprivileged code.
... two examples: code that has the "universalxpconnect" capability is allowed to access all of xpcom.
... this includes creating instances of arbitrary xpcom objects and calling methods and setting properties on them.
nsISupports
xpcom/base/nsisupports.idlscriptable all xpcom interfaces inherit this interface.
... last changed in gecko 1.0 method overview nsrefcnt addref();violates the xpcom interface guidelines void queryinterface(in nsiidref uuid, [iid_is(uuid),retval] out nsqiresult result); nsrefcnt release();violates the xpcom interface guidelines methods violates the xpcom interface guidelines addref() notifies the object that an interface pointer has been duplicated.
... violates the xpcom interface guidelines release() notifies the object that an interface pointer has been destroyed and any resources the object held on behalf of the client can be released.
nsITaskbarTabPreview
method overview void ensureregistration(); violates the xpcom interface guidelines nativewindow gethwnd(); violates the xpcom interface guidelines void move(in nsitaskbartabpreview anext); attributes attribute type description icon imgicontainer the icon displayed next to the title in the preview.
... methods violates the xpcom interface guidelines ensureregistration() used internally to ensure that the taskbar knows about this preview.
... violates the xpcom interface guidelines gethwnd() used internally to obtain the handle to the proxy window for the preview.
nsIVersionComparator
xpcom/base/nsiversioncomparator.idlscriptable this interface is used to compare version strings.
...1.0pre1 < 1.0pre2 < 1.0 == 1.0.0 == 1.0.0.0 < 1.1pre == 1.1pre0 == 1.0+ < 1.1pre1a < 1.1pre1 < 1.1pre10a < 1.1pre10 implemented by: @mozilla.org/xpcom/version-comparator;1.
... the service can be accessed directly via services.vc after loading services.jsm or with the following code: var versioncomparator = components.classes["@mozilla.org/xpcom/version-comparator;1"] .getservice(components.interfaces.nsiversioncomparator); method overview long compare(in acstring a, in acstring b); methods compare() compare two version strings.
nsIXULRuntime
xpcom/system/nsixulruntime.idlscriptable provides information about the xul runtime to allow extensions and xul applications to determine information about the xul runtime.
... xpcomabi autf8string a string tag identifying the binary abi of the current processor and compiler vtable.
... this is taken from the target_xpcom_abi configure variable.
Frequently Asked Questions
comparing an nscomptr to a raw xpcom interface pointer declaring an nscomptr to a forward-declared class not linking to xpcom not including nscomptr.h different settings of nscap_feature_debug_ptr_types runtime errors ns_assertion "queryinterface needed" may be caused by a class that derives from a given interface, when you forgetting to also specify the interface name in the ns_impl_isupports / ns_impl_threadsafe_isupports m...
... call a getter that uses a raw xpcom interface pointer as an `in/out' parameter?
... any xpcom function that returns an interface pointer, i.e., a `getter', must have already addrefed that pointer.
xpidl
MozillaTechXPIDLxpidl
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.
...the xpidl compiler is now part of the build process, allowing us to generate headers used by the xpcom components.
Mozilla technologies
the module is structured as a drop-in component and exposes its xml-as-data features both 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.
... it has multiple language bindings, allowing xpcom components to be used and implemented in javascript, java, and python in addition to c++.xpidlxpidl is an interface description language used to specify xpcom interface classes.xray visiongecko runs javascript from a variety of different sources and at a variety of different privilege levels.xslt 2.0although xslt 2.0 is not natively supported in firefox, it is possible via saxon-b (java) or, more recently, saxon-ce (javascript) to perform xslt 2.0.xtfthe extensible tag framework (xtf) allows adding support for new namespaces using xpcom components to mozilla (written in javascript or c++).
Private Properties - Archive of obsolete content
namespaces in the add-on sdk the add-on sdk is built on top of xpcom, the interface between javascript and c++ code.
... since xpcom allows the user to do virtually anything, security is very important.
SDK and XUL Comparison - Archive of obsolete content
xpcom traditional add-ons have access to a vast amount of firefox functionality via xpcom.
...if you need more flexibility than the sdk's high-level apis provide, you can use its low-level apis to load xpcom objects directly or to manipulate the dom directly as in a traditional bootstrapped extension.
Creating Reusable Modules - Archive of obsolete content
for both these operations we'll use xpcom interfaces.
... } return path; } hash function firefox has built-in support for hash functions, exposed via the nsicryptohash xpcom interface the documentation page for that interface includes an example of calculating an md5 hash of a file's contents, given its path.
File I/O - Archive of obsolete content
you access the file system using mozilla xpcom components.
... look in the source for other strings available: xpcom/io/nsappdirectoryservicedefs.h, xpcom/io/nsdirectoryservicedefs.h.
JavaScript Debugger Service - Archive of obsolete content
in firefox versions prior to gecko 33 (firefox 33 / thunderbird 33 / seamonkey 2.30), the javascript debugger service (or simply jsd) used to be an xpcom component that allows the tracking of javascript while it was being executed in the browser.
... snippets acquiring the service we acquire the service by calling the xpcom object.
Progress Listeners - Archive of obsolete content
example create an object which implements nsiwebprogresslistener: const state_start = ci.nsiwebprogresslistener.state_start; const state_stop = ci.nsiwebprogresslistener.state_stop; var mylistener = { queryinterface: xpcomutils.generateqi(["nsiwebprogresslistener", "nsisupportsweakreference"]), onstatechange: function(awebprogress, arequest, aflag, astatus) { // if you use mylistener for more than one tab/window, use // awebprogress.domwindow to obtain the tab/window which triggers the state change if (aflag & state_start) { // this...
... alert(auri.spec); this.oldurl = auri.spec; }, // nsiwebprogresslistener queryinterface: xpcomutils.generateqi(["nsiwebprogresslistener", "nsisupportsweakreference"]), onlocationchange: function(aprogress, arequest, auri) { this.processnewurl(auri); }, onstatechange: function() {}, onprogresschange: function() {}, onstatuschange: function() {}, onsecuritychange: function() {} }; window.addeventlistener("load", fu...
Code snippets - Archive of obsolete content
xml file i/o code used to read, write and process files drag & drop code used to setup and handle drag and drop events dialogs code used to display and process dialog boxes alerts and notifications modal and non-modal ways to notify users preferences code used to read, write, and modify preferences js xpcom code used to define and call xpcom components in javascript running applications code used to run other applications <canvas> related what wg canvas-related code signing a xpi how to sign an xpi with pki delayed execution performing background operations.
... using the windows registry with xpcom how to read, write, modify, delete, enumerate, and watch registry keys and values.
Enhanced Extension Installation - Archive of obsolete content
finalization for themes, the item is immediately installed fully, rather than awaiting the next restart, since themes do not supply xpcom components, preferences defaults etc.
... the startup process receives this "needsrestart" bit when the extension manager's startup completes, shuts down xpcom and relaunches the application.
Extension Etiquette - Archive of obsolete content
xpcom contract ids, which are often registered in chrome.manifest files.
...xpcom contract ids, for instance, should always begin with an @, followed by a domain name that the author controls, e.g., "@example.com/foo/bar;1" it is important that the prefix that you use be unlikely to conflict with other code, and that it be indicative of the name of your add-on.
Firefox addons developer guide - Archive of obsolete content
the firefox add-ons developer guide was contributed by the mozilla japan community; it covers how to go about building firefox extensions using xpcom and xul.
... next » introduction to extensions technologies used in developing extensions introduction to xul—how to build a more intuitive ui using xpcom—implementing advanced processes let's build a firefox extension firefox extensions and xul applications license and authors next » ...
Tabbed browser - Archive of obsolete content
xul: <menuitem oncommand="myextension.foo(event)" onclick="checkformiddleclick(this, event)" label="click me"/> js: var myextension = { foo: function(event) { openuilink("http://www.example.com", event, false, true); } } opening a url in an on demand tab cu.import("resource://gre/modules/xpcomutils.jsm"); xpcomutils.definelazyservicegetter(this, "gsessionstore", "@mozilla.org/browser/sessionstore;1", "nsisessionstore"); // create new tab, but don't load the content.
... note that some http requests aren't associated with a tab; for example, rss feed updates, extension manager requests, xhr requests from xpcom components, etc.
Building TransforMiiX standalone - Archive of obsolete content
add tx_exe=1 mk_add_options build_modules="xpcom transformiix" ac_add_options --enable-standalone-modules="xpcom transformiix" to your .mozconfig, and use client.mk to pull as usual.
... this will pull the necessary subtree with mozilla/client.mk mozilla/build/unix/modules.mk mozilla/build mozilla/config mozilla/expat mozilla/extensions/transformiix mozilla/include mozilla/allmakefiles.sh mozilla/client.mk mozilla/aclocal.m4 mozilla/configure mozilla/configure.in mozilla/makefile.in plus nspr and xpcom from the cvs repository.
Drag and Drop - Archive of obsolete content
this first involves using the drag and drop xpcom interfaces directly.
... xpcom drag and drop interfaces two interfaces are used to support drag and drop.
PyDOM - Archive of obsolete content
globals and namespaces this is taken from a mail to the pyxpcom list - it should be expanded, but a copy-paste will do for now normal module semantics don't exist here.
...related topics pyxpcom: create and use xpcom components with python python-spidermonkey pydom samples: sample applications that use pydom pythonext: a firefox/xulrunner extension that can be used to install pydom ...
Mac stub installer - Archive of obsolete content
to do this, in addition to the above steps to set up the mac installer to debug you will need to do the following: create a file named xpcom.xpi with the shared libraries in the structure described under the [xpcom] section in: <http://lxr.mozilla.org/seamonkey/sou...ackages-mac#33> note that if you are using the debug target of the installer binary all shared libraries are expected to have the name format <libname>debug.shlb now set a break point at xpi_init() in the mac installer code and step into xpistub and eventually the xpins...
...for example, see the xpcom section that lists all the shared libraries as seen in dist.
Unix stub installer - Archive of obsolete content
now you will find an installer *and* the xpcom.xpi and other debug xpis delivered to mozilla/installer/raw.
...for example, see the xpcom section that lists all the shared libraries as seen in dist.
Windows stub installer - Archive of obsolete content
now you will find an installer *and* the xpcom.xpi and other debug xpis delivered to mozilla/dist/win32_d.obj/install.
...for example, see the xpcom section that lists all the shared libraries as seen in dist.
Accessing Files - Archive of obsolete content
there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome!
... components the components directory where xpcom components are installed.
stringbundle - Archive of obsolete content
eight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties applocale obsolete since gecko 1.9.1 type: nsilocale returns the xpcom object which holds information about the user's locale.
... stringbundle type: nsistringbundle returns the xpcom string bundle object which implements nsistringbundle.
Dialogs in XULRunner - Archive of obsolete content
the xul filepickers are xpcom components and must be instantiated before using, like this: function dofileopen() { /* see: http://developer.mozilla.org/en/docs/xul_tutorial:open_and_save_dialogs */ var nsifilepicker = components.interfaces.nsifilepicker; var fp = components.classes["@mozilla.org/filepicker;1"].createinstance(nsifilepicker); fp.init(window, "open file", nsifilepicker.modeopen); fp.appendfilters(ns...
... future articles in this series will look at input controls, printing, the clipboard, and xpcom.
Getting started with XULRunner - Archive of obsolete content
since we are not creating any binary xpcom components, we only need to download and install the xulrunner runtime package, not the sdk.
... note: in xulrunner 2.0, the chrome.manifest is now used to register xpcom components in addition to its previous uses.
Make your xulrunner app match the system locale - Archive of obsolete content
this article is going to assume a lot of knowledge of xpcom and will be written for someone using python, but the ideas should be adaptable.
... from xpcom import components ps_cls = components.classes["@mozilla.org/preferences-service;1"] ps = ps_cls.getservice(components.interfaces.nsiprefservice) branch = ps.getbranch("general.useragent.") branch.setcharpref("locale", lang) i also set the language environment variable to match the system locale so that python's gettext functionality will work (it pulls straight from language instead of using set...
2006-09-22 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - sept 22-29, 2006 announcements none during this week.
...xpcom discussion of the limitation and merits of java in place of xpcom.
2006-09-30 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - sept 30- oct 5, 2006 announcements build a xpcom component on mac os x benjamin smedberg confirmed that this tutorial http://www.iosart.com/firefox/xpcom/ is misleading as it uses the standalone glue (-dxpcom_glue) for components, which is not recommended.
... developers should use this sample instead: http://developer.mozilla.org/en/docs/xpcom_glue discussions dynamic load overlay a short discussion about the possibilities of loading and unloading xul overlay runtime reading binary data from file discusses about the code to read binary data from file how to build xpcom component on mac os x discusses about the make file code used to build xpcom components on mac os x successfully meetings none during this week.
2006-11-24 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - nov 18-nov 24, 2006 announcements none during this week.
... discussions tutorials: non c++ bindings for xpcom tutorials on how to interface with firefox using xpcom on a similar basis to how a developer can with internet explorer through it's com interface tutorals and references related to extension development tutorials on developing extensions which use the third party libraries for firefox references to mozilla api exposed javascript component + xmldocument not accessible a discussion on error: uncaught exception: permission denied to get property xmldocument.textcontent creating xpcom components a good discussion about "components.classes[cid] has no properties" error firefox http explanation about how firefox handles the http aspect meetings none during this week.
2006-11-3 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - oct 28-nov 3, 2006 announcements none during this week.
... discussions problem linking libraries to xpcom component a discussion involving a problem with linking third party library to xpcom component.
2006-12-08 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - dec 02- dec 08, 2006 announcements none during this week.
... discussions xpcom cpp to js callback engaging discussion on a problem with trying to call back from c++ to a javascript object using an interface the developer created with an idl.
XForms Custom Controls - Archive of obsolete content
xpcom knowledge will certainly not hurt.
...to get started, you really only need to know the language where you'd like to use xforms (like xhtml or xul), some xbl and javascript, and the xpcom interfaces we are exposing for your use.
XQuery - Archive of obsolete content
however, use of the approach of the java firefox extension might be used to turn the above extension concept into an xpcom component (giving it access to all open windows), and for berkeley db xml, possibly implementing it in c++ instead, which is that database's original language of development.
... however, the extension demonstrates a technique which does not depend on using xpcom, while still giving full privileges.
XUL Parser in Python - Archive of obsolete content
the first level of support for python in mozilla will apparently be for python modules made available as xpcom objects.
... extending on the approach in this script, then, you could imagine a kind of introspective xul chrome that could modify and replicate itself by calling services from the xulparser and xulwriter xpcom objects.
Archive of obsolete content
newsgroup summaries obsolete: xpcom-based scripting for npapi plugins plugins that used to take advantage of being scriptable via liveconnect in 4.x netscape browsers lost this possibility in the new world.
...the new mozilla xpcom architecture allows xpcom components be scriptable via a different mechanism called xpconnect.
Gecko FAQ - Gecko Redirect 1
gecko is reusable on all platforms thanks to xpcom, a subset of com that works across platforms.
... additionally, on the windows platform, gecko's xpcom interfaces are wrapped in an activex control that vb developers can utilize (activex wrappers are not available on other platforms because activex is a windows-only technology).
About Scriptable Interfaces - Interfaces
most of the information of this document is based on http://www.mozilla.org/scriptable/ and creating xpcom components scriptable interfaces interfaces allow xpcom components to expose their functionality to the outside world while hiding the inner details of the component implementation.
... python there's an extension extensions/python that bridges the gap between xpcom and python, allowing scriptable interfaces to be used/implemented from/in python scripts.
Makefile - variables
extra_components nsdefaultclh.manifest, javascript xpcomm files extra_dso_libs extra_dso_ldopts extra_js_modules extra_pp_components xpcomm files to pre-process before installation.
... todo: xpcom/xpinstall variables: https://developer.mozilla.org/en/adding_xpcom_components_to_mozilla_build_system ...
How Mozilla's build system works
non-component shared libraries include libraries such as libxpcom and libmozjs.
... non-component shared libraries a non-component shared library is useful when there is common code that several components need to share and sharing it through xpcom is not appropriate or not possible.
Error codes returned by Mozilla APIs
javascript errors these errors typically occur when interfacing between javascript and native code, or to xpcom components.
...40002) ns_error_schemavalidator_no_type_found (0x80640003) ns_error_schemavalidator_type_not_found (0x80640004) note: there are other errors in these files: gfx/public/nsidevicecontext.h base/public/nsneterror.h parser/htmlparser/public/nsiparser.h layout/base/nslayouterrors.h profile/public/nsiprofileinternal.idl security/manager/ssl/public/nsicmsmessageerrors.idl directory/xpcom/base/public/nsildaperrors.idl content/base/public/nscontenterrors.h see also mozilla error lookup lets you quickly look up the error name by its code in different formats.
Roll your own browser: An embedding how-to
somewhere during the start of your application, you must initialize xpcom.
...the apath parameter will be passed to ns_initxpcom.
Sqlite.jsm
sqlite.jsm offers some compelling advantages over the low-level storage xpcom interfaces: automatic statement management.
...the complexities of xpcom are mostly hidden from view.
JavaScript code modules
ctypes.jsm provides an interface that allows javascript code to call native libraries without requiring the development of an xpcom component.
... xpcomutils.jsm contains utilities for javascript components loaded by the js component loader.
DMD
for example: reported at { #01: mozilla::dmd::report(void const*) (/home/njn/moz/mi2/memory/replace/dmd/dmd.cpp:1740) 0x7f68652581ca #02: cyclecollectormallocsizeof(void const*) (/home/njn/moz/mi2/xpcom/base/nscyclecollector.cpp:3008) 0x7f6860fdfe02 #03: nspurplebuffer::sizeofexcludingthis(unsigned long (*)(void const*)) const (/home/njn/moz/mi2/xpcom/base/nscyclecollector.cpp:933) 0x7f6860fdb7af #04: nscyclecollector::sizeofincludingthis(unsigned long (*)(void const*), unsigned long*, unsigned long*, unsigned long*, unsigned long*, unsigned long*) const (/home/njn/moz/mi2/xpcom/base/nscycle...
...collector.cpp:3029) 0x7f6860fdb6b1 #05: cyclecollectormultireporter::collectreports(nsimemorymultireportercallback*, nsisupports*) (/home/njn/moz/mi2/xpcom/base/nscyclecollector.cpp:3075) 0x7f6860fde432 #06: nsmemoryinfodumper::dumpmemoryreportstofileimpl(nsastring_internal const&) (/home/njn/moz/mi2/xpcom/base/nsmemoryinfodumper.cpp:626) 0x7f6860fece79 #07: nsmemoryinfodumper::dumpmemoryreportstofile(nsastring_internal const&, bool, bool) (/home/njn/moz/mi2/xpcom/base/nsmemoryinfodumper.cpp:344) 0x7f6860febaf9 #08: mozilla::(anonymous namespace)::dumpmemoryreportsrunnable::run() (/home/njn/moz/mi2/xpcom/base/nsmemoryinfodumper.cpp:58) 0x7f6860fefe03 } you can tell which memory reporter made the report by the name of the mallocsizeof function near the top of the stack trace.
Leak-hunting strategies and tips
xpconnect allows an xpcom object to be exposed to javascript, and it allows certain javascript objects to be exposed to c++ code as normal xpcom objects.
...this is the wrapper object in the reverse direction -- when a js object is used to implement an xpcom interface and be used transparently by native code.
AsyncTestUtils extended framework
xpcomhdrarray [getter] return an nsimutablearray of the message headers that have been injected into folders.
... folderswithxpcomhdrarrays [getter] same as folderswithmsghdrs but the second element in each sub-list is an nsimutablearray instead of a js list.
STEEL
objects extiapplication objects extiapplication exticonsole extieventitem extieventlistener extievents extiextension extiextensions extipreference extipreferencebranch extisessionstorage steeliapplication objects steeliapplication xpcom although the steel steeliapplication object is preloaded into xul scripts, it is not preloaded into javascript xpcom code.
... the object needs to be accessed like any other xpcom service: var application = components.classes["@mozilla.org/steel/application;1"].getservice(components.interfaces.steeliapplication); other resources steel development plan.
Aggregating the In-Memory Datasource
introduction you can use xpcom aggregation1 with the in-memory datasource.
... notes describing all of the vagaries of xpcom aggregation is beyond the scope of this document.
Generating GUIDs
guids are used in mozilla programming for identifying several types of entities, including xpcom interfaces (this type of guids is callled iid), components (cid), and legacy add-ons—like extensions and themes—that were created prior to firefox 1.5.
... com/xpcom format when #define-ing iids and cids in mozilla c++ code, you generally use the following format: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx #define ns_...id \ { 0xxxxxxxxx, 0xxxxx, 0xxxxx, \ { 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx } } you can generate code in this format using one of the following tools.
Packaging WebLock
the installation script for the weblock component can also be used to register the component with the browser into which it is installed (see registration methods in xpcom for more information on registration).
...have to register component here or with regxpcom?
Making cross-thread calls using runnables
typically, thread activities are triggered and managed using an xpcom event-passing framework that uses the nsirunnable interface.
...llback(callback) , mdigits(digits) { } ns_imethod run() { nscstring result; calculatepi(mdigits, result); nscomptr<nsirunnable> resultrunnable = new piresulttask(mcallback, result); ns_dispatchtomainthread(resultrunnable); } private: picallback mcallback; int mdigits; }; putting it all together to start a new thread, create it using the thread manager: #include "nsxpcomcidinternal.h" void calculatepiasynchronously(int digits, picallback callback) { // to create a new thread, get the thread manager nscomptr<nsithreadmanager> tm = do_getservice(ns_threadmanager_contractid); nscomptr<nsithread> mythread; nsresult rv = tm->newthread(0, 0, getter_addrefs(mythread)); if (ns_failed(rv)) { // in case of failure, call back immediately with an empty string ...
Components.Exception
these exception objects may be thrown when implementing xpcom interfaces in javascript, and they can provide better diagnostics in the error console if not caught than simply throwing an nsresult's value will.
... syntax var exception = [ new ] components.exception([ message [, result [, stack [, data ] ] ] ]); parameters message a string which can be displayed in the error console when your exception is thrown or in other developer-facing locations, defaulting to 'exception' result the nsresult value of the exception, which defaults to components.results.ns_error_failure stack an xpcom stack to be set on the exception (defaulting to the current stack chain) data any additional data you might want to store, defaulting to null example throw components.exception("i am throwing an exception from a javascript xpcom component."); ...
Components.classes
each object represents one of the classes of xpcom components that can be constructed or accessed as an xpcom service.
... a new xpcom component instance can be created from the returned class object as follows: var obj = components.classes["@mozilla.org/supports-array;1"] .createinstance(components.interfaces.nsisupportsarray); which is a shortcut to var obj = components.classes["@mozilla.org/supports-array;1"] .createinstance(); obj.queryinterface(components.interfaces.nsisupportsarr...
Components.interfaces
each object represents one of the xpcom interfaces -- that some component or another might or might not implement.
... properties of the components.interfaces object are used where xpcom methods expect a parameter of type nsid.
Components.lastResult
components.lastresult returns the numeric nsresult code that was the result code of the last xpcom method called via xpconnect.
... introduction generally, components.lastresult is only useful for testing the result of xpcom methods that can return interesting 'success' codes.
Components.utils.importGlobalProperties
the following strings are supported: string/object xpcom component atob blob btoa crypto css fetch file nsidomfile indexeddb nodefilter firefox 60 nsidomnodefilter obsolete since gecko 60 rtcidentityprovider textdecoder textencoder url urlsearchparams ...
... var domfile = services.appshell.hiddendomwindow.file('/path/to/file'); xpcom components some objects have an xpcom alternative, which typically allows more flexibility then the dom version here is an example of how to use the dom xmlhttprequest through xpcom interface of nsixmlhttprequest: var oreq = cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance(ci.nsixmlhttprequest); ...
Components object
the components object has the following members: classes array of classes by contractid classesbyid array of classes by cid constructor constructor for constructor of components exception constructor for xpconnect exceptions id constructor for xpcom nsids interfaces array of interfaces by interface name interfacesbyid array of interfaces by iid issuccesscode function to determine if a given result code is a success code lastresult result code of most recent xpconnect call manager the global xpcom component manager results array of known result codes by name returncode pending result for...
...declared in the interface) method or property of an xpcom object.
Examples
there are several java test applications checked in to the tree that give examples on how to embed gecko or init xpcom from within java.
... the test apps can be found at mozilla/extensions/java/xpcom/tests.
Architecture basics
xpcom is like com, for windows.
... xpconnect is what lets javascript talk with mozilla guts, the xpcom system.
xpcshell
unlike the ordinary js shell (js), xpcshell lets the scripts running in it access xpcom functionality.
... pretty much all mozilla programs use xpcom components via xpconnect.
nsCategoryManager
« xpcom api reference summary the xpcom category manager.
... class id 16d222a6-1dd2-11b2-b693-f38b02c021b2 contractid @mozilla.org/categorymanager;1 supported interfaces nsicategorymanager remarks this component is a singleton and should therefore be accessed via the xpcom service manager.
nsLocalFile
« xpcom api reference summary a component implementing nsilocalfile.
... class id 2e23e220-60be-11d3-8c4a-000064657374 contractid @mozilla.org/file/local;1 supported interfaces nsilocalfile, nsifile remarks this component should be accessed via the xpcom component manager.
nsObserverService
« xpcom api reference the xpcom observer service.
... class id d07f5195-e3d1-11d2-8acd-00105a1b8860 contractid @mozilla.org/observer-service;1 supported interfaces nsiobserverservice remarks this component is a singleton and should therefore be accessed via the xpcom service manager.
nsScriptableInputStream
« xpcom api reference summary a component implementing nsiscriptableinputstream.
... class id 7225c040-a9bf-11d3-a197-0050041caf44 contractid @mozilla.org/scriptableinputstream;1 supported interfaces nsiscriptableinputstream, nsiinputstream remarks this component should be accessed via the xpcom component manager.
NS_NewLocalFile
« xpcom api reference summary the ns_newlocalfile function creates an instance of nsilocalfile that provides a platform independent representation of a file path.
... #include "nsxpcom.h" #include "nsilocalfile.h" nsresult ns_newlocalfile( const nsastring& apath, prbool afollowlinks, nsilocalfile** aresult ); parameters apath [in] a utf-16 string object that specifies an absolute filesystem path.
NS_NewNativeLocalFile
« xpcom api reference summary the ns_newnativelocalfile function creates an instance of nsilocalfile that provides a platform independent representation of a file path.
... #include "nsxpcom.h" #include "nsilocalfile.h" nsresult ns_newnativelocalfile( const nsacstring& apath, prbool afollowlinks, nsilocalfile** aresult ); parameters apath [in] a string object that specifies an absolute filesystem path.
nsACString
« xpcom api reference summary the nsacstring abstract class represents a character string composed of single-byte storage units.
... the methods defined on nsacstring are implemented as inline wrappers around the xpcom string functions, prefixed with ns_cstring.
nsAString
« xpcom api reference summary the nsastring abstract class represents a character string composed of double-byte storage units.
...the methods defined on nsastring are implemented as inline wrappers around the xpcom string functions, prefixed with ns_string.
nsEmbedCString
« xpcom api reference summary the nsembedcstring concrete class provides a way to construct a nsacstring object that allocates null-terminated storage.
... remarks the methods defined on nsembedcstring are implemented as inline wrappers around the xpcom string functions, prefixed with ns_cstring.
nsEmbedString
« xpcom api reference summary the nsembedstring concrete class provides a way to construct a nsastring object that allocates null-terminated storage.
... remarks the methods defined on nsembedstring are implemented as inline wrappers around the xpcom string functions, prefixed with ns_string.
nsSupportsWeakReference
« xpcom api reference summary inherit from this c++ class to add canonical support for nsisupportsweakreference.
...to use this class, you must link your component or application against the xpcom glue library.
nsIChannel
this interface must be used only from the xpcom main thread.
...like any other nsichannel method it must not be called on any thread other than the xpcom main thread.
nsIChromeRegistry
: var chromeregistry = components.classes["@mozilla.org/chrome/chrome-registry;1"] .getservice(components.interfaces.nsichromeregistry); method overview void canonify(in nsiuri achromeurl); obsolete since gecko 1.8 void checkfornewchrome(); nsiuri convertchromeurl(in nsiuri achromeurl); boolean wrappersenabled(in nsiuri auri); violates the xpcom interface guidelines constants constant value description none 0 partial 1 full 2 methods canonify() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) note: this method is obsolete; use convertchromeurl() instead.
... violates the xpcom interface guidelines wrappersenabled() returns whether xpcnativewrappers are enabled for the specified uri.
nsIClassInfo
xpcom/components/nsiclassinfo.idlscriptable provides information about a specific implementation class.
...violates the xpcom interface guidelines exceptions thrown ns_error_not_available if the class does not have a classid contractid string a contractid through which an instance of this class can be created, or null.
nsIDOMGlobalPropertyInitializer
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) an xpcom component implementing this interface can be exposed to web content as a property on the window.
...ensure that you never return any internal xpcom objects to untrusted code.
nsIDOMParser
to create a domparser when the constructor is not available (e.g., from a js xpcom component, a js module, or an xpcshell test), use: var parser = components.classes["@mozilla.org/xmlextras/domparser;1"] .createinstance(components.interfaces.nsidomparser); // optionally, call parser.init(principal, documenturi, baseuri); principals, document and base uri note: this section covers changes introduced to domparser in gecko 1.9.
...examples within the context of a window: var parser = new domparser(); var doc = parser.parsefromstring(astr, "application/xml"); outside of a window (e.g., a js xpcom component, a js module, or an xpcshell test): var parser = components.classes["@mozilla.org/xmlextras/domparser;1"] .createinstance(components.interfaces.nsidomparser); var doc = parser.parsefromstring(astr, "application/xml"); using components.constructor(): const domparser = new components.constructor("@mozilla.org/xmlextras/domparser;1", "nsidomparser"); var parser = new domparse...
nsIDebug2
xpcom/base/nsidebug2.idlscriptable adds access to additional information in debug builds of mozilla code by expanding upon the features in nsidebug 1.0 66 introduced gecko 1.9.2 inherits from: nsidebug last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) attributes attribute type description assertioncount long the number of assertions since process start.
... isdebugbuild boolean whether xpcom was compiled with debug defined.
nsIDirectoryServiceProvider2
xpcom/io/nsidirectoryservice.idlscriptable an extension of nsidirectoryserviceprovider which allows multiple files to be returned for the given key.
...use an xpcom return code of ns_success_aggregate_result if this result should be aggregated with other "lower" providers.
nsIEditor
« xpcom api reference editor/nsieditor.idlscriptable provides methods and attributes used when editing page content.
...veeditactionlistener(in nsieditactionlistener listener); void adddocumentstatelistener(in nsidocumentstatelistener listener); void removedocumentstatelistener(in nsidocumentstatelistener listener); debug methods void dumpcontenttree(); void debugdumpcontent() ; void debugunittests(out long outnumtests, out long outnumtestsfailed); [notxpcom] boolean ismodifiablenode(in nsidomnode anode); constants load flags constant value description enone 0 enext 1 eprevious 2 enextword 3 epreviousword 4 etobeginningofline 5 etoendofline 6 attributes attribute type descriptio...
nsIFile
xpcom/io/nsifile.idlscriptable an instance of this interface is a cross-platform representation of a location in the filesystem.
... xpcom provides the string conversion functions ns_cstringtoutf16 and ns_utf16tocstring, which can be used to convert a string between utf-16 and the native character encoding.
nsIFrameLoaderOwner
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview [noscript, notxpcom] alreadyaddrefed_nsframeloader getframeloader(); void swapframeloaders(in nsiframeloaderowner aotherowner); attributes attribute type description frameloader nsiframeloader the frame loader owned by this nsiframeloaderowner.
...[noscript, notxpcom] alreadyaddrefed_nsframeloader getframeloader(); parameters none.
nsIINIParser
xpcom/ds/nsiiniparser.idlscriptable an instance of nsiiniparser can be used to read values from an ini file.
... */ function getinivalue (inifile, section, prop) { var inifact = components.manager.getclassobjectbycontractid( "@mozilla.org/xpcom/ini-parser-factory;1", components.interfaces.nsiiniparserfactory ); var iniparser = inifact.createiniparser(inifile); try { return iniparser.getstring(section,prop); } catch(e) { return undefined; } } // usage: var lang = getinivalue(file,"setting","language"); enumerating sections this example gets a list of all the sections in the ini file.
nsIINIParserFactory
xpcom/ds/nsiiniparser.idlscriptable this interface is used to create nsiiniparser objects for use in parsing ini files.
...er instance for an ini file, you may use the following code: // create an nsilocalfile var cl = "@mozilla.org/file/local;1"; var interf = components.interfaces.nsilocalfile; var file = components.classes[cl].createinstance(interf); // init the file with the path to your ini file var path = "c:\\temp\\example.ini"; file.initwithpath(path); // create the nsiiniparserfactory var cl = "@mozilla.org/xpcom/ini-parser-factory;1"; var interf = components.interfaces.nsiiniparserfactory; var inifact = components.manager.getclassobjectbycontractid(cl,interf); // get the iniparser for the ini file var iniparser = inifact.createiniparser(file); see also nsiiniparser nsilocalfile ...
nsIINIParserWriter
nsiiniparserwriter xpcom/ds/nsiiniparser.idlscriptable allows writing to an ini-format configuration file.
... to create an nsiiniparserwriter object, you use the nsiiniparserfactory interface to create a parser, then nsisupports.queryinterface() that to get an nsiiniparserwriter, like this: let writer = components.classes["@mozilla.org/xpcom/ini-processor-factory;1"].
nsIJSID
method overview boolean equals(in nsijsid other); const nsid* getid(); violates the xpcom interface guidelines void initialize(in string idstring); string tostring(); attributes attribute type description id nsidptr read only.
... violates the xpcom interface guidelines getid() const nsid* getid(); parameters none.
nsIMemory
xpcom/base/nsimemory.idlscriptable this interface represents a generic memory allocator.
... method overview voidptr alloc(in size_t size); violates the xpcom interface guidelines void free(in voidptr ptr); violates the xpcom interface guidelines void heapminimize(in boolean immediate); boolean islowmemory(); deprecated since gecko 2.0 voidptr realloc(in voidptr ptr, in size_t newsize); violates the xpcom interface guidelines methods alloc allocates a block of memory of a particular size.
nsIObserver
xpcom/ds/nsiobserver.idlscriptable this interface is implemented by an object that wishes to observe notifications.
... the most common implementation of nsiobserverservice is the xpcom observer service.
nsIObserverService
xpcom/ds/nsiobserverservice.idlscriptable this interface provides methods to add, remove, notify, and enumerate observers of various notifications.
... inherits from: nsisupports last changed in gecko 0.9.6 the xpcom nsobserverservice implements this interface to provide global notifications for a variety of subsystems.
nsIPropertyBag
xpcom/ds/nsipropertybag.idlscriptable this interface is used to store a set of properties.
...to do this use nsipropertybag: services.sysinfo.getproperty("version"); //output 5.1 services.sysinfo.getproperty("name"); //output windows_nt services.sysinfo.getproperty("arch"); //output x86 services.sysinfo.getproperty("haswindowstouchinterface"); //outputs false or true if windows touch is there consult the uxp repo (//github.com/realityripple/uxp/blob/master/xpcom/base/nssysteminfo.cpp) for the properties supported.
nsIScriptableIO
there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome!
...for example: io.getfile("profile", "cookies.txt"); from an xpcom component, however, you will need to get a reference as with other components: var scriptableio = components.classes["@mozilla.org/io/scriptable-io;1"] .getservice(); scriptableio.getfile("profile", "cookies.txt"); method overview nsifile getfile(in astring alocation, in astring afilename); nsifile getfilewithpath(in astring afilepath);...
nsISelection
as a service: var selection = components.classes["@mozilla.org/????????????????????????????"] .createinstance(components.interfaces.nsiselection); method overview void addrange(in nsidomrange range); void collapse(in nsidomnode parentnode, in long offset); [noscript,notxpcom,nostdcall] boolean collapsed(); void collapsenative(in nsidomnode parentnode, in long offset); native code only!
... collapsed() [noscript,notxpcom,nostdcall] boolean collapsed(); native code only!collapsenative void collapsenative( in nsinode parentnode, in long offset ); parameters parentnode offset collapsetoend() collapses the whole selection to a single point at the end of the current selection (regardless of direction).
nsISupportsWeakReference
xpcom/base/nsiweakreference.idlscriptable this interface is a factory interface, which produces appropriate instances of nsiweakreference.
... remarks the xpcom glue library provides nssupportsweakreference, a canonical implementation of nsisupportsweakreference.
nsIThreadEventFilter
xpcom/threads/nsithreadinternal.idlscriptable please add a summary to this article.
... last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview boolean acceptevent(in nsirunnable event);violates the xpcom interface guidelines methods violates the xpcom interface guidelines acceptevent() this method is called to determine whether or not an event may be accepted by a nested event queue.
nsIThreadInternal
the nsithreadinternal interface is implemented by the xpcom thread object to let consumers observe dispatch activity on a thread.
... xpcom/threads/nsithreadinternal.idlscriptable please add a summary to this article.
nsIWeakReference
xpcom/base/nsiweakreference.idlscriptable this interface represents a proxy for an xpcom object.
... it allows a consumer to hold an indirect, non-owning reference to an xpcom object.
nsIWindowWatcher
this component should not keep a (xpcom) reference to any windows; the implementation will claim no ownership.
... example for example, in a xul application or mozilla extension, if the window object is unavailable (for example, when opening a window from xpcom component code), you might want to use this interface for opening a new window: var ww = components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getservice(components.interfaces.nsiwindowwatcher); var win = ww.openwindow(null, "chrome://myextension/content/about.xul", "aboutmyextension", "chrome,centerscreen", null); note: versions of gecko...
NS_CStringContainerInit2
« xpcom api reference summary the ns_cstringcontainerinit2 function initializes a nscstringcontainer instance for use as a nsacstring.
...the caller must have allocated the data array using the xpcom memory allocator.
nsGetModuleProc
summary this function prototype provides the xpcom entry-point into a module.
... #include "nsxpcom.h" typedef nsresult (pr_callback *nsgetmoduleproc)( nsicomponentmanager *acompmgr, nsifile* alocation, nsimodule** aresult ); parameters acompmgr [in] the xpcom component manager.
nsStaticModuleInfo
summary this data structure is used by ns_initxpcom3 to specify static xpcom modules.
... #include "nsxpcom.h" struct nsstaticmoduleinfo { const char* name; nsgetmoduleproc getmodule; }; members name this member provides the name of the module as a null-terminated, ascii-valued character array.
The Thread Manager
only c++ code may use the thread manager and xpcom thread.
... nsithreadinternal a subclass of nsithread that is implemented by the xpcom thread object to add support for observing dispatch activity on a thread.
Status, Recent Changes, and Plans
relaxed the invariant for nscomptr<nsisupports>, so that it is now a pointer to any xpcom interface.
... bug 59414: making operator& private may help prevent some leaks caused by casting move the factored nscomptr routines into their own library, to reduce nscomptr clients' dependency on the xpcom library.
Weak reference
in xpcom, a weak reference is a special object that contains a pointer to an xpcom object, but doesnot keep that object alive.
... see also the source xpcom/base/nsiweakreference.idl xpcom/glue/nsweakreference.h xpcom/glue/nsweakreference.cpp xpcom ownership guidelines using nscomptr original document information author: scott collins last updated date: september 23, 2000 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons license | ...
Index
things appear confusing for several reasons: 45 message interfaces interfaces, interfaces:scriptable, needscontent, xpcom api reference, thunderbird nsimsghdr - this interface describes headers for all mail messages.
...it shares many of the technologies used by mozilla firefox, including javascript, the gecko layout engine, the xul xml user interface language and the xpcom cross-platform component object model.
Building a Thunderbird extension 1: introduction
it shares many of the technologies used by mozilla firefox, including javascript, the gecko layout engine, the xul xml user interface language and the xpcom cross-platform component object model.
... there are also a number of extension and applications that are useful for testing and debugging thunderbird extensions, such as javascript consoles and xpcom inspectors.
Get Thunderbird version
(version 3.0b3pre was the first build to include steel.) var versionchecker = components.classes["@mozilla.org/xpcom/version-comparator;1"].getservice(components.interfaces.nsiversioncomparator); if (versionchecker.compare(application.version, "3.0b4") >= 0) // code for >= 3.0b4 else // code for < 3.0b4 for versions prior to 3.0b3pre, you can use something like this: var version; if ( "@mozilla.org/xre/app-info;1" in components.classes ) version = components.classes["@mozilla.org/xre/app-info; 1"].getservice(components.interfaces.nsixulappinfo).version; else version = components.classes["@mozilla.org/preferences-service; 1"].getservice(components.interfaces.nsiprefbranch).
...getcharpref ("app.version"); var versionchecker = components.classes["@mozilla.org/xpcom/version- comparator;1"].getservice(components.interfaces.nsiversioncomparator); if ( versionchecker.compare( version, "3.0b3" ) >= 0 ) // code for >= 3.0b3 else // code for < 3.0b3 ...
js-ctypes
unlike binary xpcom components, it allows developers to ship a single binary for use with multiple versions of firefox.
... mailing list newsgroup rss feed stackoverflow - jsctypes related topics xpcom in gecko 2 - binary components ...
window.dump() - Web APIs
WebAPIWindowdump
dump() is also available to xpcom components implemented in javascript, even though window is not the global object in components.
...note that dump output from xpcom components goes to stderr, while dump called elsewhere will output to stdout.
io/file - Archive of obsolete content
for now, you need to require("chrome") and use the xpcom directory service as described in this article about file i/o.
loader/sandbox - Archive of obsolete content
omitted or null: then the sandbox will have chrome privileges giving it access to all the xpcom components.
places/bookmarks - Archive of obsolete content
see also using xpcom without chrome - bookmark observer ...
system/runtime - Archive of obsolete content
xpcomabi a string identifying the abi of the current processor and compiler vtable.
Low-Level APIs - Archive of obsolete content
platform/xpcom implement xpcom objects, factories, and services.
package.json - Archive of obsolete content
this is used as a classid of the "harness service" xpcom component.
Chrome Authority - Archive of obsolete content
var xhr = require("x"+"hr"); var modname = "xpcom"; var xpcom = require(modname); var one = require("one"); var two = require("two"); the intention is that developers use require() statements for two purposes: to declare (to security reviewers) what sorts of powers the module wants to use, and to control how those powers are mapped into the module's local namespace.
Developing for Firefox Mobile - Archive of obsolete content
supported io/text-streams supported lang/functional supported lang/type supported loader/cuddlefish supported loader/sandbox supported net/url supported net/xhr supported places/bookmarks not supported places/favicon not supported places/history not supported platform/xpcom supported preferences/service supported stylesheet/style supported stylesheet/utils supported system/environment supported system/events supported system/runtime supported system/unload supported system/xul-app supported tabs/utils supported test/assert supported tes...
Tutorials - Archive of obsolete content
chrome authority get access to the components object, enabling your add-on to load and use any xpcom object.
Dialogs and Prompts - Archive of obsolete content
nsipromptservice is an xpcom interface available to c++ and chrome javascript code (not to web pages' js), that provides methods for displaying a few simple types of dialogs.
Downloading Files - Archive of obsolete content
var privacy = privatebrowsingutils.privacycontextfromwindow(urlsourcewindow); var hardcodedusername = "ericjung"; var hardcodedpassword = "foobar"; persist.progresslistener = { queryinterface: xpcomutils.generateqi(["nsiauthprompt"]), // implements nsiauthprompt prompt: function(dialogtitle, text, passwordrealm, savepassword, defaulttext, result) { result.value = hardcodedpassword; return true; }, promptpassword: function(dialogtitle, text, passwordrealm, savepassword, pwd) { pwd.value = hardcodedpassword; return true; }, promptusernameandpassword: function(dialo...
Running applications - Archive of obsolete content
this page describes how to run other programs from your chrome javascript code, using mozilla xpcom interfaces.
Custom about: URLs - Archive of obsolete content
en navigate to about:myaboutpage'; // const aboutpage_uri = 'chrome://myaboutaddon/content/index.html'; class aboutpage { static get classid() { return components.id(`{${aboutpage_id}}`); } static get classdescription() { return aboutpage_description; } static get contractid() { return `@mozilla.org/network/protocol/about;1?what=${aboutpage_word}`; } static get queryinterface() { return xpcomutils.generateqi([ci.nsiaboutmodule]); } constructor() { object.freeze(this); } geturiflags(auri) { return ci.nsiaboutmodule.allow_script; } newchannel(auri, asecurity_or_aloadinfo) { let channel; if (services.vc.compare(services.appinfo.version, '47.*') > 0) { const uri = services.io.newuri(aboutpage_uri, null, null); // greater than or equal to firefo...
Inline options - Archive of obsolete content
this code should be in bootstrap.js (within the startup() function) for restartless extensions or in an xpcom component or a javascript code module (not an overlay!) for traditional extensions.
Jetpack Processes - Archive of obsolete content
these processes are relatively lightweight, do not have access to xpcom, and can innately do little other than compute.
Chapter 1: Introduction to Extensions - Archive of obsolete content
in addition to css and javascript, extensions can take advantage of xul and xpcom technologies for more sophisticated features.
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
the role of each technology firefox is largely built using four technologies: xul, css, javascript, and xpcom.
Appendix D: Loading Scripts - Archive of obsolete content
chromeworkers also have access to ctypes and a limited number of thread safe xpcom classes, but are otherwise limited to simple computation based on data passed via messages and xmlhttprequests.
Connecting to Remote Content - Archive of obsolete content
we create this instance using xpcom instead of the usual way (new xmlhttprequest()) because this way works both in chrome and non-chrome code.
Custom XUL Elements with XBL - Archive of obsolete content
you can do almost anything from xbl code, including using xpcom components, js code modules and available chrome scripts.
Introduction - Archive of obsolete content
even this project, called xul school, covers several other technologies such as javascript, css, xbl and xpcom.
Mozilla Documentation Roadmap - Archive of obsolete content
and finally, what we mentioned in our xpcom section: almost no documentation on xpcom components.
User Notifications and Alerts - Archive of obsolete content
another advantage is that you use an xpcom service to do this (nsialertsservice), so you can easily trigger alerts from chrome and non-chrome code.
XUL School Tutorial - Archive of obsolete content
ipt object management basic functionality adding menus and submenus adding toolbars and toolbar buttons adding events and commands adding windows and dialogs adding sidebars user notifications and alerts intermediate functionality intercepting page loads connecting to remote content handling preferences local storage advanced topics the box model xpcom objects observer notifications custom xul elements with xbl mozilla documentation roadmap useful mozilla community sites appendices appendix a: add-on performance appendix b: install and uninstall scripts appendix c: avoiding using eval in add-ons appendix d: loading scripts appendix e: dom building and html insertion appendix f: monitoring dom changes the xul s...
Performance best practices in extensions - Archive of obsolete content
lazily load services the xpcomutils javascript module provides two methods for lazily loading things: definelazygetter() defines a function on a specified object that acts as a getter which will be created the first time it's used.
Setting up an extension development environment - Archive of obsolete content
chromebug combines elements of a javascript debugger and dom (firefox, "kinda works for thunderbird") mozrepl explore and modify firefox and other mozilla apps while they run (firefox, thunderbird version is not working) executejs an enhanced javascript console (firefox version, thunderbird version is not working) xpcomviewer an xpcom inspector (firefox and thunderbird) javascript shells to test snippets of javascript (firefox and thunderbird) sqlite manager to manage the sqlite database (firefox and thunderbird) viewabout enables access to various about: dialogs from the view menu (firefox version, thunderbird version ) crash me now!
Promises - Archive of obsolete content
this interface replaces the previous, complicated xpcom nsifile and streams apis, and their related javascript helper modules.
Using the Stylesheet Service - Archive of obsolete content
the examples in this document are all written in javascript using xpcom.
Add-ons - Archive of obsolete content
well, xul overlays and windows, jsm files, chrome & resource mappings with localization, default preferences, but no xpcom components of your own.
Blackwood - Archive of obsolete content
active subprojects webclient java dom api java pluglet api defunct subprojects blackconnect -- blackconnect was superseeded by javaxpcom ...
Developing New Mozilla Features - Archive of obsolete content
our cross-platform component model (“xpcom”) is similar to com, but you’ll want to make sure you use it well before going too far with your project.
Documentation for BiDi Mozilla - Archive of obsolete content
improvements to lists with hebrew and arabic list-style-type summary of new classes class name xpcom interface (if applicable) implementation comments nsibidi intl\unicharutil\public\nsibidi.h intl\unicharutil\src\nsbidiimp.cpp implementation of the unicode bidi algorithm nsiubidiutils intl\unicharutil\public\nsiubidiutils.h intl\unicharutil\src\nsbidiutilsimp.cpp utilities for bidi processing, including: character classification symmetric swapping reordering shaping numeric translation co...
IO Guide/Directory Keys - Archive of obsolete content
the actual keys are: os and xpcom level xulrunner and co level ...
Modularization techniques - Archive of obsolete content
xpcom uses these typelibraries to allow other languages, such as javascript, to implement and call xpcom objects.
Mozilla Application Framework - Archive of obsolete content
xpcom a simple, cross-platform component model with multiple language bindings and idl descriptions so you can plug your custom functionality into the framework and connect it with other components.
Build - Archive of obsolete content
the contents of the file should look something like this : mk_add_options moz_co_project=xulrunner mk_add_options moz_objdir=@topsrcdir@/mozilla-obj ac_add_options --enable-application=xulrunner ac_add_options --disable-debug ac_add_options --enable-optimize ac_add_options --disable-tests ac_add_options --disable-javaxpcom build xulrunner : make -f client.mk build once the build is done, there will be a directory called mozilla-obj.
Scripting - Archive of obsolete content
currently, the webapp script also has access to full xpcom functionality, just like a firefox extension.
New Skin Notes - Archive of obsolete content
for an example of this, see creating xpcom components.
Static Analysis for Windows Code under Linux - Archive of obsolete content
host_libidl_config=/usr/bin/libidl-config #config your moztools position glib_prefix=$home/moztools libidl_prefix=$home/moztools #disable xpcom stdcall calling convention because of gcc 4.3.0 bug cppflags="-dmoz_disable_xpcom_stdcall" #specify the cxx and static analysis #point cxx to the cross compile g++ with plugin support cxx=$home/mingw-install/bin/i686-mingw32-g++ ac_add_options --with-static-checking=$home/dehydra/dehydra-gcc/gcc_dehydra.so then, you can start building your mozilla.
Table Layout Regression Tests - Archive of obsolete content
avoid the nasty assertions to pop up by set xpcom_debug_break=warn, the world would be a much better place if we could first fix those assertions.
URIs and URLs - Archive of obsolete content
this is done by ns_escapeurl which is now part of xpcom, but started as part of necko.
Venkman - Archive of obsolete content
venkman builds on the js/jsd portion of john's 1998 work, exposing it as an xpcom component.
When To Use ifdefs - Archive of obsolete content
for instance, xpcom, the spidermonkey javascript engine, and the networking engine do not know anything about xul and should not have any ifdefs based on --disable-xul.
Install Wizards (aka: Stub Installers) - Archive of obsolete content
the stub installer calls some glue code: xpistub which resides at: < http://lxr.mozilla.org/seamonkey/sou...pinstall/stub/> this "glue" code initialized xpcom and registers the xpinstall engine and requisite components to prepare for use by the stub installer.
Working With Directories - Archive of obsolete content
there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome!
Getting File Information - Archive of obsolete content
there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome!
Reading from Files - Archive of obsolete content
there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome!
Uploading and Downloading Files - Archive of obsolete content
there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome!
Writing to Files - Archive of obsolete content
there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome!
IO - Archive of obsolete content
ArchiveMozillaXULFileGuideIO
there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome!
Moving, Copying and Deleting Files - Archive of obsolete content
there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome!
TOC - Archive of obsolete content
ArchiveMozillaXULFileGuideTOC
there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome!
Node - Archive of obsolete content
ArchiveMozillaXULNode
summary this is a scriptable interface corresponding to the nsidomnode xpcom interface.
appLocale - Archive of obsolete content
« xul reference applocale obsolete since gecko 1.9.1 type: nsilocale returns the xpcom object which holds information about the user's locale.
builder - Archive of obsolete content
« xul reference builder type: nsixultemplatebuilder for content generated from a template, this is the xpcom object that is responsible for generating the content.
stringBundle - Archive of obsolete content
« xul reference stringbundle type: nsistringbundle returns the xpcom string bundle object which implements nsistringbundle.
Notes - Archive of obsolete content
deleting the "(default)" values in the following registry keys will fix this: hkey_classes_root\http\shell\open\ddeexec hkey_classes_root\https\shell\open\ddeexec you can also do this from within your xpcom component using windows registry interface.
Template and Tree Listeners - Archive of obsolete content
these each implement a different xpcom interface, as listed below: nsixulbuilderlistener - used to listen to template rebuilds.
Box Objects - Archive of obsolete content
next, we'll find out how to use xpcom objects from xul and scripts.
Install Scripts - Archive of obsolete content
you don't need to know much about it to create xul applications unless you are creating your own xpcom components.
Open and Save Dialogs - Archive of obsolete content
the xpcom interface nsifilepicker is used to implement a file picker.
XUL Tutorial - Archive of obsolete content
ntent panels splitters toolbars and menus toolbars simple menu bars more menu features popup menus scrolling menus events and scripts adding event handlers more event handlers keyboard shortcuts focus and selection commands updating commands broadcasters and observers document object model document object model modifying a xul interface manipulating lists box objects xpcom interfaces xpcom examples trees trees more tree features tree selection custom tree views tree view details tree box objects rdf and templates introduction to rdf templates trees and templates rdf datasources advanced rules persistent data skins and locales adding style sheets styling a tree modifying the default skin creating a skin skinning xul files by hand local...
The Implementation of the Application Object Model - Archive of obsolete content
however, in this xpcom world, where each type of pluggable content is off in its own dll, there's no clean way to inherit functionality from some base class implementation, when that implementation must necessarily reside in a different dll, without introducing a code dependency between all pluggable content and the common base class.
XML - Archive of obsolete content
in this way, it's more like a developmentplatform or framework than a user interface language, particularly when it's used with related cross-platform technologies like xpcom, which also went into mozilla.
scrollbox - Archive of obsolete content
do this instead: var xpcominterface =scrollbox_element.boxobject.queryinterface( components.interfaces.nsiscrollboxobject); xpcominterface.ensureelementisvisible(child_element_to_make_visible); see the nsiscrollboxobject api for other scroll-related methods.
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
if you've never done this before, you should consult creating xpcom components or another xpcom reference.
Deploying XULRunner - Archive of obsolete content
other executables and libraries the core changes to xul and gecko that require this new file layout were implemented in gecko 34, except that the xulrunner application was not updated to know about the change, so it will report an error: "unable to load xpcom." xulrunner was fixed in gecko 39.
How to enable locale switching in a XULRunner application - Archive of obsolete content
the dynamic list population requires an xpcom to query the currently selected locale as well as all locales available in the application package.
XULRunner - Archive of obsolete content
xulrunner is a mozilla runtime package that can be used to bootstrap xul+xpcom applications that are as rich as firefox and thunderbird.
XUL Explorer - Archive of obsolete content
s support extension testing using firefox extension test mode venkman support dom inspector support future: support more “best practice” checks such as: more a11y checks, strings in dtds and so on - xul checker allow users to add snippets on the fly add sidebars for more functionality - property sidebar and project sidebar support wizards to generate common projects - xul files, js xpcom, and xulrunner applications for more detailed information, see the xul_explorer:planning#feature_planning_for_xul_explorer.
mozilla.dev.platform FAQ - Archive of obsolete content
0x00016b50 in xre_createappdata () a: when you <tt>--disable-libxul</tt>, the xpcom glue doesn't have information about how to load all the dependent libraries like <tt>libgfx.dylib</tt>.
nsIContentPolicy - Archive of obsolete content
char* previous = nsnull; nscomptr<nsicategorymanager> catman; servman->getservicebycontractid(ns_categorymanager_contractid, ns_get_iid(nsicategorymanager), getter_addrefs(catman)); rv = catman->addcategoryentry("content-policy", component_classname, component_contractid, pr_true, pr_true, &previous); javascript developers can also implement an xpcom component that extends nsicontentpolicy.
2006-10-20 - Archive of obsolete content
a student learning xpcom is having issues with the method shouldload in the interface nslcontentpolicy.
2006-10-06 - Archive of obsolete content
../../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.
2006-11-10 - Archive of obsolete content
nsions=default,spatialnavigation then he tried running "make" and received the following error: /usr/bin/ld: testtarray.o(.text+0x2237): unresolvable relocation against symbol `nstarray_base::semptyhdr' /usr/bin/ld: final link failed: nonrepresentable section on output collect2: ld returned 1 exit status gmake[3]: *** [testtarray] error 1 gmake[3]: leaving directory `/usr/mozilla2/src/mozilla/xpcom/tests' gmake[2]: *** [libs] error 2 gmake[2]: leaving directory `/usr/mozilla2/src/mozilla/xpcom' gmake[1]: *** [tier_2] error 2 gmake[1]: leaving directory `/usr/mozilla2/src/mozilla' make: *** [default] error 2 he is not sure what is wrong with his build, and is asking for help on how to resolve the build error.
2006-11-24 - Archive of obsolete content
building xpcom components with msvs 2005 november 21st: buffaloaf is having trouble getting a personal xpcom component to work under xulrunner when compiled with msvs 2005.
2006-10-27 - Archive of obsolete content
traffic status of xpcom cycle collector graydon hoare provides the xpcom patch which experiments with implementing a general-purpose garbage-cycle collector for xpcom.
2006-11-17 - Archive of obsolete content
the possibility of turning the microsummaryresource object into a xpcom component, which accomplishes this task in a "hacky" manner, was also discussed.
2006-10-27 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - oct 21-27, 2006 announcements none during this week.
2006-11-10 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - oct 04-nov 10, 2006 announcements xptcall changes in process - ports owners needed if you maintain an xptcall port, you are needed to submit a patch to that bug 349002 with xptcall updates.
2006-11-17 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - nov 11-nov 17, 2006 announcements none during this week.
2006-12-01 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - nov 25- dec 01, 2006 announcements none during this week.
2006-11-17 - Archive of obsolete content
calendar xpcom component discussion about a debug error of additem function from calicalendar.
Newsgroup summaries - Archive of obsolete content
006-10-06mozilla.dev.apps.calendarmozilla.dev.tech.js-enginemozilla-dev-accessibilitymozilla-dev-apps-calendarmozilla-dev-apps-firefoxmozilla-dev-apps-thunderbirdmozilla-dev-buildsmozilla-dev-embeddingmozilla-dev-extensionsmozilla-dev-i18nmozilla-dev-l10nmozilla-dev-planningmozilla-dev-platformmozilla-dev-qualitymozilla-dev-securitymozilla-dev-tech-js-enginemozilla-dev-tech-layoutmozilla-dev-tech-xpcommozilla-dev-tech-xul ...
New in JavaScript 1.8 - Archive of obsolete content
when using the javascript shell, javascript xpcom components, or xul <script> elements, the latest js version (js1.8 in mozilla 1.9) is used automatically (bug 381031, bug 385159).
RFE to the XForms API - Archive of obsolete content
ArchiveWebXFormsRFEXForms API
mozilla xforms doens't offer any service you can get via xpcom.
omni.ja (formerly omni.jar)
/components/ xpcom components the application relies upon.
Multiprocess on Windows
one of the better pieces of documentation is a two-part series written by jeff prosise: understanding com apartments, part i understanding com apartments, part ii for the purposes of this document, "com" will refer to microsoft com (as opposed to xpcom).
Adding a new event
create xpcom interface for the dom event if your event class should be accessible via xpcom interface, you should create a new nsidomfooevent interface in dom/interfaces/events/.
Command line options
other options need to be documented -print-xpcom-dir -print-xpcom-dirlist -kill -killall -f -ftimeout -fwait -unsetdefaultmail gtk options -no-deelevate (running windows as administrator with launcher process enabled causes drag and drop errors - how to fix) references chrome: command line test documentation for command-line features (mozilla.org) toolkit/xre/nsapprunner.cpp browser/components/nsbrowsercontenthandler.js suite/...
Creating JavaScript callbacks in components
callback patterns in idl xpcom components use idl to create interfaces.
Simple Instantbird build
building purplexpcom and libpurple first download the purplexpcom code: hg clone http://hg.mozilla.org/users/florian_queze.net/purple mozilla/extensions/purple if you've set up your build environment as above, then all you need to do is: echo 'ac_add_options --enable-extensions=purple' >> .mozconfig in the comm-central directory, or just add the ac_add_options --enable-extensions=purple line to your .mozconfig ...
Working with Mozilla source code
interface development guide guidelines and documentation for how to create and update xpcom interfaces.
Frame script environment
frame scripts run with system privileges and have access to the components object, enabling them to use xpcom objects and jsms.
Limitations of frame scripts
frame scripts run with system privileges and have access to the components object, enabling them to use xpcom objects and jsms.
Communicating with frame scripts
an xpcom component), you can access the window of the browser that sent the message with message.target.ownerdocument.defaultview.
Frame script environment
frame scripts run with system privileges and have access to the components object, enabling them to use xpcom objects and jsms.
Limitations of frame scripts
frame scripts run with system privileges and have access to the components object, enabling them to use xpcom objects and jsms.
Performance
} object.assign(contentypolicy.prototype, { classdescription: ..., classid: ..., contractid: ..., queryinterface: xpcomutils.generateqi([ci.nsicontentpolicy]), shouldload: function(type, location, origin, context) { let resultlist = services.cpmm.sendsyncmessage("my-addon:check-load", {destination: location, source: origin}) // <=== sync message!
Embedding Tips
a service is a singleton object implementing one or more xpcom interfaces and registered with gecko during startup.
Embedding Mozilla
mailing list newsgroup rss feed #embedding irc channel related topics gecko, xpcom ...
How Mozilla determines MIME Types
if that also failed, the list of loaded plugins is checked for a plugin that can handle this extension, and is asked for the mime type if no plugin is registered, the ext-to-type-mapping xpcom category is searched for the extension.
IPDL Tutorial
the built-in simple types include the c++ integer types (bool, char, int, double) and xpcom string types (nsstring, nscstring).
IPDL Type Serialization
return false if deserialization failed } }; } // namespace ipc the standard ipdl types (integers, floats, and xpcom strings) already have serializers.
Implementing QueryInterface
some alternatives the ns_impl_query_interface[012] macros the sample above implements two xpcom interfaces in addition to nsisupports.
OSFile.jsm
this api is intended to replace, in time, most xpcom-based manipulation of files (nsifile, subsets of nsiioservice, etc.) by javascript code.
PromiseWorker.jsm
there is no xpcom access, similar to chromeworker.
Mozilla Development Strategies
find and fix bad xpcom macro usage.
Mozilla external string guide
the only remaining string classes are the "internal" ones, which are documented xpcom guide internal strings.
JS::PerfMeasurement
perfmeasurement* js::extractperfmeasurement(jsval wrapper) if you are the c++ side of an xpcom interface, and you want to benchmark only part of your execution time but make the results available to javascript, you can declare a bare jsval argument in your .idl file and have javascript pass a perfmeasurement object that it created in that argument slot.
TraceMalloc
(this can be done by examining the unprocessed output of an xpcom_mem_refcnt_log, one of the nstracerefcnt logs.) you should use the --use-address argument to diffbloatdump.pl, and then the diff tree can be run through fix_linux_stack.py or fix_macosx_stack.py as needed.
Performance
related topics javascript, xpcom, developing mozilla, extensions, addons ...
Preferences
related topics xul, javascript, xpcom, extensions, developing mozilla ...
Leak And Bloat Tests
method current method: measure leaks and bloats, in a similar way to firefox (using xpcom_mem_leak_log and --trace-malloc).
Hash Tables
ypes and constants hash table functions hash table types and constants plhashentry plhashtable plhashnumber plhashfunction plhashcomparator plhashenumerator plhashallocops hash table functions pl_newhashtable pl_hashtabledestroy pl_hashtableadd pl_hashtableremove pl_hashtablelookup pl_hashtableenumerateentries pl_hashstring pl_comparestrings pl_comparevalues see also xpcom hashtable guide ...
PRUnichar
an unsigned 16-bit type, like char in java or the "characters" of a javascript string defined in /mozilla/xpcom/base/nscore.h.
Necko Architecture
dependencies necko requires the following libraries for linking: nspr xpcom original document information author(s): jud valeski last updated date: november 8, 1999 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons license | details.
Necko FAQ
currently you'd need to get the mozilla tree and at least build nspr, and xpcom.
JSClass.flags
the private field of each object of this class points to an xpcom object (see nsisupports).
JS_SetOptions
the context's private data points to an xpcom object (see nsisupports).
Web Replay
core xpcom and mozglue lock classes and mozilla::atomic atomics are recorded by default, but many locks and atomics don't actually need to be recorded in order to correctly replay.
Using the Places keywords API
using the keywords api the keywords api is a promise-based api available through the placesutils module: components.utils.import("resource://gre/modules/xpcomutils.jsm"); xpcomutils.definelazymodulegetter(this, "placesutils", "resource://gre/modules/placesutils.jsm"); setting a keyword for an url the insert() method accepts a keyword entry object describing the keyword to insert.
Preferences API
interfaces the preferences api is exposed as a set of xpcom components and interfaces: nsiprefservice, nsiprefbranch.
extIExtension
implemented via xpcom service for extiapplication: see the instructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages.
extIPreferenceBranch
implemented via xpcom service for extiapplication: see the instructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages.
extISessionStorage
implemented via xpcom service for extiapplication: see the instructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages.
XML Extras
the module is structured as a drop-in component and exposes its xml-as-data features both to javascript and c++/xpcom users.
Resources
ozilla/releases/mozilla1.4a/gecko-sdk-i686-pc-linux-gnu-1.4a.tar.gz windows: http://ftp.mozilla.org/pub/mozilla/releases/mozilla1.4a/gecko-sdk-win32-1.4a.zip other mozilla downloads gecko resources internal string guide external string guide the gecko networking library ("necko") the netscape portable runtime environment embedding mozilla current module owners xpinstall xul xpcom resources the xpcom project page xulplanet's online xpcom reference information on xpconnect and scriptable components the smart pointer guide xpidl xpidl compiler reference general development resources the world wide web consortium url specification at the w3 gnu make « previous copyright (c) 2003 by doug turner and ian oeschger.
mozilla::services namespace
the services c++ namespace offers an easy and efficient alternative for obtaining a service as compared to the indirect xpcom approach: getservice(), callgetservice(), etc methods are expensive and should be avoided when possible.
Components.classesByID
each property represents one of the classes of xpcom components that can be constructed or accessed as an xpcom service.
Components.interfacesByID
each object represents one of the xpcom interfaces -- that some component or another might or might not implement.
Components.results
introduction components.results is an object whose properties are the names of well-known xpcom result codes, with each value being that of the corresponding result code.
Components.utils
declared in the interface) method or property of an xpcom object.
Other Resources
other resources embedding mozilla xpconnect - javascript-xpcom bridge blackconnect - java-xpcom bridge (no longer supported) xpidl to java types - from blackconnect ...
Using components
xpconnect works transparently in mozilla and xpcshell to give you access to xpcom components.
XPConnect wrappers
basic xpconnect objects xpcwrappednative these objects are created when any natively implemented xpcom object (that is, any object implemented in c++) needs to be reflected into javascript.
Profiling XPCShell
introduction sometimes, you might want to get a performance profile of a certain piece of javascript (like an xpcom module), to see which part takes the most time.
XPCShell Reference
-g this option specifies which gecko runtime environment directory (gredir) to use for xpcom.
nsresult
« xpcom api reference the nsresult data type is a strongly-typed enum used to represent a value returned by an xpcom function; these are typically error or status codes.
Append
« xpcom api reference summary the append family of functions appends a value to the end of a string's internal buffer.
Assign
« xpcom api reference summary the assign family of functions sets the value of a string's internal buffer.
BeginReading
« xpcom api reference summary the beginreading function returns a const pointer to the first element of the string's internal buffer.
Cut
« xpcom api reference summary the cut function removes a section of the string's internal buffer.
EndReading
« xpcom api reference summary the endreading function returns a const char_type pointer to the element just beyond the last element of the string's internal buffer.
Insert
« xpcom api reference summary the insert family of functions inserts a value into a string's internal buffer.
Length
« xpcom api reference summary the length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present).
Replace
« xpcom api reference summary the replace family of functions sets the value of a string's internal buffer.
operator=
« xpcom api reference summary this operator is a shortcut for the assign family of functions.
operator+=
« xpcom api reference summary this operator+= is a shortcut for the append family of functions.
Append
« xpcom api reference summary the append family of functions appends a value to the end of a string's internal buffer.
Assign
« xpcom api reference summary the assign family of functions sets the value of a string's internal buffer.
BeginReading
« xpcom api reference summary the beginreading function returns a const pointer to the first element of the string's internal buffer.
Cut
« xpcom api reference summary the cut function removes a section of the string's internal buffer.
EndReading
« xpcom api reference summary the endreading function returns a const char_type pointer to the element just beyond the last element of the string's internal buffer.
Insert
« xpcom api reference summary the insert family of functions inserts a value into a string's internal buffer.
Length
« xpcom api reference summary the length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present).
Replace
« xpcom api reference summary the replace family of functions sets the value of a string's internal buffer.
operator=
« xpcom api reference summary this operator= is a shortcut for the append family of functions.
operator+=
« xpcom api reference summary this operator+= is a shortcut for the append family of functions.
nsAutoRef
nsautoref is defined in xpcom/base/nsautoref.h.
nsAutoRefTraits
nterreftraits<prfiledesc> { public: static void release(prfiledesc *ptr) { pr_close(ptr); } }; or ns_specialize_template class nsautoreftraits<fcpattern> : public nspointerreftraits<fcpattern> { public: static void release(fcpattern *ptr) { fcpatterndestroy(ptr); } static void addref(fcpattern *ptr) { fcpatternreference(ptr); } }; nsautoreftraits is described in xpcom/base/nsautoref.h.
nsCStringEncoding
« xpcom api reference summary the nscstringencoding enumeration describes the set of character encodings understood by the ns_cstringtoutf16 and ns_utf16tocstring functions.
nsCountedRef
nscountedref<t> is defined in xpcom/base/nsautoref.h.
get
« xpcom api reference summary the get function returns a const pointer to the string's null-terminated, internal buffer.
nsEmbedCString
« xpcom api reference summary constructors for nsembedcstring.
operator=
« xpcom api reference summary this operator is a shortcut for the inherited nsacstring::assign family of functions.
get
« xpcom api reference summary the get function returns a const pointer to the string's null-terminated, internal buffer.
nsEmbedString
« xpcom api reference summary constructors for nsembedstring.
operator=
« xpcom api reference summary this operator is a shortcut for the inherited nsastring::assign family of functions.
Alloc
« xpcom api reference summary the alloc function allocates a block of memory of a particular size.
Clone
« xpcom api reference summary the clone function creates a copy of an existing memory block up to the size specified.
Free
« xpcom api reference summary the free function frees a block of memory that was allocated by xpcom's memory manager.
GetGlobalMemoryService
« xpcom api reference summary the getglobalmemoryservice function returns a reference to xpcom's global nsimemory object.
HeapMinimize
« xpcom api reference summary the heapminimize function attempts to shrink the size of the heap.
Realloc
« xpcom api reference summary the realloc function reallocates a block of memory to a new size.
nsIAccelerometerUpdate
xpcom/system/nsiaccelerometer.idlnot scriptable replaced by nsidevicemotionupdate 1.0 66 introduced gecko 2.0 obsolete gecko 6.0 inherits from: nsiaccelerometer last changed in gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) this method is only used in content tabs to receive nsiacceleration data from the chrome process.
innerHTML
for the xpcom interface attribute, see nsiaccessnode.attributes.
nsIArray
xpcom/ds/nsiarray.idlscriptable this interface implements an array object.
nsIAsyncInputStream
xpcom/io/nsiasyncinputstream.idlscriptable please add a summary to this article.
nsIAsyncOutputStream
xpcom/io/nsiasyncoutputstream.idlscriptable please add a summary to this article.
nsIBinaryInputStream
xpcom/io/nsibinaryinputstream.idlscriptable this interface allows consumption of primitive data types from a "binary stream" containing untagged, big-endian binary data, that is as produced by an implementation of nsibinaryoutputstream.
nsIBinaryOutputStream
xpcom/io/nsibinaryoutputstream.idlscriptable this interface allows writing of primitive data types (integers, floating-point values, booleans, and so on.) to a stream in a binary, untagged, fixed-endianness format.
nsIBlocklistPrompt
xpcom/system/nsiblocklistservice.idlscriptable this interface is used, if available, by the default implementation of nsiblocklistservice to display a confirmation user interface to the user before blocking extensions or plugins.
nsIBlocklistService
xpcom/system/nsiblocklistservice.idlscriptable please add a summary to this article.
nsICategoryManager
xpcom/components/nsicategorymanager.idlscriptable this interface provides access to a data structure that holds a list of name-value pairs, called categories, where each value is a list of strings.
nsICollection
xpcom/ds/nsicollection.idlscriptable this interface represents a list of nsisupports items.
nsIComponentManager
xpcom/components/nsicomponentmanager.idlscriptable this interface provides methods to access factory objects and instantiate instances of classes.
nsIConsoleListener
xpcom/base/nsiconsolelistener.idlscriptable this interface allows you to listen for messages sent to the console.
nsIConsoleMessage
xpcom/base/nsiconsolemessage.idlscriptable this interface is a base interface for messages passed to or from the nsiconsoleservice.
nsIConsoleService
xpcom/base/nsiconsoleservice.idlscriptable the console service is the back-end for the error console, bundled with every mozilla application, and for firefox's web console and browser console.
nsIContentSecurityPolicy
content/base/public/nsicontentsecuritypolicy.idlscriptable describes an xpcom component used to model and enforce content security policies.
nsIConverterInputStream
xpcom/io/nsiconverterinputstream.idlscriptable a unichar input stream that wraps an input stream.
nsIConverterOutputStream
xpcom/io/nsiconverteroutputstream.idlscriptable this interface allows writing strings to a stream, doing automatic character encoding conversion.
nsICrashReporter
xpcom/system/nsicrashreporter.idlscriptable provides access to crash reporting functionality.
nsICycleCollectorListener
xpcom/base/nsicyclecollectorlistener.idlscriptable interface to pass to the cycle collector to get information about the cycle collector graph while it is being built.
nsIDeviceMotion
xpcom/system/nsidevicemotion.idlscriptable this interface is used to implement accelerometer support.
nsIDeviceMotionData
xpcom/system/nsidevicemotion.idlscriptable this interface provides information about device motion.
nsIDeviceMotionListener
xpcom/system/nsidevicemotion.idlscriptable this interface can be implemented by clients that want to be notified orientation or acceleration changes on supported devices.
nsIDirectoryEnumerator
xpcom/io/nsidirectoryenumerator.idlscriptable this interface provides a means for enumerating the contents of a directory.
nsIDirectoryIterator
xpcom/obsolete/nsifilespec.idlscriptable please add a summary to this article.
nsIDirectoryServiceProvider
xpcom/io/nsidirectoryservice.idlscriptable this interface is used by the directory service to get file locations.
getFiles
« xpcom api reference summary this method is called by the directory service to query an enumeration of file or directory locations.
nsIEnvironment
xpcom/threads/nsienvironment.idlscriptable scriptable access to the current process environment.
nsIEventTarget
xpcom/threads/nsieventtarget.idlscriptable a target for events.
nsIException
xpcom/base/nsiexception.idlscriptable please add a summary to this article.
nsIFactory
xpcom/components/nsifactory.idlscriptable this interface is a class factory that allows for the creation of nsisupports derived classes without specifying a concrete class type.
nsIFileSpec
declared in xpcom/obsolete/nsifilespec.idl don't use this interface.
nsIGSettingsCollection
xpcom/system/nsigsettingsservice.idlscriptable please add a summary to this article.
nsIGSettingsService
xpcom/system/nsigsettingsservice.idlscriptable please add a summary to this article.
nsIGeolocationProvider
xpcom/system/nsigeolocationprovider.idlscriptable notify the geolocation service that a new geolocation has been discovered.
nsIGeolocationUpdate
xpcom/system/nsigeolocationprovider.idlscriptable provides a way for a geolocation provider to notify the system that a new location is available.
nsIHapticFeedback
xpcom/system/nsihapticfeedback.idlscriptable implemented to provide support for haptic feedback (that is, vibration support).
nsIInProcessContentFrameMessageManager
1.0 66 introduced gecko 2.0 inherits from: nsicontentframemessagemanager last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview nsicontent getownercontent(); violates the xpcom interface guidelines methods violates the xpcom interface guidelines getownercontent() nsicontent getownercontent(); parameters none.
nsIInputStream
xpcom/io/nsiinputstream.idlscriptable this interface represents a readable stream of data.
nsIInputStreamCallback
xpcom/io/nsiasyncinputstream.idlscriptable this is a companion interface for nsiasyncinputstream.asyncwait().
nsIInterfaceRequestor
xpcom/base/nsiinterfacerequestor.idlscriptable this interface defines a generic interface for requesting interfaces that a given object might provide access to.
nsIJSIID
« xpcom api reference summary [scriptable, uuid(e08dcda0-d651-11d2-9843-006008962422)] interface nsijsiid : nsijsid {}; ...
nsILocalFile
xpcom/io/nsilocalfile.idlscriptable this interface adds methods to nsifile that are particular to a file that is accessible via the local file system.
nsILocalFileMac
xpcom/io/nsilocalfilemac.idlscriptable please add a summary to this article.
nsIMemoryMultiReporter
xpcom/base/nsimemoryreporter.idlscriptable reports multiple memory measurements using a callback function that gets called once for each measurement.
nsIMemoryMultiReporterCallback
xpcom/base/nsimemoryreporter.idlscriptable implement this interface to handle callbacks from nsimemorymultireporter instances.
nsIMemoryReporter
xpcom/base/nsimemoryreporter.idlscriptable reports memory usage information for a single area of the software.
nsIMemoryReporterManager
xpcom/base/nsimemoryreporter.idlscriptable a service that provides methods for managing nsimemoryreporter objects.
nsIMsgAccountManagerExtension
an account manager extension is a xpcom compontent implementing this interface.
nsIMsgCompFields
« xpcom api reference summary the nsimsgcompfields interface provides properties for an composition of an outgoing message.
nsIMsgDBView
the nsimsgdbview interface handles the display of mail in the threadpane and preview pane of thunderbird and other xpcom based mail cients.
nsIMutableArray
xpcom/ds/nsimutablearray.idlscriptable this interface is a subclass of nsiarray that provides arrays that are mutable; that is, they can be altered programmatically.
nsIOutputStream
xpcom/io/nsioutputstream.idlscriptable an interface describing a writable stream of data.
nsIOutputStreamCallback
xpcom/io/nsiasyncoutputstream.idlscriptable this is a companion interface for nsiasyncoutputstream.asyncwait.
nsIPipe
xpcom/io/nsipipe.idlscriptable this interface represents an in-process buffer that can be read using nsiinputstream and written using nsioutputstream.
nsIPrefBranch2
the nsprefbranch object listens for xpcom-shutdown and frees all of the objects currently in its observer list.
nsIProcess
xpcom/threads/nsiprocess.idlscriptable this interface represents an executable process.
nsIProcess2
xpcom/threads/nsiprocess.idlscriptable this interface represents an executable process.
nsIProgrammingLanguage
xpcom/base/nsiprogramminglanguage.idlscriptable this interface provides an enumeration of programming language identifiers.
nsIProperty
xpcom/ds/nsiproperty.idlscriptable please add a summary to this article.
nsIPropertyBag2
xpcom/ds/nsipropertybag2.idlscriptable this interface extends nsipropertybag with some methods for getting properties in specific formats.
nsIPropertyElement
xpcom/ds/nsipersistentproperties2.idlscriptable this interface provides access to individual entries within a stringbundle.
nsIProtocolProxyService
all filters will be automatically unregistered at xpcom shutdown.
nsIPushService
} ); receiving push messages subscriptions created from privileged code use xpcom observer notifications instead of service worker events.
nsIScriptableInputStream
xpcom/io/nsiscriptableinputstream.idlscriptable this interface provides scriptable access to a nsiinputstream instance.
nsISeekableStream
xpcom/io/nsiseekablestream.idlscriptable provides seeking support in data streams.
nsISimpleEnumerator
xpcom/ds/nsisimpleenumerator.idlscriptable this interface represents an enumeration of xpcom objects and provides methods to access elements sequentially.
nsISocketTransport
nsitransporteventsink status codes note: although these constants look like xpcom error codes and are passed in an nsresult variable, they are not error codes.
nsIStackFrame
xpcom/base/nsiexception.idlscriptable please add a summary to this article.
nsIStringEnumerator
xpcom/ds/nsistringenumerator.idlscriptable please add a summary to this article.
nsISupportsCString
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for ascii character strings.
nsISupportsChar
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for single character values (often used to store an ascii character).
nsISupportsDouble
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for double-precision floating-point values.
nsISupportsFloat
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for single-precision floating-point values.
nsISupportsID
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for boolean values.
nsISupportsInterfacePointer
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for xpcom objects.
nsISupportsPRBool
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for boolean values.
nsISupportsPRInt16
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 16-bit signed integers.
nsISupportsPRInt32
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 32-bit signed integers.
nsISupportsPRInt64
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 64-bit signed integers.
nsISupportsPRTime
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for prtime values.
nsISupportsPRUint16
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 16-bit unsigned integers.
nsISupportsPRUint32
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 32-bit unsigned integers.
nsISupportsPRUint64
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 64-bit unsigned integers.
nsISupportsPRUint8
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for 8-bit unsigned integers.
nsISupportsPrimitive
xpcom/ds/nsisupportsprimitives.idlscriptable this interface serves as a base interface for all of the nsisupports* family of interfaces.
nsISupportsPriority
xpcom/threads/nsisupportspriority.idlscriptable this interface exposes the general notion of a scheduled object with an integral priority value.
nsISupportsString
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for unicode character strings.
nsISupportsVoid
xpcom/ds/nsisupportsprimitives.idlscriptable this interface provides scriptable access for generic pointers.
nsIThread
xpcom/threads/nsithread.idlscriptable please add a summary to this article.
nsIThreadManager
xpcom/threads/nsithreadmanager.idlscriptable please add a summary to this article.
nsIThreadObserver
xpcom/threads/nsithreadinternal.idlscriptable please add a summary to this article.
nsIThreadPool
xpcom/threads/nsithreadpool.idlscriptable the nsithreadpool interface provides support for thread pools.
nsIThreadPoolListener
xpcom/threads/nsithreadpool.idlscriptable please add a summary to this article.
nsITimer
xpcom/threads/nsitimer.idlscriptable please add a summary to this article.
nsITimerCallback
xpcom/threads/nsitimer.idlscriptable defines the callback interface for nsitimer events.
nsIUTF8StringEnumerator
xpcom/ds/nsistringenumerator.idlscriptable an object can implement this interface to allow a client to iterate over a set of strings provided by the object.
nsIUUIDGenerator
xpcom/base/nsiuuidgenerator.idlscriptable this interface can be used to generate an id that can be considered globally unique, often referred to as a uuid or guid.
nsIUpdateTimerManager
in order to avoid having to instantiate a component to call the registertimer() method, the component can instead register an update-timer category with comma-separated values as a single string representing the timer, like this: _xpcom_categories: [{ category: "update-timer", value: "contractid," + "method," + "id," + "preference," + "interval" }], this allows you to schedule the timer without actually having to instantiate the component; instead, the component is instantiated when the ...
nsIWebNavigationInfo
this is not the value returned for "xpcom plug-ins".
nsIWebProgressListener
cu.reporterror("saw: " + data.name + " -- passing: " + json.stringify(data)); }); /** * below is the contents of example-framescript.js */ const {classes: cc, interfaces: ci, utils: cu} = components; cu.import("resource://gre/modules/xpcomutils.jsm"); var mylistener = { queryinterface: xpcomutils.generateqi(["nsiwebprogresslistener", "nsisupportsweakreference"]), onstatechange: function(awebprogress, arequest, aflag, astatus) { let win = awebprogress.domwindow; let outerwindowid = win.queryinterface(ci.nsiinterfacerequestor) .getinte...
nsIWindowsRegKey
xpcom/ds/nsiwindowsregkey.idlscriptable this interface is designed to provide scriptable access to the windows registry system.
nsIWritablePropertyBag
xpcom/ds/nsiwritablepropertybag.idlscriptable please add a summary to this article.
nsIWritablePropertyBag2
xpcom/ds/nsiwritablepropertybag2.idlscriptable this interface extends nsipropertybag2 with methods for setting properties.
nsIXMLHttpRequest
when using the xpcom interface, as seen below in example 2, we can get access to this.
nsIXPCException
js/src/xpconnect/idl/xpcexception.idlscriptable these exception objects are the preferred types of exceptions when implementing xpcom interfaces in javascript.
nsIXPCScriptable
note: this is not really an xpcom interface.
nsIXULAppInfo
xpcom/system/nsixulappinfo.idlscriptable this interface provides information about the host application.
nsIXmlRpcClient
result the appropriate xpcom object.
nsIZipWriter
s it for (var i=0; i<dirarr.length; i++) { cu.reporterror('adding contents of dir['+i+']: ' + dirarr[i].leafname + ' path: ' + dirarr[i].path); var direntries = dirarr[i].directoryentries; while (direntries.hasmoreelements()) { var entry = direntries.getnext().queryinterface(ci.nsifile); //entry is instance of nsifile so here https://developer.mozilla.org/docs/xpcom_interface_reference/nsifile if (entry.path == xpi.path) { cu.reporterror('skipping entry - will not add this entry to the zip file - as this is the zip itself: "' + xpi.path + '" leafname:"' + xpi.leafname + '"'); continue; } if (entry.isdirectory()) { dirarr.push(entry); } var relpath = entry.path.replace(dirarr[0].p...
NS_ASSERTION
the behavior of an assertion failure can be controlled using the xpcom_debug_break environment variable.
NS_ENSURE_ARG_POINTER
refer to xpcom/glue/nsdebug.h for details.
NS_CStringAppendData
« xpcom api reference summary the ns_cstringappenddata function appends data to the existing value of a nsacstring instance.
NS_CStringCloneData
« xpcom api reference summary the ns_cstringclonedata function returns a null-terminated, heap allocated copy of the string's internal buffer.
NS_CStringContainerFinish
« xpcom api reference summary the ns_cstringcontainerfinish function releases any memory allocated by a nscstringcontainer instance.
NS_CStringContainerInit
« xpcom api reference summary the ns_cstringcontainerinit function initializes a nscstringcontainer instance for use as a nsacstring.
NS_CStringCopy
« xpcom api reference summary the ns_cstringcopy function copies the value from one nsacstring instance to another.
NS_CStringCutData
« xpcom api reference summary the ns_cstringcutdata function removes a section of the string's internal buffer.
NS_CStringGetData
« xpcom api reference summary the ns_cstringgetdata function gives the caller read access to the string's internal buffer.
NS_CStringGetMutableData
« xpcom api reference summary the ns_cstringgetmutabledata function gives the caller write access to the string's internal buffer.
NS_CStringInsertData
« xpcom api reference summary the ns_cstringinsertdata function appends data to the existing value of a nsacstring instance.
NS_CStringSetData
« xpcom api reference summary the ns_cstringsetdata function copies data into the string's internal buffer.
NS_CStringSetDataRange
« xpcom api reference summary the ns_cstringsetdatarange function copies data into a section of the string's internal buffer.
NS_CStringToUTF16
« xpcom api reference summary the ns_cstringtoutf16 function converts the value of a nsacstring instance to utf-16 and stores the result in a nsastring instance.
NS_StringAppendData
« xpcom api reference summary the ns_stringappenddata function appends data to the existing value of a nsastring instance.
NS_StringCloneData
« xpcom api reference summary the ns_stringclonedata function returns a null-terminated, heap allocated copy of the string's internal buffer.
NS_StringContainerFinish
« xpcom api reference summary the ns_stringcontainerfinish function releases any memory allocated by a nsstringcontainer instance.
NS_StringContainerInit
« xpcom api reference summary the ns_stringcontainerinit function initializes a nsstringcontainer instance for use as a nsastring.
NS_StringCopy
removed by bug 1332639 « xpcom api reference summary the ns_stringcopy function copies the value from one nsastring instance to another.
NS_StringCutData
« xpcom api reference summary the ns_stringcutdata function removes a section of the string's internal buffer.
NS_StringGetData
« xpcom api reference summary the ns_stringgetdata function gives the caller access to the string's internal buffer.
NS_StringInsertData
« xpcom api reference summary the ns_stringinsertdata function appends data to the existing value of a nsacstring instance.
NS_StringSetData
« xpcom api reference summary the ns_stringsetdata function copies data into the string's internal buffer.
NS_StringSetDataRange
« xpcom api reference summary the ns_stringsetdatarange function copies data into a section of the string's internal buffer.
NS_UTF16ToCString
« xpcom api reference summary the ns_utf16tocstring function converts the value of a nsastring instance from utf-16 to the specified multi-byte encoding and stores the result in a nsacstring instance.
Storage
note: storage is not the same as the dom:storage feature which can be used by web pages to store persistent data or the session store api (an xpcom storage utility for use by extensions).
Using nsCOMPtr
you'll have to turn to the xpcom newsgroup or another experienced nscomptr user, or find the answer by experimentation.
Using nsIClassInfo
nsiclassinfo is good for other things too, but they're dark xpcom magic.
Working with out parameters
when working with xpcom components, you might come across method declarations like the following one: [scriptable, uuid(8b5314bc-db01-11d2-96ce-0060b0fb9956)] interface nsitransferable : nsisupports { ...
already_AddRefed
« xpcom api reference already_addrefed in association with nscomptr allows you to assign in a pointer without addrefing it.
nsCOMPtr versus RefPtr
however, when the destination type is an xpcom interface, it's probably better to static_cast to a class that unambiguously inherits from nsisupports and use do_queryinterface in such cases.
Xptcall Porting Status
notice the last 2 files (the change to mozilla\xpcom\build\makefile.win and mozilla\xpcom\build) are needed because i was unable to figure how to do a "declspecexport" from the assembler asaxp ...
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).
XTF
MozillaTechXTF
the extensible tag framework (xtf) allows adding support for new namespaces using xpcom components to mozilla (written in javascript or c++).
Creating a gloda message query
an nsimsgdbhdr is the low-level, old-school, thunderbird xpcom representation of a message.
Message Interfaces
nsimsgdbview nsimsgdbview - the nsimsgdbview interface handles the display of mail in the threadpane and preview pane of thunderbird and other xpcom based mail cients.
Thunderbird extensions
rd community / communications thunderbird specific : add-ons section on developer.thunderbird.net thunderbird communication channels add-on developers forum/mailing list #maildev irc channel more general : mozillazine extension development forum general developer channels related topics xul, javascript, xpcom, themes, developing mozilla categori ...
libmime content type handlers
type) = 0; ns_imethod createcontenttypehandlerclass(const char *content_type, contenttypehandlerinitstruct *initstruct, mimeobjectclass **objclass) = 0; }; #endif /* nsimimecontenttypehandler_h_ */ plugin installation/location the installation of these modules will be similar to the that of any xpcom component (i.e.
Using Mozilla code in other projects
xulrunner a mozilla runtime package that can be used to bootstrap xul and xpcom applications with ease.
Debugger.Source - Firefox Developer Tools
the url may be the name of a xpcom javascript module or subscript.
Debugger.Object - Firefox Developer Tools
for example, in firefox, a metadata object for a javascript module's global object might look like this: { "type":"jsm", "uri":"resource:://gre/modules/xpcomutils.jsm" } firefox provides [debuggerhostannotationsforfirefox annotations] for its host objects.
File.mozFullPath - Web APIs
WebAPIFilemozFullPath
this property is only available from within browser code or old-style xpcom-based firefox extensions.
Index - Web APIs
WebAPIIndex
2724 node.nodeprincipal api, dom, gecko, node, non-standard, obsolete, principal, property, xpcom, nodeprincipal the node.nodeprincipal read-only property returns the nsiprincipal object representing current security context of the node.
Web Storage API - Web APIs
note: access to web storage from third-party iframes is denied if the user has disabled third-party cookies (firefox implements this behaviour from version 43 onwards.) note: web storage is not the same as mozstorage (mozilla's xpcom interfaces to sqlite) or the session store api (an xpcom storage utility for use by extensions).
getter - JavaScript
get notifier() { delete this.notifier; return this.notifier = document.getelementbyid('bookmarked-notification-anchor'); }, for firefox code, see also the xpcomutils.jsm code module, which defines the definelazygetter() function.
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
resources the following reflect the interface of the xsltprocessor object: nsixsltprocessor.idl xsltprocessor.webidl using xsltprocessor from xpcom components instantiating an xsltprocessor from an xpcom component requires a different syntax as the constructor is not defined inside components.