зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1098077 - Add pref to disable HTTPS requirement for FxA local dev r=markh
This commit is contained in:
Родитель
b377a94fea
Коммит
2b262408ae
|
@ -856,10 +856,20 @@ FxAccountsInternal.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_requireHttps: function() {
|
||||||
|
let allowHttp = false;
|
||||||
|
try {
|
||||||
|
allowHttp = Services.prefs.getBoolPref("identity.fxaccounts.allowHttp");
|
||||||
|
} catch(e) {
|
||||||
|
// Pref doesn't exist
|
||||||
|
}
|
||||||
|
return allowHttp !== true;
|
||||||
|
},
|
||||||
|
|
||||||
// Return the URI of the remote UI flows.
|
// Return the URI of the remote UI flows.
|
||||||
getAccountsSignUpURI: function() {
|
getAccountsSignUpURI: function() {
|
||||||
let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.signup.uri");
|
let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.signup.uri");
|
||||||
if (!/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
|
if (this._requireHttps() && !/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
|
||||||
throw new Error("Firefox Accounts server must use HTTPS");
|
throw new Error("Firefox Accounts server must use HTTPS");
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
|
@ -868,7 +878,7 @@ FxAccountsInternal.prototype = {
|
||||||
// Return the URI of the remote UI flows.
|
// Return the URI of the remote UI flows.
|
||||||
getAccountsSignInURI: function() {
|
getAccountsSignInURI: function() {
|
||||||
let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.signin.uri");
|
let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.signin.uri");
|
||||||
if (!/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
|
if (this._requireHttps() && !/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
|
||||||
throw new Error("Firefox Accounts server must use HTTPS");
|
throw new Error("Firefox Accounts server must use HTTPS");
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
|
@ -878,7 +888,7 @@ FxAccountsInternal.prototype = {
|
||||||
// of the current account.
|
// of the current account.
|
||||||
promiseAccountsForceSigninURI: function() {
|
promiseAccountsForceSigninURI: function() {
|
||||||
let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.force_auth.uri");
|
let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.force_auth.uri");
|
||||||
if (!/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
|
if (this._requireHttps() && !/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
|
||||||
throw new Error("Firefox Accounts server must use HTTPS");
|
throw new Error("Firefox Accounts server must use HTTPS");
|
||||||
}
|
}
|
||||||
let currentState = this.currentAccountState;
|
let currentState = this.currentAccountState;
|
||||||
|
|
|
@ -129,6 +129,21 @@ function MockFxAccounts() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_test(function test_non_https_remote_server_uri_with_requireHttps_false() {
|
||||||
|
Services.prefs.setBoolPref(
|
||||||
|
"identity.fxaccounts.allowHttp",
|
||||||
|
true);
|
||||||
|
Services.prefs.setCharPref(
|
||||||
|
"identity.fxaccounts.remote.signup.uri",
|
||||||
|
"http://example.com/browser/browser/base/content/test/general/accounts_testRemoteCommands.html");
|
||||||
|
do_check_eq(fxAccounts.getAccountsSignUpURI(),
|
||||||
|
"http://example.com/browser/browser/base/content/test/general/accounts_testRemoteCommands.html");
|
||||||
|
|
||||||
|
Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri");
|
||||||
|
Services.prefs.clearUserPref("identity.fxaccounts.allowHttp");
|
||||||
|
run_next_test();
|
||||||
|
});
|
||||||
|
|
||||||
add_test(function test_non_https_remote_server_uri() {
|
add_test(function test_non_https_remote_server_uri() {
|
||||||
Services.prefs.setCharPref(
|
Services.prefs.setCharPref(
|
||||||
"identity.fxaccounts.remote.signup.uri",
|
"identity.fxaccounts.remote.signup.uri",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче