michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: const Cu = Components.utils; michael@0: const Cr = Components.results; michael@0: michael@0: Cu.import("resource://gre/modules/XPCOMUtils.jsm"); michael@0: Cu.import("resource://gre/modules/Services.jsm"); michael@0: michael@0: XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", michael@0: "resource://gre/modules/PlacesUtils.jsm"); michael@0: XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", michael@0: "resource://gre/modules/FileUtils.jsm"); michael@0: XPCOMUtils.defineLazyModuleGetter(this, "MigrationUtils", michael@0: "resource:///modules/MigrationUtils.jsm"); michael@0: // Initialize profile. michael@0: let gProfD = do_get_profile(); michael@0: michael@0: // Create a fake XULAppInfo to satisfy the eventual needs of the migrators. michael@0: let (XULAppInfo = { michael@0: // nsIXUlAppInfo michael@0: get vendor() "Mozilla", michael@0: get name() "XPCShell", michael@0: get ID() "xpcshell@tests.mozilla.org", michael@0: get version() "1", michael@0: get appBuildID() "2007010101", michael@0: get platformVersion() "1.0", michael@0: get platformBuildID() "2007010101", michael@0: michael@0: // nsIXUlRuntime (partial) michael@0: get inSafeMode() false, michael@0: logConsoleErrors: true, michael@0: get OS() "XPCShell", michael@0: get XPCOMABI() "noarch-spidermonkey", michael@0: invalidateCachesOnRestart: function () {}, michael@0: michael@0: // nsIWinAppHelper michael@0: get userCanElevate() false, michael@0: michael@0: QueryInterface: function (aIID) { michael@0: let interfaces = [Ci.nsIXULAppInfo, Ci.nsIXULRuntime]; michael@0: if ("nsIWinAppHelper" in Ci) michael@0: interfaces.push(Ci.nsIWinAppHelper); michael@0: if (!interfaces.some(function (v) aIID.equals(v))) michael@0: throw Cr.NS_ERROR_NO_INTERFACE; michael@0: return this; michael@0: } michael@0: }) { michael@0: const CONTRACT_ID = "@mozilla.org/xre/app-info;1"; michael@0: const CID = Components.ID("7685dac8-3637-4660-a544-928c5ec0e714}"); michael@0: michael@0: let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); michael@0: registrar.registerFactory(CID, "XULAppInfo", CONTRACT_ID, { michael@0: createInstance: function (aOuter, aIID) { michael@0: if (aOuter != null) michael@0: throw Cr.NS_ERROR_NO_AGGREGATION; michael@0: return XULAppInfo.QueryInterface(aIID); michael@0: }, michael@0: QueryInterface: XPCOMUtils.generateQI(Ci.nsIFactory) michael@0: }); michael@0: }