On Sep 3, 10:54 am, Manuel Reimer <[EMAIL PROTECTED] group.org> wrote: > Hello, > > I took the following code from the proxy configuration dialog: > > Components.classes["@mozilla.org/network/protocol-proxy-service;1"]. > getService().reloadPAC(); > > If I execute this line in context of the browser window, then I get the > following error: > > Fehler: > Components.classes['[EMAIL PROTECTED]/network/protocol-proxy-service;1'] > .getService().reloadPAC is not a function > Quelldatei: chrome://navigator/content/navigator.xul > Zeile: 1 > > Why do I get this error, but the line works in the configuration dialog? > How can I get this line to work?
getService() gives you nsISupports. reloadPAC is not a method of nsISupports. So what is it a method of? good question, let's ask mxr: http://mxr.mozilla.org/seamonkey/ident?i=idl::reloadPAC It gives only once answer, that's convenient: http://mxr.mozilla.org/seamonkey/source/netwerk/base/public/nsIProtocolProxyService2.idl#46 We could guess by the filename the name of the interface, but it's safer to follow the link and verify the interface: nsIProtocolProxyService2 So, Components.classes["@mozilla.org/network/protocol-proxy-service; 1"].getService(Components.interfaces.nsIProtocolProxyService2).reloadPAC(); Using Venkman or Error console, I can verify that: 0001: Components.classes["@mozilla.org/network/protocol-proxy-service; 1"].getService(Components.interfaces.nsIProtocolProxyService2).reloadPAC $[0] = [function] [class: Function] reloadPAC reloadPAC is a function exposed in this manner. If I'm afraid of interface flattening, i can try: 0001: Components.classes["@mozilla.org/network/protocol-proxy-service; 1"].getService().nsIProtocolProxyService2.reloadPAC $[1] = [function] [class: Function] reloadPAC which also works. Note: I'm using a proxy and don't want to call the method, so I'm merely verifying existence. _______________________________________________ dev-tech-xpcom mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-xpcom
