Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * This Source Code is subject to the terms of the Mozilla Public License | |
3 * version 2.0 (the "License"). You can obtain a copy of the License at | |
4 * http://mozilla.org/MPL/2.0/. | |
5 */ | |
6 | |
7 /** | |
8 * @module commandLine | |
saroyanm
2015/05/04 18:13:43
I think this should be file overview, maybe smth l
Sebastian Noack
2015/05/04 20:39:01
If this is actually a module, then there should be
saroyanm
2015/05/05 09:36:39
fair enough.
| |
9 */ | |
10 | |
11 Cu.import("resource://gre/modules/Services.jsm"); | |
12 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | |
13 | |
14 let CommandLineHandler = | |
15 { | |
16 // Starting the entry with "k" makes it have slightly higher priority than def ault command line handlers. | |
17 classDescription: "k-abpcrawler", | |
18 contractID: "@adblockplus.org/abpcrawler/cmdline;1", | |
19 classID: Components.ID("{973636c2-e842-11e4-b02c-1681e6b88ec1}"), | |
20 xpcom_categories: ["command-line-handler"], | |
21 | |
22 init: function() | |
23 { | |
24 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); | |
25 registrar.registerFactory(this.classID, this.classDescription, this.contract ID, this); | |
26 | |
27 let catMan = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryM anager); | |
28 for each (let category in this.xpcom_categories) | |
saroyanm
2015/05/04 18:13:43
for each in has been deprecated:
https://developer
Wladimir Palant
2015/05/07 00:04:59
Done.
| |
29 catMan.addCategoryEntry(category, this.classDescription, this.contractID, false, true); | |
30 | |
31 onShutdown.add((function() | |
32 { | |
33 for each (let category in this.xpcom_categories) | |
saroyanm
2015/05/04 18:13:43
Please use For...of instead.
Wladimir Palant
2015/05/07 00:04:59
Done.
| |
34 catMan.deleteCategoryEntry(category, this.classDescription, false); | |
35 | |
36 registrar.unregisterFactory(this.classID, this); | |
37 }).bind(this)); | |
38 }, | |
39 | |
40 createInstance: function(outer, iid) | |
41 { | |
42 if (outer) | |
43 throw Cr.NS_ERROR_NO_AGGREGATION; | |
44 return this.QueryInterface(iid); | |
45 }, | |
46 | |
47 helpInfo: " -crawler-port Port that ABP Crawler should communicate to\n" , | |
48 | |
49 handle: function(cmdline) | |
50 { | |
51 let port = cmdline.handleFlagWithParam("crawler-port", false); | |
52 if (port != null) | |
53 require("main").startup(parseInt(port)); | |
54 }, | |
55 | |
56 QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler, Ci.nsIFactory ]) | |
57 }; | |
58 | |
59 CommandLineHandler.init(); | |
OLD | NEW |