Difference between revisions of "XPConnect"

From CDOT Wiki
Jump to: navigation, search
(Discussion)
(Relevant Resources)
 
(7 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
==Description==
 
==Description==
XPConnect is a technology that is used to link XPCOM and scripting languages like Javascript together.  
+
XPConnect is a technology that is used to link [[XPCOM]] and scripting languages like Javascript together.  
  
 
==Discussion==
 
==Discussion==
XPConnect allows JavaScript objects to transparently access and manipulate XPCOM objects. It also enables JavaScript objects to present XPCOM compliant interfaces to be called by XPCOM objects. A main goal is that objects communicating from either side of an XPCOM style interface should not generally need to know or care about the implementation language of the object on the other side of the interface.
+
XPConnect allows JavaScript objects to transparently access and manipulate [[XPCOM]] objects. It also enables JavaScript objects to present [[XPCOM]] compliant interfaces to be called by [[XPCOM]] objects. A main goal is that objects communicating from either side of an [[XPCOM]] style interface should not generally need to know or care about the implementation language of the object on the other side of the interface.
  
 
XPConnect's primary reason for existence is to replace handwritten code used in places where native code needs to interact with JavaScript code. An example is the DOM module.
 
XPConnect's primary reason for existence is to replace handwritten code used in places where native code needs to interact with JavaScript code. An example is the DOM module.
  
In order for XPConnect to properly function with XPCOM interfaces, it must be declared using [[Researching_XPIDL_and_IDL_Technologies|XPIDL]].
+
In order for XPConnect to properly function with [[XPCOM]] interfaces, it must be declared using [[Researching_XPIDL_and_IDL_Technologies|XPIDL]].
  
The XPConnect does not support the scripting of MS COM objects. It also does not support any interfaces that are not declared within [[Researching_XPIDL_and_IDL_Technologies|XPIDL]]. While XPCOM objects are mainly supported, it does not support scripting of XPCOM objects that break conventions in XPCOM. E.g. non-standard return types, use of C++ default parameters, assumptions about the underlying C++ type of the object implementing a given interface, etc.
+
The XPConnect does not support the scripting of MS COM objects. It also does not support any interfaces that are not declared within [[Researching_XPIDL_and_IDL_Technologies|XPIDL]]. While [[XPCOM]] objects are mainly supported, it does not support scripting of [[XPCOM]] objects that break conventions in [[XPCOM]]. E.g. non-standard return types, use of C++ default parameters, assumptions about the underlying C++ type of the object implementing a given interface, etc.
  
 
==Relevant Resources==
 
==Relevant Resources==
Line 23: Line 23:
 
* [http://www.mozilla.org/scriptable/avoiding-leaks.html Using XPCOM in JavaScript without leaking]
 
* [http://www.mozilla.org/scriptable/avoiding-leaks.html Using XPCOM in JavaScript without leaking]
 
*[http://www.mozilla.org/scriptable/http://lxr.mozilla.org/mozilla/source/xpcom/doc/xpcom-component-registration.html Dynamic Component Registration] describes how to register your xpcom component so that it can be used from within Mozilla
 
*[http://www.mozilla.org/scriptable/http://lxr.mozilla.org/mozilla/source/xpcom/doc/xpcom-component-registration.html Dynamic Component Registration] describes how to register your xpcom component so that it can be used from within Mozilla
 +
* [http://www.w3.org/DOM/ Document Object Model (DOM)]
 +
* [http://www.mozilla.org/scriptable/roadmap.html Roadmap for XPCOM, XPConnect, XPTCall, and XPIDL]
  
 
Links to Examples:
 
Links to Examples:
* [http://www.mozilla.org/scriptable/http://lxr.mozilla.org/seamonkey/source/xpcom/sample/ Simple XPConnect Sample]
+
* [http://lxr.mozilla.org/seamonkey/source/xpcom/sample/ Simple XPConnect Sample]
* [http://www.mozilla.org/scriptable/http://lxr.mozilla.org/mozilla/source/js/src/xpconnect XPConnect source code]
+
* [http://lxr.mozilla.org/mozilla/source/js/src/xpconnect XPConnect source code]
* [http://www.w3.org/DOM/ Document Object Model (DOM)]
 
* [http://www.mozilla.org/scriptable/roadmap.html Roadmap for XPCOM, XPConnect, XPTCall, and XPIDL]
 
  
 
Links to FAQ:
 
Links to FAQ:
Line 49: Line 49:
  
 
Links to IRC Channels:  
 
Links to IRC Channels:  
* URL 1
+
* [irc://irc.mozilla.org/js #JS]
 +
* [irc://irc.mozilla.org/developers #Developers]
 +
 
  
Developed By: Vanessa Miranda & Philip Vitorino
+
Summarized By: Vanessa Miranda & Philip Vitorino

Latest revision as of 11:29, 6 October 2006

About XPConnect

Description

XPConnect is a technology that is used to link XPCOM and scripting languages like Javascript together.

Discussion

XPConnect allows JavaScript objects to transparently access and manipulate XPCOM objects. It also enables JavaScript objects to present XPCOM compliant interfaces to be called by XPCOM objects. A main goal is that objects communicating from either side of an XPCOM style interface should not generally need to know or care about the implementation language of the object on the other side of the interface.

XPConnect's primary reason for existence is to replace handwritten code used in places where native code needs to interact with JavaScript code. An example is the DOM module.

In order for XPConnect to properly function with XPCOM interfaces, it must be declared using XPIDL.

The XPConnect does not support the scripting of MS COM objects. It also does not support any interfaces that are not declared within XPIDL. While XPCOM objects are mainly supported, it does not support scripting of XPCOM objects that break conventions in XPCOM. E.g. non-standard return types, use of C++ default parameters, assumptions about the underlying C++ type of the object implementing a given interface, etc.

Relevant Resources

Links to Tutorials:

Links to Examples:

Links to FAQ:

Other Useful Links:

Links to Newsgroups:

Links to IRC Channels:


Summarized By: Vanessa Miranda & Philip Vitorino