UPDATE: The methods below are still valid for use with 'window.external' but, some simplified methods have been added and they make these older methods a bit on the obsolete side.
It's recommended that you use the methods shown on this page, instead, as they make Javascript injection a lot easier to use.

Below is a full listing of the supported API methods you can call from JavaScript. When calling any of these methods via window.external, the nsISupports parameter 'window' should always be passed as 'self' (w/out the quotes) in your script. This parameter is used to determine which browser instance is responsible for running the script. The 'MethodName' parameter is used as an identifier, by your code, to determine what course of action to take.You'll notice that some method names are appended with a number, this number is the number of parameters the method can pass to MozNet.

Any MozDomElement-based instance can be returned as an nsISupports object. To return an element, set the return value equal to the elements 'DomObject', or equivalent, property. XPCom will marshal the object for you. From JavaScript, an nsISupports object is basically a DOM object, e.g. anchors, tables, div’s, applets, embeds, etc.