Boris Zbarsky wrote:
Michael Vincent van Rantwijk wrote:
It's "available" at any time. If you're asking at what point it
could depend on what the server returned, that's after OnStartRequest
or after open() returns.
I hoped that, but that's not the case because it throws JS errors on
the JS console if you try to read it in method onStateChange in
tabbrowser.xml
Details? What sort of errors?
This:
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) {
if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
if (aStateFlags & nsIWebProgressListener.STATE_START) {
const nsIChannel = Components.interfaces.nsIChannel;
var channel = aRequest.QueryInterface(nsIChannel);
dump("\nchannel.contentType: " + channel.contentType);
Results in this error:
Error: [JavaScript Error: "[Exception... "Component returned failure
code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIChannel.contentType]" nsresult: "0x80040111
(NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
<snip />
What makes you think the contentDocument is guaranteed to be initialized
before the document is fully parsed? At the moment this happens to be
true, but I don't believe this is guaranteed anywhere.
I don't think that there's anything guaranteed to work in this huge and
constantly changing code base, but at least it works right now.
BTW: I seem to run into the same kind of problems when I replace the
documentElement, because that doesn't seem work to work in all builds.
p.s. it would have been really nice if we'd had some preferences to
specify the XMLPrettyprint XBL/Stylesheet. Yeah, we can now disable
pretty print, with a pref, but that is not enough for us.
Michael
_______________________________________________
Mozilla-netlib mailing list
Mozilla-netlib@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-netlib