Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components; |
michael@0 | 5 | |
michael@0 | 6 | let gSyncProfile; |
michael@0 | 7 | |
michael@0 | 8 | gSyncProfile = do_get_profile(); |
michael@0 | 9 | |
michael@0 | 10 | // Init FormHistoryStartup and pretend we opened a profile. |
michael@0 | 11 | let fhs = Cc["@mozilla.org/satchel/form-history-startup;1"] |
michael@0 | 12 | .getService(Ci.nsIObserver); |
michael@0 | 13 | fhs.observe(null, "profile-after-change", null); |
michael@0 | 14 | |
michael@0 | 15 | |
michael@0 | 16 | Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
michael@0 | 17 | |
michael@0 | 18 | // Make sure to provide the right OS so crypto loads the right binaries |
michael@0 | 19 | let OS = "XPCShell"; |
michael@0 | 20 | if ("@mozilla.org/windows-registry-key;1" in Cc) |
michael@0 | 21 | OS = "WINNT"; |
michael@0 | 22 | else if ("nsILocalFileMac" in Ci) |
michael@0 | 23 | OS = "Darwin"; |
michael@0 | 24 | else |
michael@0 | 25 | OS = "Linux"; |
michael@0 | 26 | |
michael@0 | 27 | let XULAppInfo = { |
michael@0 | 28 | vendor: "Mozilla", |
michael@0 | 29 | name: "XPCShell", |
michael@0 | 30 | ID: "xpcshell@tests.mozilla.org", |
michael@0 | 31 | version: "1", |
michael@0 | 32 | appBuildID: "20100621", |
michael@0 | 33 | platformVersion: "", |
michael@0 | 34 | platformBuildID: "20100621", |
michael@0 | 35 | inSafeMode: false, |
michael@0 | 36 | logConsoleErrors: true, |
michael@0 | 37 | OS: OS, |
michael@0 | 38 | XPCOMABI: "noarch-spidermonkey", |
michael@0 | 39 | QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, Ci.nsIXULRuntime]), |
michael@0 | 40 | invalidateCachesOnRestart: function invalidateCachesOnRestart() { } |
michael@0 | 41 | }; |
michael@0 | 42 | |
michael@0 | 43 | let XULAppInfoFactory = { |
michael@0 | 44 | createInstance: function (outer, iid) { |
michael@0 | 45 | if (outer != null) |
michael@0 | 46 | throw Cr.NS_ERROR_NO_AGGREGATION; |
michael@0 | 47 | return XULAppInfo.QueryInterface(iid); |
michael@0 | 48 | } |
michael@0 | 49 | }; |
michael@0 | 50 | |
michael@0 | 51 | let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); |
michael@0 | 52 | registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"), |
michael@0 | 53 | "XULAppInfo", "@mozilla.org/xre/app-info;1", |
michael@0 | 54 | XULAppInfoFactory); |
michael@0 | 55 | |
michael@0 | 56 | |
michael@0 | 57 | // Register resource aliases. Normally done in SyncComponents.manifest. |
michael@0 | 58 | function addResourceAlias() { |
michael@0 | 59 | Cu.import("resource://gre/modules/Services.jsm"); |
michael@0 | 60 | const resProt = Services.io.getProtocolHandler("resource") |
michael@0 | 61 | .QueryInterface(Ci.nsIResProtocolHandler); |
michael@0 | 62 | for each (let s in ["common", "sync", "crypto"]) { |
michael@0 | 63 | let uri = Services.io.newURI("resource://gre/modules/services-" + s + "/", null, |
michael@0 | 64 | null); |
michael@0 | 65 | resProt.setSubstitution("services-" + s, uri); |
michael@0 | 66 | } |
michael@0 | 67 | } |
michael@0 | 68 | addResourceAlias(); |