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

Side by Side Diff: lib/main.js

Issue 8559070: Integrated URL Fixer into Adblock Plus (Closed)
Patch Set: Second batch of changes Created Nov. 9, 2012, 2:33 p.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 | « defaults/typoRules.json ('k') | lib/typoAppIntegration.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This Source Code is subject to the terms of the Mozilla Public License 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 3 * version 2.0 (the "License"). You can obtain a copy of the License at
4 * http://mozilla.org/MPL/2.0/. 4 * http://mozilla.org/MPL/2.0/.
5 */ 5 */
6 6
7 /** 7 /**
8 * @fileOverview Starts up Adblock Plus 8 * @fileOverview Starts up Adblock Plus
9 */ 9 */
10 10
11 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); 11 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
12 Cu.import("resource://gre/modules/Services.jsm"); 12 Cu.import("resource://gre/modules/Services.jsm");
13 13
14 let {Prefs} = require("prefs");
14 let {TimeLine} = require("timeline"); 15 let {TimeLine} = require("timeline");
15 16
16 TimeLine.enter("Adblock Plus startup"); 17 TimeLine.enter("Adblock Plus startup");
17 registerPublicAPI(); 18 registerPublicAPI();
18 TimeLine.log("Done registering public API"); 19 TimeLine.log("Done registering public API");
19 require("filterListener"); 20 require("filterListener");
20 TimeLine.log("Done loading filter listener"); 21 TimeLine.log("Done loading filter listener");
21 require("contentPolicy"); 22 require("contentPolicy");
22 TimeLine.log("Done loading content policy"); 23 TimeLine.log("Done loading content policy");
23 require("synchronizer"); 24 require("synchronizer");
24 TimeLine.log("Done loading subscription synchronizer"); 25 TimeLine.log("Done loading subscription synchronizer");
25 require("sync"); 26 require("sync");
26 TimeLine.log("Done loading sync support"); 27 TimeLine.log("Done loading sync support");
27 require("ui"); 28 require("ui");
28 TimeLine.log("Done loading UI integration code"); 29 TimeLine.log("Done loading UI integration code");
30 if (!Prefs.correctTyposAsked || (Prefs.correctTyposAsked && Prefs.correctTypos))
31 {
32 // Do not ask to opt-in if user found setting
33 if (!Prefs.correctTyposAsked)
34 {
35 let onPrefChange = function(name)
36 {
37 if (name == "correctTypos")
38 {
39 Prefs.correctTyposAsked = true;
40 Prefs.removeListener(onPrefChange);
41 }
42 }
43
44 Prefs.addListener(onPrefChange);
45 }
Wladimir Palant 2012/11/09 14:44:31 I'm not really happy with advanced logic being mov
46
47 require("typoFixer");
48 TimeLine.log("Done loading typo correction");
49 }
50 else
51 {
52 let onPrefChange = function(name)
53 {
54 if (name == "correctTypos")
55 {
56 require("typoFixer");
57 Prefs.removeListener(onPrefChange);
58 }
59 }
60
61 Prefs.addListener(onPrefChange);
62 }
29 TimeLine.leave("Started up"); 63 TimeLine.leave("Started up");
30 64
31 function registerPublicAPI() 65 function registerPublicAPI()
32 { 66 {
33 let {addonRoot} = require("info"); 67 let {addonRoot} = require("info");
34 68
35 let uri = Services.io.newURI(addonRoot + "lib/Public.jsm", null, null); 69 let uri = Services.io.newURI(addonRoot + "lib/Public.jsm", null, null);
36 if (uri instanceof Ci.nsIMutable) 70 if (uri instanceof Ci.nsIMutable)
37 uri.mutable = false; 71 uri.mutable = false;
38 72
(...skipping 12 matching lines...) Expand all
51 85
52 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); 86 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
53 registrar.registerFactory(classID, "Adblock Plus public API URL", contractID, factory); 87 registrar.registerFactory(classID, "Adblock Plus public API URL", contractID, factory);
54 88
55 onShutdown.add(function() 89 onShutdown.add(function()
56 { 90 {
57 registrar.unregisterFactory(classID, factory); 91 registrar.unregisterFactory(classID, factory);
58 Cu.unload(uri.spec); 92 Cu.unload(uri.spec);
59 }); 93 });
60 } 94 }
OLDNEW
« no previous file with comments | « defaults/typoRules.json ('k') | lib/typoAppIntegration.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld