Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/commandLine.js

Issue 5288886037118976: Adblock Plus Crawler rewrite (Closed)
Patch Set: Addressed comments Created May 7, 2015, 12:04 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « icon64.png ('k') | lib/crawler.js » ('j') | lib/crawler.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
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 (let category of this.xpcom_categories)
29 catMan.addCategoryEntry(category, this.classDescription, this.contractID, false, true);
30
31 onShutdown.add((function()
Sebastian Noack 2015/05/07 12:33:04 Nit: I'd rather use an arrow function instead (fun
32 {
33 for (let category of this.xpcom_categories)
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();
OLDNEW
« no previous file with comments | « icon64.png ('k') | lib/crawler.js » ('j') | lib/crawler.js » ('J')

Powered by Google App Engine
This is Rietveld