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

Side by Side Diff: lib/main.js

Issue 8788183: Detect and handle the case of our own typo correction extension being installed in parallel (Closed)
Patch Set: Created Nov. 20, 2012, 10:27 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
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 {TimeLine} = require("timeline"); 14 let {TimeLine} = require("timeline");
15 15
16 TimeLine.enter("Adblock Plus startup"); 16 TimeLine.enter("Adblock Plus startup");
17 let {Prefs} = require("prefs");
18 TimeLine.log("Done loading preferences");
19 registerPublicAPI(); 17 registerPublicAPI();
20 TimeLine.log("Done registering public API"); 18 TimeLine.log("Done registering public API");
21 require("filterListener"); 19 require("filterListener");
22 TimeLine.log("Done loading filter listener"); 20 TimeLine.log("Done loading filter listener");
23 require("contentPolicy"); 21 require("contentPolicy");
24 TimeLine.log("Done loading content policy"); 22 TimeLine.log("Done loading content policy");
25 require("synchronizer"); 23 require("synchronizer");
26 TimeLine.log("Done loading subscription synchronizer"); 24 TimeLine.log("Done loading subscription synchronizer");
27 require("sync"); 25 require("sync");
28 TimeLine.log("Done loading sync support"); 26 TimeLine.log("Done loading sync support");
29 require("ui"); 27 require("ui");
30 TimeLine.log("Done loading UI integration code"); 28 TimeLine.log("Done loading UI integration code");
31 if (!Prefs.correctTyposAsked || (Prefs.correctTyposAsked && Prefs.correctTypos)) 29 require("typoBootstrap");
32 { 30 TimeLine.log("Done loading typo correction");
33 require("typoFixer");
34 TimeLine.log("Done loading typo correction");
35 }
36 else
37 {
38 let onPrefChange = function(name)
39 {
40 if (name == "correctTypos")
41 {
42 require("typoFixer");
43 Prefs.removeListener(onPrefChange);
44 }
45 }
46
47 Prefs.addListener(onPrefChange);
48 }
49 TimeLine.leave("Started up"); 31 TimeLine.leave("Started up");
50 32
51 function registerPublicAPI() 33 function registerPublicAPI()
52 { 34 {
53 let {addonRoot} = require("info"); 35 let {addonRoot} = require("info");
54 36
55 let uri = Services.io.newURI(addonRoot + "lib/Public.jsm", null, null); 37 let uri = Services.io.newURI(addonRoot + "lib/Public.jsm", null, null);
56 if (uri instanceof Ci.nsIMutable) 38 if (uri instanceof Ci.nsIMutable)
57 uri.mutable = false; 39 uri.mutable = false;
58 40
(...skipping 12 matching lines...) Expand all
71 53
72 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); 54 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
73 registrar.registerFactory(classID, "Adblock Plus public API URL", contractID, factory); 55 registrar.registerFactory(classID, "Adblock Plus public API URL", contractID, factory);
74 56
75 onShutdown.add(function() 57 onShutdown.add(function()
76 { 58 {
77 registrar.unregisterFactory(classID, factory); 59 registrar.unregisterFactory(classID, factory);
78 Cu.unload(uri.spec); 60 Cu.unload(uri.spec);
79 }); 61 });
80 } 62 }
OLDNEW
« no previous file with comments | « chrome/content/ui/subscriptions.xml ('k') | lib/typoBootstrap.js » ('j') | lib/typoBootstrap.js » ('J')

Powered by Google App Engine
This is Rietveld