Search completed in 1.28 seconds.
116 results for "XPConnect":
Your results are loading. Please wait...
nsIXPConnect
js/src/xpconnect/idl/nsixpconnect.idlnot scriptable provides the xpconnect service.
... inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) to access the xpconnect service, use code like this: nsresult rv; nscomptr<nsixpconnect> xpconnect = do_getservice(nsixpconnect::getcid(), &rv); if (ns_succeeded(rv)) { /* use the object */ } method overview void addjsholder(in voidptr aholder, in nsscriptobjecttracerptr atracer); native code only!
... void clearallwrappednativesecuritypolicies(); nsixpconnectjsobjectholder createsandbox(in jscontextptr cx, in nsiprincipal principal); native code only!
...And 29 more matches
XPConnect wrappers
this document is a high-level overview of xpconnect wrapper objects (for the more technical description see xpconnect security membranes).
... developers in the know understand that wrappers play a large role in xpconnect, and that we have a lot of them.
... 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.
...And 3 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.
... xpconnect is part of firefox and is actively used in xul applications.
...And 3 more matches
Fun With XBL and XPConnect
the interface definition feature of xbl is used to define an interface through xpconnect to a c++ object that does auto completion.
Index
MozillaTechXPCOMIndex
7 fun with xbl and xpconnect xbl, xpcom, xpcom:language bindings, xpconnect no summary!
... 16 components object dom, gecko, xpcom:language bindings, xpconnect the components object is the object through which xpconnect functionality is reflected into javascript.
... the components object is actually a native instance of the nsixpccomponents interface which is reflected into javascript as a top level object using xpconnect.
...And 42 more matches
Mozilla DOM Hacking Guide
class info and helper classes introduction to class info class info is what gives the dom classes their correct behavior when used through xpconnect.
...we will talk a lot about xpconnect in this document, since it is so important for the dom.
... a brief introduction to javascript and xpconnect.
...And 31 more matches
nsIDOMWindowUtils
cannot be accessed from unprivileged context (not content-accessible) will throw a dom security error if called without universalxpconnect privileges.
... cannot be accessed from unprivileged context (not content-accessible) will throw a dom security error if called without universalxpconnect privileges.
... this method requires universalxpconnect privileges.
...And 19 more matches
nsIXPCScriptable
js/src/xpconnect/idl/nsixpcscriptable.idlnot scriptable please add a summary to this article.
... last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports method overview void precreate(in nsisupports nativeobj, in jscontextptr cx, in jsobjectptr globalobj, out jsobjectptr parentobj); void create(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); void postcreate(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); prbool addproperty(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp); prbool delproperty(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp); prbool getproperty(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in js...
...valptr vp); prbool setproperty(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp); prbool enumerate(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); prbool newenumerate(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in pruint32 enum_op, in jsvalptr statep, out jsid idp); prbool newresolve(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in pruint32 flags, out jsobjectptr objp); prbool convert(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in pruint32 type, in jsvalptr vp); void finalize(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); prbool checkaccess(in nsixpconnect...
...And 12 more matches
JavaScript-DOM Prototypes in Mozilla
prototype setup on an xpconnect wrapped dom node in mozilla when a dom node is accessed from javascript in mozilla, the native c++ dom node is wrapped using xpconnect and the wrapper is exposed to javascript as the javascript representation of the dom node.
... when xpconnect wraps a c++ object it will create a jsobject that is unique to this c++ object.
... var obj = document.images[0]; here, obj will not really have any properties (except for the standard jsobject properties such as constructor, and the non-standard __parent__, __proto__, etc.), all the dom functionality of obj comes from obj's prototype (obj.__proto__) that xpconnect sets up when exposing the first image in document to javascript.
...And 9 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
calling xpcom from xpconnect use the xpconnect technology to use xpcom in javascript.
... listing 1 shows how you can use xpconnect to acquire references to xpcom services and create new xpcom objects.
... listing 1: calling xpcom functions using xpconnect <?xml version="1.0" encoding="utf-8"?> <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript"><![cdata[ var ioservice = components.classes['@mozilla.org/network/io-service;1'] .getservice(components.interfaces.nsiioservice); alert(ioservice); ]]></script> </page> calling xpconnect using local files try sa...
...And 8 more matches
Using XPCOM Components
the cookie manager dialog this dialog is written in xul and javascript, and uses a part of xpcom called xpconnect to seamlessly connect to the cookiemanager component (see connecting to components from the interface below).
... the snippet in getting the cookiemanager component in javascript shows how the remove() method from the xpcom cookiemanager component can be called from javascript: getting the cookiemanager component in javascript // xpconnect to cookiemanager // get the cookie manager component in javascript var cmgr = components.classes["@mozilla.org/cookiemanager;1"] .getservice(); cmgr = cmgr.queryinterface(components.interfaces.nsicookiemanager); // called as part of a largerdeleteallcookies() function function finalizecookiedeletions() { for (var c=0; c<deletedcookies.length; c++) { cmgr.remove(deleted...
...cookies[c].host, deletedcookies[c].name, deletedcookies[c].path); } deletedcookies.length = 0; } connecting to components from the interface the mozilla user interface uses javascript that has been given access to xpcom components in the application core with a technology called xpconnect.
...And 8 more matches
Mozilla internal string guide
high bit is not guaranteed across xpconnect boundaries.
...all bits are preserved across xpconnect boundaries.
...converted to utf-16 as necessary when value is used across xpconnect boundaries.
...And 6 more matches
wrappedJSObject
wrappedjsobject is a property sometimes available on xpconnect wrappers.
... there are two kinds of xpconnect wrappers that support the wrappedjsobject property: xpcnativewrappers which are used to protect the chrome code working with content objects.
... regular xpconnect wrappers which you can encounter, for example, when using xpcom components implemented in js.
...And 6 more matches
Language bindings
the following bridging layers are currently available: components objectthe components object is the object through which xpconnect functionality is reflected into javascript.
... the components object is actually a native instance of the nsixpccomponents interface which is reflected into javascript as a top level object using xpconnect.components.classescomponents.classes is a read-only object whose properties are classes indexed by contractid.components.classesbyidcomponents.classesbyid is a read-only object whose properties are classes indexed by cid.components.constructorcreates a javascript function which can be used to create or construct new instances of xpcom components.components.exceptioncomponents.exception is a javascript constructor to create nsixpcexception objects.
...the scriptable methods on the nsicomponentmanager interface can be called directly on this object.components.resultscomponents.results is a read-only object whose properties are the names listed as the first parameters of the macros in js/xpconnect/src/xpc.msg (also at table of errors), with the value of each corresponding to that constant's value.components.returncodecomponents.stackcomponents.stack is a read only property of type nsistackframe (idl definition) that represents a snapshot of the current javascript callstack.
...And 5 more matches
XPJS Components Proposal - Archive of obsolete content
now, you might ask: "isn't that what xpconnect does?" and i would answer that xpconnect is necessary, but not sufficient to the task.
... 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 xpconnectcomponents object will be available.
...And 3 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.
... xpconnect is a technology which enables simple interoperation between xpcom and javascript.
... xpconnect allows javascript objects to transparently access and manipulate xpcom objects.
...And 3 more matches
Index - Archive of obsolete content
1684 the joy of xul guide, mozilla, xpcom, xpconnect, xul this guide is designed to introduce application developers and their managers to xul so they can not only understand why mozilla's platform is based on it, but how they might adopt it for their own use.
... 1811 xpcom interfaces tutorials, xpcom:language bindings, xpconnect, xul, xul_tutorial no summary!
... 3424 monitoring wifi access points wifi code with universalxpconnect privileges can monitor the list of available wifi access points to obtain information about them including their ssid, mac address, and signal strength.
...the new mozilla xpcom architecture allows xpcom components be scriptable via a different mechanism called xpconnect.
Monitoring WiFi access points - Archive of obsolete content
code with universalxpconnect privileges can monitor the list of available wifi access points to obtain information about them including their ssid, mac address, and signal strength.
...<html> <head> <title>wifi monitor example</title> <script> var count = 0; function test() { } test.prototype = { onchange: function (accesspoints) { netscape.security.privilegemanager.enableprivilege('universalxpconnect'); var d = document.getelementbyid("d"); d.innerhtml = ""; for (var i=0; i<accesspoints.length; i++) { var a = accesspoints[i]; d.innerhtml += "<p>" + a.mac + " " + a.ssid + " " + a.signal + "</p>"; } var c = document.getelementbyid("c"); c.innerhtml = "<p>" + count++ + "</p>"; }, onerror: function (value) { alert("error: " +value); }, queryin...
...terface: function(iid) { netscape.security.privilegemanager.enableprivilege('universalxpconnect'); if (iid.equals(components.interfaces.nsiwifilistener) || iid.equals(components.interfaces.nsisupports)) return this; throw components.results.ns_error_no_interface; }, } netscape.security.privilegemanager.enableprivilege('universalxpconnect'); var listener = new test(); var wifi_service = components.classes["@mozilla.org/wifi/monitor;1"].getservice(components.interfaces.nsiwifimonitor); wifi_service.startwatching(listener); </script> </head> <body> <div id="d"><p></p></div> <div id="c"><p></p></div> </body> </html> the nsiwifilistener object the first thing the code above does is to prototype the listener object that will be receiving no...
...the onchange() method (lines 13 through 27) begins by enabling universalxpconnect privileges, then clearing out the div (d) that will receive the updated list of access points.
Leak-hunting strategies and tips
(but we have many virtual destructors in the codebase that don't need to be -- don't do that.) debugging leaks that go through xpconnect many large object graphs that leak go through xpconnect.
... this can mean there will be xpconnect wrapper objects showing up as owning the leaked objects, but it doesn't mean it's xpconnect's fault (although that has been known to happen, it's rare).
... debugging leaks that go through xpconnect requires a basic understanding of what xpconnect does.
... 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.
Avoiding leaks in JavaScript XPCOM components
using xpcom in javascript (also known as xpconnect) is an environment where memory management issues are not obvious.
... memory management in xpcom and javascript javascript code that uses xpcom through xpconnect uses two different memory management models.
...understanding how memory management works in xpconnect helps understand why this is the case.
... xpconnect basically provides two features.
Components.lastResult
components.lastresult returns the numeric nsresult code that was the result code of the last xpcom method called via xpconnect.
...this is because failure result codes get converted by xpconnect into exceptions that are thrown into the calling javascript method.
...this is because many 'components' properties and methods are themselves implemented using xpconnect and subsequent calls to components.lastresult might reflect the result of 'implicit' xpconnect calls rather than the result of the target call.
... example in the following example, the local variable i contains the actual result returned by bar() (assuming that bar() is called via xpconnect), and components.lastresult contains the success code returned by bar().
xptcall FAQ
both of these facilities are required by xpconnect.
...xpconnect uses information from typelib files to reflect arbitrary xpcom interfaces into javascript and to make calls from javascript to xpcom using xptc_invokebyindex.
... the information in the typelibs allows xpconnect to convert function parameters and build the nsxptcvariant array required to make this call.
...but any browser feature that relies on xpconnect will fail.
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
global/skin/"?> <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="my dialog" buttons="accept,cancel" ondialogaccept="savevalues(); window.close();" ondialogcancel="window.close();"> <checkbox label="my option"/> </dialog> listing 8: a dialog figure 5: output from listing 8 note: the functions behind the dialog elements discussed here require "xpconnect privileges," which are discussed in chapter 4, so this example will only run correctly if it can run as firefox code itself or installed extension code.
... also, in order to actually read in a history for autocomplete, you will need xpconnect privileges, which we will cover in chapter 4.
...to use this requires xpconnect privileges, the same as autocomplete does; this will be covered in chapter 4.
A bird's-eye view of the Mozilla framework
scripting languages such as javascript cannot directly access xpcom components, but access them indirectly using xpconnect.
... xpconnect also provides a required layer for xpcom components written in a scripting language.
... const rdf = components.classes["@mozilla.org/rdf/rdf-service;1"].getservice(components.interfaces.nsirdfservice); the components object is made available to javascript via xpconnect; it serves as a bridge connecting javascript and xpcom.
An Overview of XPCOM
this aspect of xpcom is called xpconnect.
... xpconnect is the layer of xpcom that provides access to xpcom components from languages such as javascript.
... see connecting to components from the interface for more information about xpconnect.
Components object
the components object is the object through which xpconnect functionality is reflected into javascript.
... the components object is actually a native instance of the nsixpccomponents interface which is reflected into javascript as a top level object using xpconnect.
...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 current call stack c...
xpcshell
xpcshell is an xpconnect-enabled javascript shell.
... pretty much all mozilla programs use xpcom components via xpconnect.
... read xpconnect:using components to get started with that.
WebIDL bindings
} } external interfaces external interfaces are represented in c++ as objects that xpconnect knows how to unwrap to.
...this second call method is a template on the type of the first argument, so the this value can be passed in in whatever form is most convenient, as long as it's either a type that can be wrapped by xpconnect or a webidl interface type.
... xpconnect sandboxes doesn't see [securecontext] apis, but this may change in bug 1273687.
Mozilla Application Framework in Detail - Archive of obsolete content
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).
... xpconnect glues the front end to the c++-based components in xpcom, and it can be extended to include scripting support for other languages: pyxpcom already offers support for python, java is supported by javaxpcom, and there are efforts underway to add perl and ruby language support for xpconnect.
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.
...finally, xpconnect is the technology that connects these xpcom/xpidl interfaces to javascript, the scripting language xul uses.
Index - Archive of obsolete content
ArchiveMozillaXULIndex
953 the joy of xul guide, mozilla, xpcom, xpconnect, xul this guide is designed to introduce application developers and their managers to xul so they can not only understand why mozilla's platform is based on it, but how they might adopt it for their own use.
... 1080 xpcom interfaces tutorials, xpcom:language bindings, xpconnect, xul, xul_tutorial no summary!
Extentsions FAQ - Archive of obsolete content
write an xpcom component in c++ - it will talk to the com component and will be accessible to js code via xpconnect.
... what language does it require to write xpcom/xpconnect component that able to intercept,process and redirect http request?
RDF in Mozilla FAQ - Archive of obsolete content
since a built-in datasource is just an xpcom component, you can instantiate it directly using the xpconnect component manager.
...(shut down mozilla first since it overwrites your preferences file when you quit.) user_pref("signed.applets.codebase_principal_support", true); mozilla will ask you if you want to grant the scripts in duplicates.xul permission to access xpconnect; respond in the affirmative.
About Scriptable Interfaces - Interfaces
xpconnect xpconnect is a technology that allows scriptable interfaces to be used/implemented from/in javascript scripts.
... no other scripts languages are supported by xpconnect.
JavaScript Tips
var uniquename = { _privatemember: 3, publicmember: "a string", init: function() { this.dosomething(this.anothermember); }, dosomething: function(aparam) { alert(aparam); } }; xpconnect don't use object methods and properties more than you have to.
...xpconnect knows all about tearoffs and modifies the object that you queryinterface or instanceof to cache all its known interfaces.
about:memory
23.84%) ++ js-non-window ├───33.73 mb (17.58%) ── heap-unclassified ├───22.51 mb (11.73%) ++ heap-overhead ├────6.62 mb (03.45%) ++ images ├────5.82 mb (03.03%) ++ workers/workers(chrome) ├────5.36 mb (02.80%) ++ (16 tiny) ├────4.07 mb (02.12%) ++ storage ├────2.74 mb (01.43%) ++ startup-cache └────2.16 mb (01.12%) ++ xpconnect some expertise is required to understand the full details here, but there are various things worth pointing out.
... there are measurements for other content such as images and workers, and for browser subsystems such as the startup cache and xpconnect.
GCIntegration - SpiderMonkey Redirect 1
many other xpconnect pointers are also traced in this way.
...there are several examples of this usage in xpconnect.
Components.Constructor
for example: var binaryinputstream = components.constructor("@mozilla.org/binaryinputstream;1"); var bis = new binaryinputstream(); print(bis.tostring()); // "[xpconnect wrapped nsisupports]" try { // someinputstream is an existing nsiinputstream // throws because bis hasn't been qi'd to nsibinaryinputstream bis.setinputstream(someinputstream); } catch (e) { bis.queryinterface(components.interfaces.nsibinaryinputstream); bis.setinputstream(someinputstream); // succeeds now } if two arguments are given, the created instance will be nsisupports.queryin...
...terface()'d to the xpcom interface whose name is the second argument: var binaryinputstream = components.constructor("@mozilla.org/binaryinputstream;1", "nsibinaryinputstream"); var bis = new binaryinputstream(); print(bis.tostring()); // "[xpconnect wrapped nsibinaryinputstream]" // someinputstream is an existing nsiinputstream bis.setinputstream(someinputstream); // succeeds if three arguments are given, then in addition to being nsisupports.queryinterface()'d, the instance will also have had an initialization method called on it.
Components.returnCode
generally, xpconnect does a fine job of making it unnecessary for javascript code to worry about nsresult codes.
... by default the successful completion of the javascript method will cause xpconnect to return a result code of ns_ok to the caller.
Components.utils
components.utils is a collection of various useful xpconnect features.
... its interface is defined at js/xpconnect/idl/xpccomponents.idl.
Architecture basics
xpconnect is what lets javascript talk with mozilla guts, the xpcom system.
...it's an interactive interpreter -- it gives you a shell that talks straight to mozilla, via javascript's xpconnect bridge into it.
Using components
xpconnect works transparently in mozilla and xpcshell to give you access to xpcom components.
...bject nsxpccomponents_classes] results=[object nsxpccomponents_results] issuccesscode=function issuccesscode() { [native code] } constructor=[object nsxpccomponents_constructor] queryinterface=function queryinterface() { [native code] } interfacesbyid=[object nsxpccomponents_interfacesbyid] classesbyid=[object nsxpccomponents_classesbyid] stack=js frame :: scratchpad/4 :: cdump :: line 8 manager=[xpconnect wrapped nsicomponentmanager] id=[object nsxpccomponents_id] exception=[object nsxpccomponents_exception] reporterror=function reporterror() { [native code] } cancreatewrapper=function cancreatewrapper() { [native code] } cancallmethod=function cancallmethod() { [native code] } cangetproperty=function cangetproperty() { [native code] } cansetproperty=function cansetproperty() { [native code] } ...
HOWTO
put the following at the end of your script: // do async processing // from <https://developer.mozilla.org/en/xpconnect/xpcshell/howto> print("doing async work"); gscriptdone = false; var gthreadmanager = cc["@mozilla.org/thread-manager;1"] .getservice(ci.nsithreadmanager); var mainthread = gthreadmanager.currentthread; while (!gscriptdone) mainthread.processnextevent(true); while (mainthread.haspendingevents()) mainthread.processnextevent(true); 2.
...] solution 1 var loader = components.classes["@mozilla.org/moz/jssubscript-loader;1"] .getservice(components.interfaces.mozijssubscriptloader); loader.loadsubscript("chrome://myall/content/file.jsm"); see: http://mxr.mozilla.org/comm-central/...figutils.js#54 solution 2 append the following at the top of your js file which you want to run in xpcshell { // <https://developer.mozilla.org/en/xpconnect/xpcshell/howto> // <https://bugzilla.mozilla.org/show_bug.cgi?id=546628> let cc = components.classes; let ci = components.interfaces; // register resource://app/ uri let ios = cc["@mozilla.org/network/io-service;1"] .getservice(ci.nsiioservice); let reshandler = ios.getprotocolhandler("resource") .queryinterface(ci.nsiresprotocolhandler); let mozdir = cc["@mozilla.org/fil...
XPCShell Reference
dumpxpc(depth) this function dumps the xpconnect object.
... see the documentation on debugdump() for the nsixpconnect interface for more information.
nsIFile
a string containing characters encoded in the native charset cannot be safely passed to javascript via xpconnect.
... a string containing characters encoded in the native character set cannot be safely passed to javascript via xpconnect.
nsIScriptError
js/xpconnect/idl/nsiscripterror.idlscriptable represents javascript errors and warnings for use by the console service.
... categories the web console does not display "xpconnect javascript" "component javascript" "chrome javascript" "chrome registration" "xbl" "xbl prototype handler" "xbl content sink" "xbl javascript" "frameconstructor" categories the web console displays "hudconsole" "css parser" "css loader" "content javascript" "dom events" "dom:html" "dom window" "svg" "imagemap" "html" "canvas" "dom3 load" "dom" "malformed-xml" "dom worke...
nsISecurityCheckedComponent
two examples: code that has the "universalxpconnect" capability is allowed to access all of xpcom.
...this interface is used in mozilla by xpconnect and a handful of things that need special handing (xul controllers, the ui for the <video> tag, etc.).
nsIVariant
xpcom/ds/nsivariant.idlscriptable xpconnect has magic to transparently convert between nsivariant and js types.
...return value returns the underlying js value, if the variant was created by passing a js object into xpconnect.
Xptcall Porting Guide
ns_imethod getinterfaceinfo(nsiinterfaceinfo** info) = 0; // call this method and return result ns_imethod callmethod(pruint16 methodindex, const nsxptmethodinfo* info, nsxptcminivariant* params) = 0; }; code that wishes to make use of this stubs functionality (such as xpconnect) implement a class which inherits from nsxptcstubbase and implements the getinterfaceinfo and callmethod to let the platform specific code know how to get interface information and how to dispatch methods once their parameters have been pulled out of the platform specific calling frame.
...a full 'test' at this point requires building the client and running the xpconnect test called testxpc in mozilla/js/src/xpconnect/tests.
XPCOM
here is how to make the same component in python using pyxpcom.fun with xbl and xpconnectgenerating guidsguids 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.
...ed before the weak reference, the pointer inside the weak reference is set to nsnull.working with multiple versions of interfacesin 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.working with out parameterswrappedjsobjectwrappedjsobject is a property sometimes available on xpconnect wrappers.
xpidl
MozillaTechXPIDLxpidl
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.
...``/tmp/nsithing) for output -e use explicit output filename -d write dependencies (requires -e) -m specify output mode: header generate c++ header (.h) typelib generate xpconnect typelib (.xpt) doc generate html documentation (.html) java generate java interface (.java) ...
Mozilla
javascript tips javascript-dom prototypes in mozilla when a dom node is accessed from javascript in mozilla, the native c++ dom node is wrapped using xpconnect and the wrapper is exposed to javascript as the javascript representation of the dom node.
... when xpconnect wraps a c++ object it will create a jsobject that is unique to this c++ object.
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
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).
Exception logging in JavaScript - Archive of obsolete content
any exceptions that are generated by xpconnect -- that is, those exceptions whose result codes are defined in nsixpconnect.idl -- are always logged into the error console.
RDF Datasource How-To - Archive of obsolete content
1 as of this writing, it is not currently possible to implement javascript xpcom components; however, it may soon be possible to do so via xpconnect.
Standalone XPCOM - Archive of obsolete content
todo for v 1.0 optional exclusion of specific features into standalone xpcom like registry, xpconnect.
XPCOM Interfaces - Archive of obsolete content
the process of calling xpcom from a script is called xpconnect, which is a layer which translates script objects into native objects.
2006-12-01 - Archive of obsolete content
discussions protocol security daniele rizzo posted a question as to whether or not it is possible to enable/disable the privilege of universalxpconnect in a 'entire' protocol (http://, file://).
JS-Engine FAQ - Archive of obsolete content
domparser is not part of js but part of mozilla browser which makes it available to script in the browser using xpconnect.
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.
Archive of obsolete content
the new mozilla xpcom architecture allows xpcom components be scriptable via a different mechanism called xpconnect.
Plug-in Development Overview - Gecko Plugin API Reference
ng() method called inside the script element: <object id="myplugin" type="audio/wav" data="music.wav"> </object> <script type="application/javascript"> var theplugin = document.getelementbyid('myplugin'); if (theplugin && theplugin.advancetonextsong) theplugin.advancetonextsong(); else alert("plugin not installed correctly"); </script> in the past, liveconnect and later xpconnect were used to make plug-ins scriptable.
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
} } else if (href.match(/#$/, '') || href.match(/^#/, '')) { alert('fragment identifiers are disallowed in an xinclude "href" attribute'); return false; } var j; var xincludeparent = xinclude.parentnode; try { netscape.security.privilegemanager.enableprivilege('universalxpconnect universalbrowserread'); // necessary with file:///-located files trying to reach external sites if (href !== null) { var response, responsetype; var request = new xmlhttprequest(); request.open('get', href, false); request.setrequestheader('if-modified-since', 'thu, 1 jan 1970 00:00:00 gmt'); ...
Creating JavaScript callbacks in components
the function attribute tells the xpconnect machinery to treat the javascript function as if it was an implementation of the callback interface.
Debugging on Windows
you can use helper functions from nsxpconnect.cpp to inspect and modify the state of javascript code from the msvs debugger.
Error codes returned by Mozilla APIs
ns_error_dom_not_object_err (0x805303eb) ns_error_dom_not_xpc_object_err (0x805303ec) ns_error_dom_not_number_err (0x805303ed) ns_error_dom_not_boolean_err (0x805303ee) ns_error_dom_not_function_err (0x805303ef) ns_error_dom_too_few_parameters_err (0x805303f0) ns_error_dom_bad_document_domain (0x805303f1) ns_error_dom_prop_access_denied (0x805303f2) ns_error_dom_xpconnect_access_denied (0x805303f3) ns_error_dom_bad_uri (0x805303f4) ns_error_dom_retval_undefined (0x805303f5) ns_error_dom_quota_reached (0x805303f6) an attempt was made to add data into the local or global storage for a given domain that would exceed the amount allowed for that domain.
PRUint64
notes note: prior to gecko 12.0, pruint64 was actually treated as a signed 64-bit integer by xpconnect.
SpiderMonkey compartments
​see also js_newcompartmentandglobalobject() js_entercrosscompartmentcall() js_leavecrosscompartmentcall() jsautocompartment invariants spidermonkey internals: thread safety andreas gal blog post bobby holley blog post sfink/contexts_and_compartments xpconnect security membranes ...
Invariants
however, there is another internal api, js::switchtocompartment, that lets you break this invariant, and of course in xpconnect we use that from time to time when we know we aren't going to be creating any new objects (other than global objects, which have no parent or prototype) or doing anything that might call back into native code that could create objects.
JSClass.flags
this is only meaningful if spidermonkey is built with xpconnect and the jsclass_has_private flag is also set.
JS_SetOptions
this is only meaningful if spidermonkey is built with xpconnect.
How to build an XPCOM component in JavaScript
the library provides a simple example of its use in the source code (js/xpconnect/loader/xpcomutils.jsm), but here's another using this example.
Component Internals
xpconnect, for example, provides a component loader that makes the various types, including the interfaces and their parameters, available to javascript.
Finishing the Component
the next chapter looks at how to tie this into the front end - specifically, how to use xpconnect to access and control this component from javascript in the user interface.
Resources
illa.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.
Creating XPCOM components
factories xpidl and type libraries xpcom services xpcom types method types reference counting status codes variable mappings common xpcom error codes using xpcom components component examples cookie manager the webbrowserfind component the weblock component component use in mozilla finding mozilla components using xpcom components in your cpp xpconnect: using xpcom components from script component internals creating components in cpp xpcom initialization xpcom registry manifests registration methods in xpcom autoregistration the shutdown process three parts of a xpcom component library xpcom glue the glue library xpcom string classes creating the component code what we'll be working on component regist...
How To Pass an XPCOM Object to a New Window
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]".
Components.classes
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.nsisupportsarray); if you don't provide a specific interface to createinstance(), it will return an xpconnect wrapper for the component, which only exposes the methods of the nsisupports interface (and under certain circumstances the special wrappedjsobject property).
Components.interfaces
it reflects only those interfaces which have been designated in their .idl description as scriptable, that is the interfaces which xpconnect is capable of reflecting into javascript.
Components.interfacesByID
the interfaces which xpconnect is capable of reflecting into javascript.
Components.results
components.results is a read-only object whose properties are the names listed as the first parameters of the macros in js/xpconnect/src/xpc.msg (also at table of errors), with the value of each corresponding to that constant's value.
Components.utils.forceGC
requires universalxpconnect privileges.
Components.utils.import
additional resources components.utils bug 238324 the documentation in xpccomponents.idl the tests in js/xpconnect/tests/unit/ importing sdk/commonjs modules into other code ...
Components.utils.unload
see bug 769253 see also bug 481603 the documentation in xpccomponents.idl the tests in js/xpconnect/tests/unit/ ...
Other Resources
other resources embedding mozilla xpconnect - javascript-xpcom bridge blackconnect - java-xpcom bridge (no longer supported) xpidl to java types - from blackconnect ...
JavaXPCOM
javaxpcom is very similar to xpconnect (javascript-xpcom bridge), and uses xpidl.
PyXPCOM
pyxpcom is similar to javaxpcom (java-xpcom bridge) or xpconnect (javascript-xpcom bridge).
nsIRegistry
perhaps if we quit with the xpconnect:appshellservice, it will work.
IDispatch
js/src/xpconnect/idl/xpcidispatch.idlscriptable this interface is not to be used directly, it is to be used internally for xpconnect's idispatch support.
mozIJSSubScriptLoader
js/xpconnect/idl/mozijssubscriptloader.idlscriptable this interface can be used from privileged javascript to load and run javascript code from the given url at runtime.
nsIClassInfo
for example, if asked for the helper for nsiprogramminglanguage::javascript this might return an object that can be nsisupports.queryinterface()'d into the nsixpcscriptable interface to assist xpconnect in supplying javascript specific behavior to callers of the instance object.
nsIDOMParser
if the caller has universalxpconnect privileges, it can pass parameters to new domparser().
nsIDispatchSupport
js/src/xpconnect/idl/nsidispatchsupport.idlnot scriptable please add a summary to this article.
nsIEventListenerService
to create an instance, use: var eventlistenerservice = components.classes["@mozilla.org/eventlistenerservice;1"] .getservice(components.interfaces.nsieventlistenerservice); universalxpconnect privileges are required to use this service.
nsIJSCID
js/src/xpconnect/idl/xpcjsid.idlscriptable this interface provides methods to instantiate a component and access service components.
nsIJSID
js/src/xpconnect/idl/xpcjsid.idlscriptable this interface provides information about a contract or interface.
nsIMimeConverter
this should only be used by native code, as xpconnect translation causes it to not work properly.
nsIMsgWindow
for some reason xpconnect is still hanging onto the message window even though all of our objects have let go of it.
nsIScriptError2
js/src/xpconnect/idl/nsiscripterror.idlscriptable represents javascript errors and warnings for use by the console service; augments nsiscripterror by adding a way to initialize the error with the window id of the outer window with which the error is associated.
nsIWinTaskbar
example netscape.security.privilegemanager.enableprivilege("universalxpconnect"); var taskbar = components.classes["@mozilla.org/windows-taskbar;1"].getservice(components.interfaces.nsiwintaskbar); // get the docshell for the browser var navigator2 = top.queryinterface(components.interfaces.nsiinterfacerequestor).getinterface(components.interfaces.nsiwebnavigation); var docshell = navigator2.queryinterface(components.interfaces.nsidocshell); // get the parent docshell; t...
nsIXPCException
js/src/xpconnect/idl/xpcexception.idlscriptable these exception objects are the preferred types of exceptions when implementing xpcom interfaces in javascript.
nsIXmlRpcClient
via nsixpconnect::getpendingexception()->data a nsixmlrpcfault object can be retreieved with more information on the fault.
nsIXmlRpcFault
xml-rpc server fault codes are returned wrapped in this; access it using nsixpconnect.getpendingexception->data.
XPCOM Interface Reference
indowcreatornsiwindowmediatornsiwindowwatchernsiwindowsregkeynsiwindowsshellservicensiworkernsiworkerfactorynsiworkerglobalscopensiworkermessageeventnsiworkermessageportnsiworkerscopensiwritablepropertybagnsiwritablepropertybag2nsixformsmodelelementnsixformsnsinstanceelementnsixformsnsmodelelementnsixmlhttprequestnsixmlhttprequesteventtargetnsixmlhttprequestuploadnsixpcexceptionnsixpcscriptablensixpconnectnsixsltexceptionnsixsltprocessornsixsltprocessorobsoletensixulappinfonsixulbrowserwindownsixulbuilderlistenernsixulruntimensixulsortservicensixultemplatebuildernsixultemplatequeryprocessornsixultemplateresultnsixulwindownsixmlrpcclientnsixmlrpcfaultnsizipentrynsizipreadernsizipreadercachensizipwriternsmsgfilterfileattribvaluensmsgfolderflagtypensmsgjunkstatusnsmsgkeynsmsglabelvaluensmsgpriorityval...
nsIAbCard/Thunderbird3
the non-variant functions are marked [noscript] since xpconnect uses magic with nsivariant such that the other functions are not needed, although c++ does need them.
Weak reference
in javascript, just make sure that your queryinterface method returns your object for the nsisupportsweakreference interface, and you're set; xpconnect does all the work for you.
Working with out parameters
usage in order to use such a method from javascript via xpconnect, you have to follow a specific rule.
XPIDL
resources (mostly outdated) some unsorted notes including a keyword list xpidl is a tool for generating c++ headers, java interfaces, xpconnect typelibs, and html documentation from xpidl files generating xpt files on windows a google groups post with instructions on how to use variable-length argument lists using xpidl.
Working with windows in chrome code
by passing args to openwindow xpconnect will automatically wrap it as a generic nsisupports.
Constants - Plugins
npvers_has_xpconnect_scripting 13 plug-in is scriptable using xpconnect.
Plug-in Development Overview - Plugins
ng() method called inside the script element: <object id="myplugin" type="audio/wav" data="music.wav"> </object> <script type="application/javascript"> var theplugin = document.getelementbyid('myplugin'); if (theplugin && theplugin.advancetonextsong) theplugin.advancetonextsong(); else alert("plugin not installed correctly"); </script> in the past, liveconnect and later xpconnect were used to make plug-ins scriptable.
Document.documentURIObject - Web APIs
this only works for privileged (universalxpconnect) scripts, including extension code.
Document - Web APIs
WebAPIDocument
this property only has special meaning in privileged javascript code (with universalxpconnect privileges).
Node.baseURIObject - Web APIs
this property exists on all nodes (html, xul, svg, mathml, etc.), but only if the script trying to use it has universalxpconnect privileges.
Window.controllers - Web APIs
each missing removal can cause bug 415775: assertion: xpconnect is being called on a scope without a 'components' property!
JavaScript shells - JavaScript
javascript shell (js) - a command line interpreter for javascript xpcshell is an xpconnect - enabled shell, sometimes useful for mozilla development.