forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1256088 - Merge mock app-info implementation into AppInfo.jsm. r=gps
- Loading branch information
Showing
34 changed files
with
246 additions
and
854 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,8 +65,6 @@ const EXPERIMENT2_XPI_SHA1 = "sha1:" + sha1File(EXPERIMENT2_PATH); | |
const EXPERIMENT3_ID = "[email protected]"; | ||
const EXPERIMENT4_ID = "[email protected]"; | ||
|
||
const DEFAULT_BUILDID = "2014060601"; | ||
|
||
const FAKE_EXPERIMENTS_1 = [ | ||
{ | ||
id: "id1", | ||
|
@@ -162,63 +160,15 @@ function getExperimentAddons(previous=false) { | |
return deferred.promise; | ||
} | ||
|
||
function createAppInfo(optionsIn) { | ||
const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1"; | ||
const XULAPPINFO_CID = Components.ID("{c763b610-9d49-455a-bbd2-ede71682a1ac}"); | ||
|
||
let options = optionsIn || {}; | ||
let id = options.id || "[email protected]"; | ||
let name = options.name || "XPCShell"; | ||
let version = options.version || "1.0"; | ||
let platformVersion = options.platformVersion || "1.0"; | ||
let date = options.date || new Date(); | ||
|
||
let buildID = options.buildID || DEFAULT_BUILDID; | ||
|
||
gAppInfo = { | ||
// nsIXULAppInfo | ||
vendor: "Mozilla", | ||
name: name, | ||
ID: id, | ||
version: version, | ||
appBuildID: buildID, | ||
platformVersion: platformVersion ? platformVersion : "1.0", | ||
platformBuildID: buildID, | ||
|
||
// nsIXULRuntime | ||
inSafeMode: false, | ||
logConsoleErrors: true, | ||
OS: "XPCShell", | ||
XPCOMABI: "noarch-spidermonkey", | ||
invalidateCachesOnRestart: function invalidateCachesOnRestart() { | ||
// Do nothing | ||
}, | ||
|
||
// nsICrashReporter | ||
annotations: {}, | ||
|
||
annotateCrashReport: function(key, data) { | ||
this.annotations[key] = data; | ||
}, | ||
|
||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, | ||
Ci.nsIXULRuntime, | ||
Ci.nsICrashReporter, | ||
Ci.nsISupports]) | ||
}; | ||
|
||
let XULAppInfoFactory = { | ||
createInstance: function (outer, iid) { | ||
if (outer != null) { | ||
throw Cr.NS_ERROR_NO_AGGREGATION; | ||
} | ||
return gAppInfo.QueryInterface(iid); | ||
} | ||
}; | ||
|
||
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); | ||
registrar.registerFactory(XULAPPINFO_CID, "XULAppInfo", | ||
XULAPPINFO_CONTRACTID, XULAppInfoFactory); | ||
function createAppInfo(ID="[email protected]", name="XPCShell", | ||
version="1.0", platformVersion="1.0") { | ||
let tmp = {}; | ||
Cu.import("resource://testing-common/AppInfo.jsm", tmp); | ||
tmp.updateAppInfo({ | ||
ID, name, version, platformVersion, | ||
crashReporter: true, | ||
}); | ||
gAppInfo = tmp.getAppInfo(); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.