diff options
author | Ruben Rodriguez <ruben@gnu.org> | 2014-10-20 02:24:51 +0200 |
---|---|---|
committer | Ruben Rodriguez <ruben@gnu.org> | 2014-10-20 02:24:51 +0200 |
commit | 6e7918b6ccb69876d339a320091fdee811445395 (patch) | |
tree | 31cb88ee438d652fddefca1193f70289a8b3dcc8 /data/extensions/spyblock@gnu.org/lib/main.js | |
parent | 60e5b13c35d4d3ba21bb03b026750a0a414f6c77 (diff) |
Generalize data directory
Diffstat (limited to 'data/extensions/spyblock@gnu.org/lib/main.js')
-rw-r--r-- | data/extensions/spyblock@gnu.org/lib/main.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/data/extensions/spyblock@gnu.org/lib/main.js b/data/extensions/spyblock@gnu.org/lib/main.js new file mode 100644 index 0000000..f18cc05 --- /dev/null +++ b/data/extensions/spyblock@gnu.org/lib/main.js @@ -0,0 +1,73 @@ +/* + * This file is part of Adblock Plus <http://adblockplus.org/>, + * Copyright (C) 2006-2014 Eyeo GmbH + * + * Adblock Plus is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * Adblock Plus is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. + */ + +/** + * @fileOverview Starts up Adblock Plus + */ + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); + +let {TimeLine} = require("timeline"); + +TimeLine.enter("Adblock Plus startup"); +registerPublicAPI(); +TimeLine.log("Done registering public API"); +require("filterListener"); +TimeLine.log("Done loading filter listener"); +require("contentPolicy"); +TimeLine.log("Done loading content policy"); +require("synchronizer"); +TimeLine.log("Done loading subscription synchronizer"); +require("notification"); +TimeLine.log("Done loading notification downloader"); +require("sync"); +TimeLine.log("Done loading sync support"); +require("ui"); +TimeLine.log("Done loading UI integration code"); +TimeLine.leave("Started up"); + +function registerPublicAPI() +{ + let {addonRoot} = require("info"); + + let uri = Services.io.newURI(addonRoot + "lib/Public.jsm", null, null); + if (uri instanceof Ci.nsIMutable) + uri.mutable = false; + + let classID = Components.ID("5e447bce-1dd2-11b2-b151-ec21c2b6a135"); + let contractID = "@adblockplus.org/abp/public;1"; + let factory = + { + createInstance: function(outer, iid) + { + if (outer) + throw Cr.NS_ERROR_NO_AGGREGATION; + return uri.QueryInterface(iid); + }, + QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory]) + }; + + let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); + registrar.registerFactory(classID, "Adblock Plus public API URL", contractID, factory); + + onShutdown.add(function() + { + registrar.unregisterFactory(classID, factory); + Cu.unload(uri.spec); + }); +} |