I'm trying to write a simple synchronous resource loader to allow a third
party library to use chrome files. I need it to be synchronous since it is
called in callback that needs to get the result before returning to the
main loop.
Here's my code :
.................
nsresult rv;
nsCOMPtr<nsIURI> aURI;
rv = NS_NewURI(getter_AddRefs(aURI), uri.c_str());
if (NS_FAILED(rv))
return rv;
std::string content;
nsCOMPtr<nsIChannel> channel;
nsCOMPtr<nsIInputStream> is;
rv = NS_NewChannel(getter_AddRefs(channel), aURI);
if (NS_FAILED(rv))
return rv;
rv = ((channel, getter_AddRefs(is));
if (NS_FAILED(rv))
return rv;
char buf[1025];
PRUint32 read;
do {
rv = is->Read(buf, 1024, &read);
std::cerr << "Point 3" << rv << std::endl;
if (read) {
buf[read] = '\0';
content += read;
}
} while (read);
....................
It fails in the NS_ImplementChannelOpen() call, when uri is for instance
chrome://testapp/locale/string.properties
Any help appreciated !
Thanks
Fabrice
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom