Eric Plaster wrote:Yes.So does your JS block here, waiting forever?
I was wondering if you could give my code a glance and let me know what I'm doing wrong or what I need to do. Any help would be appreciated! Thanks/* Get a pointer to a service indicated by the ContractID, with given interface */
function getService(contractId, intf) {
return Components.classes[contractId].getService(Components.interfaces[intf]);
}function loadWebPage() {
// **** Set this to a small, valid file
var url = "http://www.talkware.net/";// convert to nsIURL interface.
var url_ob = Components.classes["@mozilla.org/network/standard-url;1"]
.createInstance()
.QueryInterface(Components.interfaces.nsIURL);
url_ob.spec = url;// Now open the URL.
var ioService = getService('@mozilla.org/network/io-service;1',
'nsIIOService');
var atomService = getService('@mozilla.org/atom-service;1',
'nsIAtomService');var channel = ioService.newChannelFromURI(url_ob)
.QueryInterface(Components.interfaces.nsIHTTPChannel);channel.SetRequestMethod(atomService.getAtom('GET'));
channel.SetRequestHeader(atomService.getAtom('content-type'), 'text/html');var inputStream = channel.openInputStream();
// make the input stream scriptable.
var sinputStream =
Components.classes["@mozilla.org/scriptableinputstream;1"]
.createInstance()
.QueryInterface(Components.interfaces.nsIScriptableInputStream);
sinputStream.init(inputStream);while(!sinputStream.available()) {
dump("waiting....\n");
}
Yes. I put the following line in right after the "channel.SetRequestHeader" line:Darin points out two ways around the lack of an event loop. Did you try the second approach, setting nsIHTTPChannel::openInputStreamHasEventQueue?
channel.openInputStreamHasEventQueue = false;With no effect.
Let's take this back to a newsgroup, maybe m.xpcom? Cc'ing dougt and darin.
/be
while(sinputStream.available()) {
dump("Read '" + sinputStream.read(1024) + "'\n");
}// close everything I know how!
inputStream.close();
sinputStream.close();
}
I would like to know how I would write my own event queque, but
there is no real example is js that I could find. I would like to
keep my xpapp in js as much as possible. Could someone just whip
up a little snippet of code that pulls the contents of a web page so that
I can see how it is done?
-thanks
-- ---- Eric Plaster Universal Talkware Corp Senior Software Engineer (612)843-6711 [EMAIL PROTECTED] http://www.talkware.net
S/MIME Cryptographic Signature
