gecko/services/sync/tests/unit/head_appinfo.js
Gregory Szorc e6caf3b308 Bug 534956 - Part 1 - Sync engine for add-ons; r=mconnor
This includes the core engine, support code, and tests. UX is not
included.
2011-12-14 17:10:34 -08:00

59 lines
1.8 KiB
JavaScript

let gSyncProfile;
do_load_httpd_js();
gSyncProfile = do_get_profile();
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
// Make sure to provide the right OS so crypto loads the right binaries
let OS = "XPCShell";
if ("@mozilla.org/windows-registry-key;1" in Cc)
OS = "WINNT";
else if ("nsILocalFileMac" in Ci)
OS = "Darwin";
else
OS = "Linux";
let XULAppInfo = {
vendor: "Mozilla",
name: "XPCShell",
ID: "xpcshell@tests.mozilla.org",
version: "1",
appBuildID: "20100621",
platformVersion: "",
platformBuildID: "20100621",
inSafeMode: false,
logConsoleErrors: true,
OS: OS,
XPCOMABI: "noarch-spidermonkey",
QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, Ci.nsIXULRuntime]),
invalidateCachesOnRestart: function invalidateCachesOnRestart() { }
};
let XULAppInfoFactory = {
createInstance: function (outer, iid) {
if (outer != null)
throw Cr.NS_ERROR_NO_AGGREGATION;
return XULAppInfo.QueryInterface(iid);
}
};
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"),
"XULAppInfo", "@mozilla.org/xre/app-info;1",
XULAppInfoFactory);
// Register resource aliases. Normally done in SyncComponents.manifest.
function addResourceAlias() {
Cu.import("resource://gre/modules/Services.jsm");
const resProt = Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
let uri;
uri = Services.io.newURI("resource:///modules/services-sync/", null, null);
resProt.setSubstitution("services-sync", uri);
uri = Services.io.newURI("resource:///modules/services-crypto/", null, null);
resProt.setSubstitution("services-crypto", uri);
}
addResourceAlias();