michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components; michael@0: michael@0: let gSyncProfile; michael@0: michael@0: gSyncProfile = do_get_profile(); michael@0: michael@0: // Init FormHistoryStartup and pretend we opened a profile. michael@0: let fhs = Cc["@mozilla.org/satchel/form-history-startup;1"] michael@0: .getService(Ci.nsIObserver); michael@0: fhs.observe(null, "profile-after-change", null); michael@0: michael@0: michael@0: Cu.import("resource://gre/modules/XPCOMUtils.jsm"); michael@0: michael@0: // Make sure to provide the right OS so crypto loads the right binaries michael@0: let OS = "XPCShell"; michael@0: if ("@mozilla.org/windows-registry-key;1" in Cc) michael@0: OS = "WINNT"; michael@0: else if ("nsILocalFileMac" in Ci) michael@0: OS = "Darwin"; michael@0: else michael@0: OS = "Linux"; michael@0: michael@0: let XULAppInfo = { michael@0: vendor: "Mozilla", michael@0: name: "XPCShell", michael@0: ID: "xpcshell@tests.mozilla.org", michael@0: version: "1", michael@0: appBuildID: "20100621", michael@0: platformVersion: "", michael@0: platformBuildID: "20100621", michael@0: inSafeMode: false, michael@0: logConsoleErrors: true, michael@0: OS: OS, michael@0: XPCOMABI: "noarch-spidermonkey", michael@0: QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, Ci.nsIXULRuntime]), michael@0: invalidateCachesOnRestart: function invalidateCachesOnRestart() { } michael@0: }; michael@0: michael@0: let XULAppInfoFactory = { michael@0: createInstance: function (outer, iid) { michael@0: if (outer != null) michael@0: throw Cr.NS_ERROR_NO_AGGREGATION; michael@0: return XULAppInfo.QueryInterface(iid); michael@0: } michael@0: }; michael@0: michael@0: let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); michael@0: registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"), michael@0: "XULAppInfo", "@mozilla.org/xre/app-info;1", michael@0: XULAppInfoFactory); michael@0: michael@0: michael@0: // Register resource aliases. Normally done in SyncComponents.manifest. michael@0: function addResourceAlias() { michael@0: Cu.import("resource://gre/modules/Services.jsm"); michael@0: const resProt = Services.io.getProtocolHandler("resource") michael@0: .QueryInterface(Ci.nsIResProtocolHandler); michael@0: for each (let s in ["common", "sync", "crypto"]) { michael@0: let uri = Services.io.newURI("resource://gre/modules/services-" + s + "/", null, michael@0: null); michael@0: resProt.setSubstitution("services-" + s, uri); michael@0: } michael@0: } michael@0: addResourceAlias();