A while ago in a thread in this group the following code has been
suggested to start mozilla from xpcshell:
----------- 8<--------------- cut here ----------- 8< -------------
var EventQClass =
Components.classes['@mozilla.org/event-queue-service;1'];
var EventQObj = EventQClass.getService(Components.interfaces.nsIEventQueueService);
EventQObj.createThreadEventQueue();
var AppShellClass =
Components.classes['@mozilla.org/appshell/appShellService;1'];
var AppShellObj =
AppShellClass.getService(Components.interfaces.nsIAppShellService);
var URLClass = Components.classes['@mozilla.org/network/standard-url;1'];
var URLObj = URLClass.createInstance(Components.interfaces.nsIURL);
URLObj.scheme="file";
URLObj.path="/tmp/test.xul";
AppShellObj.Initialize(null,null);
var test = new Object();
toto = AppShellObj.CreateTopLevelWindow(null,URLObj,
true,true,
Components.interfaces.nsIWebBrowserChrome.CHROME_ALL,
640,480,test);
AppShellObj.Run();
----------- 8<--------------- cut here ----------- 8< -------------
It seemed to work for some people judging by discussion. However,
here is what i get with my freshly compiled mozilla-1.0
a) If i run the code as provided i get:
:uncaught exception: [Exception... "Component returned failure code:
0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIURL.scheme]" nsresult:
"0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame ::
/tmp/test.js :: <TOP_LEVEL> :: line 14" data: no]
b) removing URLObj.scheme="file" gets me just a bit further:
TypeError: AppShellObj.Initialize is not a function
Well, i can only assume that the provided interface to AppShell has
changed
or may be i need to use another object alltogether?
In a nutshell, i will need to create an application here where i will
be able
to load and control mozilla from xpcshell using javascript or,
ideally, using
Python XPCOM (but that's for later).
Advice?