forked from mirrors/gecko-dev
Backed out changeset 17d4c013ed92 (bug 1817183) Backed out changeset cfed8d9c23f3 (bug 1817183) Backed out changeset 62fe2f589efe (bug 1817182) Backed out changeset 557bd773fb85 (bug 1817179) Backed out changeset 7f8a7865868b (bug 1816934) Backed out changeset d6c1d4c0d2a0 (bug 1816934)
55 lines
1.9 KiB
JavaScript
55 lines
1.9 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
"use strict";
|
|
|
|
const { FxAccounts } = ChromeUtils.import(
|
|
"resource://gre/modules/FxAccounts.jsm"
|
|
);
|
|
|
|
add_task(
|
|
async function test_non_https_remote_server_uri_with_requireHttps_false() {
|
|
Services.prefs.setBoolPref("identity.fxaccounts.allowHttp", true);
|
|
Services.prefs.setCharPref(
|
|
"identity.fxaccounts.remote.root",
|
|
"http://example.com/"
|
|
);
|
|
Assert.equal(
|
|
await FxAccounts.config.promiseConnectAccountURI("test"),
|
|
"http://example.com/?context=null&entrypoint=test&action=email&service=sync"
|
|
);
|
|
|
|
Services.prefs.clearUserPref("identity.fxaccounts.remote.root");
|
|
Services.prefs.clearUserPref("identity.fxaccounts.allowHttp");
|
|
}
|
|
);
|
|
|
|
add_task(async function test_non_https_remote_server_uri() {
|
|
Services.prefs.setCharPref(
|
|
"identity.fxaccounts.remote.root",
|
|
"http://example.com/"
|
|
);
|
|
await Assert.rejects(
|
|
FxAccounts.config.promiseConnectAccountURI(),
|
|
/Firefox Accounts server must use HTTPS/
|
|
);
|
|
Services.prefs.clearUserPref("identity.fxaccounts.remote.root");
|
|
});
|
|
|
|
add_task(async function test_is_production_config() {
|
|
// should start with no auto-config URL.
|
|
Assert.ok(!FxAccounts.config.getAutoConfigURL());
|
|
// which means we are using prod.
|
|
Assert.ok(FxAccounts.config.isProductionConfig());
|
|
|
|
// Set an auto-config URL.
|
|
Services.prefs.setCharPref("identity.fxaccounts.autoconfig.uri", "http://x");
|
|
Assert.equal(FxAccounts.config.getAutoConfigURL(), "http://x");
|
|
Assert.ok(!FxAccounts.config.isProductionConfig());
|
|
|
|
// Clear the auto-config URL, but set one of the other config params.
|
|
Services.prefs.clearUserPref("identity.fxaccounts.autoconfig.uri");
|
|
Services.prefs.setCharPref("identity.sync.tokenserver.uri", "http://t");
|
|
Assert.ok(!FxAccounts.config.isProductionConfig());
|
|
Services.prefs.clearUserPref("identity.sync.tokenserver.uri");
|
|
});
|