On 5/26/06, Eric H. Jung <[EMAIL PROTECTED]> wrote:
In overlay:var proxyService = Components.classes["@mozilla.org/network/protocol-proxy-service;1"] .getService(Components.interfaces.nsIProtocolProxyService); proxyService.registerFilter(this, 0); // |this| implements applyFilter() applyFilter : function(proxyService, uri, proxy) { var p = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); } After a second FF browser is opened and the initial one is closed, this always results in the error: "ReferenceError: Components is not defined" for the Components.classes line. This happens regardless of which Components.classes object I try to use. How can this be!? How can I access the Components object in this context?
This indicates that an XPCOM component has a reference to (and called into) a JavaScript object which belongs to a closed window. At the very least, this indicates a memory leak, and you'd get a scary attention if you used a trunk build. You should always unregister any objects you registered with XPCOM APIs when they are no longer needed, in the 'unload' event handler at the latest. In this particular case, I believe you want your filter to be used during the whole life of the application. This means you should create an XPCOM component for the filter and register it with the proxy service at startup (and unregister at shutdown!) Nickolay _______________________________________________ Project_owners mailing list [email protected] http://mozdev.org/mailman/listinfo/project_owners
