utils.js: send_http_request: eliminate some warnings
[conkeror.git] / components / download_manager_ui.js
blobaef682dd43d69cac0d92271aeab834b00498f658
1 // Register the Conkeror download_manager_ui, which doesn't really do anything at all
3 const classID = Components.ID("{7770E0D0-C4A0-11DC-95FF-0800200C9A66}");
4 const classDescription = "Conkeror Download Manager UI";
5 const contractID = "@mozilla.org/download-manager-ui;1";
7 var module = {
9     /* This firstTime trick is used to delay the registration.  This
10      * is needed to ensure it overrides the built-in component for the
11      * same contractID (the built-in nsHelperAppDlg.js being
12      * overridden uses this as well, and as a result we have to). */
14     /* http://dietrich.ganx4.com/blog/?p=221#comment-14 */
15     /* https://bugzilla.mozilla.org/show_bug.cgi?id=253125 */
16     /* https://bugzilla.mozilla.org/show_bug.cgi?id=253136 */
18     /* We can't use XPCOMUtils because that doesn't provide this delay
19      * trick. */
21     firstTime: true,
23     // registerSelf: Register this component.
24     registerSelf: function (compMgr, fileSpec, location, type) {
25         if (this.firstTime) {
26             this.firstTime = false;
27             throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
28         }
29         compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
31         compMgr.registerFactoryLocation( classID,
32                                          classDescription,
33                                          contractID,
34                                          fileSpec,
35                                          location,
36                                          type );
37     },
39     // getClassObject: Return this component's factory object.
40     getClassObject: function (compMgr, cid, iid) {
41         if (!cid.equals(classID)) {
42             throw Components.results.NS_ERROR_NO_INTERFACE;
43         }
45         if (!iid.equals(Components.interfaces.nsIFactory)) {
46             throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
47         }
49         return this.factory;
50     },
52     /* factory object */
53     factory: {
54         createInstance: function (outer, iid) {
55             if (outer != null)
56                 throw Components.results.NS_ERROR_NO_AGGREGATION;
58             /* Return an instance of the Conkeror-scope download_helper object. */
59             var conkeror = Components.classes["@conkeror.mozdev.org/application;1"].getService().wrappedJSObject;
60             return (new conkeror.download_manager_ui()).QueryInterface(iid);
61         }
62     },
64     canUnload: function(compMgr) { return true; },
67 function NSGetModule(compMgr, fileSpec) {
68     return module;