Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 file, |
michael@0 | 3 | * 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 | const Cu = Components.utils; |
michael@0 | 8 | const Cr = Components.results; |
michael@0 | 9 | |
michael@0 | 10 | Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
michael@0 | 11 | Cu.import("resource://gre/modules/Services.jsm"); |
michael@0 | 12 | |
michael@0 | 13 | XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", |
michael@0 | 14 | "resource://gre/modules/PlacesUtils.jsm"); |
michael@0 | 15 | XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", |
michael@0 | 16 | "resource://gre/modules/FileUtils.jsm"); |
michael@0 | 17 | XPCOMUtils.defineLazyModuleGetter(this, "MigrationUtils", |
michael@0 | 18 | "resource:///modules/MigrationUtils.jsm"); |
michael@0 | 19 | // Initialize profile. |
michael@0 | 20 | let gProfD = do_get_profile(); |
michael@0 | 21 | |
michael@0 | 22 | // Create a fake XULAppInfo to satisfy the eventual needs of the migrators. |
michael@0 | 23 | let (XULAppInfo = { |
michael@0 | 24 | // nsIXUlAppInfo |
michael@0 | 25 | get vendor() "Mozilla", |
michael@0 | 26 | get name() "XPCShell", |
michael@0 | 27 | get ID() "xpcshell@tests.mozilla.org", |
michael@0 | 28 | get version() "1", |
michael@0 | 29 | get appBuildID() "2007010101", |
michael@0 | 30 | get platformVersion() "1.0", |
michael@0 | 31 | get platformBuildID() "2007010101", |
michael@0 | 32 | |
michael@0 | 33 | // nsIXUlRuntime (partial) |
michael@0 | 34 | get inSafeMode() false, |
michael@0 | 35 | logConsoleErrors: true, |
michael@0 | 36 | get OS() "XPCShell", |
michael@0 | 37 | get XPCOMABI() "noarch-spidermonkey", |
michael@0 | 38 | invalidateCachesOnRestart: function () {}, |
michael@0 | 39 | |
michael@0 | 40 | // nsIWinAppHelper |
michael@0 | 41 | get userCanElevate() false, |
michael@0 | 42 | |
michael@0 | 43 | QueryInterface: function (aIID) { |
michael@0 | 44 | let interfaces = [Ci.nsIXULAppInfo, Ci.nsIXULRuntime]; |
michael@0 | 45 | if ("nsIWinAppHelper" in Ci) |
michael@0 | 46 | interfaces.push(Ci.nsIWinAppHelper); |
michael@0 | 47 | if (!interfaces.some(function (v) aIID.equals(v))) |
michael@0 | 48 | throw Cr.NS_ERROR_NO_INTERFACE; |
michael@0 | 49 | return this; |
michael@0 | 50 | } |
michael@0 | 51 | }) { |
michael@0 | 52 | const CONTRACT_ID = "@mozilla.org/xre/app-info;1"; |
michael@0 | 53 | const CID = Components.ID("7685dac8-3637-4660-a544-928c5ec0e714}"); |
michael@0 | 54 | |
michael@0 | 55 | let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); |
michael@0 | 56 | registrar.registerFactory(CID, "XULAppInfo", CONTRACT_ID, { |
michael@0 | 57 | createInstance: function (aOuter, aIID) { |
michael@0 | 58 | if (aOuter != null) |
michael@0 | 59 | throw Cr.NS_ERROR_NO_AGGREGATION; |
michael@0 | 60 | return XULAppInfo.QueryInterface(aIID); |
michael@0 | 61 | }, |
michael@0 | 62 | QueryInterface: XPCOMUtils.generateQI(Ci.nsIFactory) |
michael@0 | 63 | }); |
michael@0 | 64 | } |