don't call check_buffer in browser objects
[conkeror/arlinius.git] / components / download_manager_ui.js
blob84aca474c2206f8007ac347ca67fdd82077ca54c
1 /**
2  * (C) Copyright 2008 Jeremy Maitin-Shepard
3  *
4  * Use, modification, and distribution are subject to the terms specified in the
5  * COPYING file.
6 **/
8 // Register the Conkeror download_manager_ui, which doesn't really do anything at all
10 const classID = Components.ID("{7770E0D0-C4A0-11DC-95FF-0800200C9A66}");
11 const classDescription = "Conkeror Download Manager UI";
12 const contractID = "@mozilla.org/download-manager-ui;1";
14 var module = {
16     /* This firstTime trick is used to delay the registration.  This
17      * is needed to ensure it overrides the built-in component for the
18      * same contractID (the built-in nsHelperAppDlg.js being
19      * overridden uses this as well, and as a result we have to). */
21     /* http://dietrich.ganx4.com/blog/?p=221#comment-14 */
22     /* https://bugzilla.mozilla.org/show_bug.cgi?id=253125 */
23     /* https://bugzilla.mozilla.org/show_bug.cgi?id=253136 */
25     /* We can't use XPCOMUtils because that doesn't provide this delay
26      * trick. */
28     firstTime: true,
30     // registerSelf: Register this component.
31     registerSelf: function (compMgr, fileSpec, location, type) {
32         if (this.firstTime) {
33             this.firstTime = false;
34             throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
35         }
36         compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
38         compMgr.registerFactoryLocation( classID,
39                                          classDescription,
40                                          contractID,
41                                          fileSpec,
42                                          location,
43                                          type );
44     },
46     // getClassObject: Return this component's factory object.
47     getClassObject: function (compMgr, cid, iid) {
48         if (!cid.equals(classID)) {
49             throw Components.results.NS_ERROR_NO_INTERFACE;
50         }
52         if (!iid.equals(Components.interfaces.nsIFactory)) {
53             throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
54         }
56         return this.factory;
57     },
59     /* factory object */
60     factory: {
61         createInstance: function (outer, iid) {
62             if (outer != null)
63                 throw Components.results.NS_ERROR_NO_AGGREGATION;
65             /* Return an instance of the Conkeror-scope download_helper object. */
66             var conkeror = Components.classes["@conkeror.mozdev.org/application;1"].getService().wrappedJSObject;
67             return (new conkeror.download_manager_ui()).QueryInterface(iid);
68         }
69     },
71     canUnload: function(compMgr) { return true; }
74 function NSGetModule(compMgr, fileSpec) {
75     return module;