Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | const Cc = Components.classes; |
michael@0 | 6 | const Ci = Components.interfaces; |
michael@0 | 7 | |
michael@0 | 8 | Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); |
michael@0 | 9 | |
michael@0 | 10 | #include ./content/listmanager.js |
michael@0 | 11 | |
michael@0 | 12 | var modScope = this; |
michael@0 | 13 | function Init() { |
michael@0 | 14 | // Pull the library in. |
michael@0 | 15 | var jslib = Cc["@mozilla.org/url-classifier/jslib;1"] |
michael@0 | 16 | .getService().wrappedJSObject; |
michael@0 | 17 | Function.prototype.inherits = jslib.Function.prototype.inherits; |
michael@0 | 18 | modScope.G_Preferences = jslib.G_Preferences; |
michael@0 | 19 | modScope.G_PreferenceObserver = jslib.G_PreferenceObserver; |
michael@0 | 20 | modScope.G_ObserverServiceObserver = jslib.G_ObserverServiceObserver; |
michael@0 | 21 | modScope.G_Debug = jslib.G_Debug; |
michael@0 | 22 | modScope.G_Assert = jslib.G_Assert; |
michael@0 | 23 | modScope.G_debugService = jslib.G_debugService; |
michael@0 | 24 | modScope.G_Alarm = jslib.G_Alarm; |
michael@0 | 25 | modScope.BindToObject = jslib.BindToObject; |
michael@0 | 26 | modScope.PROT_XMLFetcher = jslib.PROT_XMLFetcher; |
michael@0 | 27 | modScope.RequestBackoff = jslib.RequestBackoff; |
michael@0 | 28 | |
michael@0 | 29 | // We only need to call Init once. |
michael@0 | 30 | modScope.Init = function() {}; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function RegistrationData() |
michael@0 | 34 | { |
michael@0 | 35 | } |
michael@0 | 36 | RegistrationData.prototype = { |
michael@0 | 37 | classID: Components.ID("{ca168834-cc00-48f9-b83c-fd018e58cae3}"), |
michael@0 | 38 | _xpcom_factory: { |
michael@0 | 39 | createInstance: function(outer, iid) { |
michael@0 | 40 | if (outer != null) |
michael@0 | 41 | throw Components.results.NS_ERROR_NO_AGGREGATION; |
michael@0 | 42 | Init(); |
michael@0 | 43 | return (new PROT_ListManager()).QueryInterface(iid); |
michael@0 | 44 | } |
michael@0 | 45 | }, |
michael@0 | 46 | }; |
michael@0 | 47 | |
michael@0 | 48 | this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RegistrationData]); |