[Project_owners] Getting Source Tab When Listening to http-on-modify-request
Neil Deakin
enndeakin at sympatico.ca
Sat Mar 3 10:08:22 PST 2007
eric.jung at yahoo.com wrote:
> >>Actually I don't see an answer to my question...<<
>
> It would appear none are available via getInterface(), unless
> something's wrong with my test function?
>
> function getInterfaceCheck() {
> var x = new XMLHttpRequest(), CI=Components.interfaces;
> x = x.QueryInterface(CI.nsIInterfaceRequestor);
> for (i in [CI.nsIXMLHttpRequest, CI.nsIClassInfo,
> CI.nsIJSXMLHttpRequest, CI.nsIDOMEventTarget, CI.nsISupports]) {
> try {
> x.getInterface(i);
> print("got one");
> }
> catch(e) {}
> }
> }
Because you want to 'for each' not 'for'
But for most of those interfaces, except for nsIClassInfo, you can just
use instanceof:
if (x instanceof CI.nsIXMLHttpRequest) {
// do stuff
}
Neil
More information about the Project_owners
mailing list