On Jan 23, 12:12 am, Boris Zbarsky <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > I am developing a Firefox extension for FF2.0.0.x, and I use the
> > following method to capture a request. In this way I can capture all
> > kinds of HttpRequest sent by Firefox, including normal HttpRequest and
> > XMLHttpRequest. But I only care about normal HttpRequest.
>
> I have to ask... why? What's the distinction?
>
> You might be able to look at the channel's callbacks and tell that way, but I
> can't offhand think of a use case where you'd want to only look at things that
> are _not_ XMLHttpRequest.
>
> -Boris
I tried this to distinguish XMLHttpRequest from others. And it works.
var isXMLRequest = false;
try { // we must catch any errors here due to moz bug 317448
if (aSubject.notificationCallbacks &&
aSubject.notificationCallbacks instanceof XMLHttpRequest) {
isXMLRequest = true;
}
} catch(ex) {
logWarning("http-on-modify-request unable to check instance of
nsIXMLHttpRequest [" + aSubject.URI.spec + "], ignoring...");
isXMLRequest = true;
}
if (isXMLRequest) {
// deal with AJAX-style requests here, since onStateChange knows
nothing about them
...
}
_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network