A few functions are defined as a convenient API to some of JS Console internal functionalities (the API file is located at chrome/jsconsole/content/gui/js/api.js).
__SETOUT__( string_OUTPUT )
Writes its string argument to the Output panel.
__IMPORT__( string_DIRPATH , string_FILE )
Imports a JavaScript file in the global space.
First argument is the path to the directory containing the file (it can be a chrome path starting with the 'chrome://' scheme).
Second argument is the name of the file -- more files from the directory can be imported if more name arguments are appended.
__TRACE__( string_EXCEPTION , string_TRACESTOP );
Output the JavaScript stack frames in the Error panel.
First argument is any kind of message you want (e.g. the text reported by an exception handler in a try/catch construct).
Second argument is the name of a calling function leading to the __TRACE__ call, where the stack inspection will stop.
Both arguments are optional (first argument ca be skipped only if the second one is also skipped).
__ASSERT__
Global ASSERT_Tester class instance for Unit testing.
You have to specify the method name you want to call and its arguments. See the documentation on
Unit testing.
__GETDATE__()
Returns the current date formatted according to the ISO-8601 format (YYYY-MM-DDThh:mm:ss.s).
__GETXPCOM__( string_INTERFACE , string_CLASS_ID , false )
Returns an XPCOM component object according to the interface name of the first argument and the CLASS_ID of the second argument -- if the third argument is set to true, you get a service interface.
This function requires precise knowledge of the Mozilla XPCOMM technology to be used.
see
Mozilla XPCOM project.
In later releases this API will be extended.