зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 4bd5a347ff43 (bug 1557754) for causing build bustages.
This commit is contained in:
Родитель
250540ad52
Коммит
65d407b03b
|
@ -717,7 +717,6 @@ module.exports = {
|
||||||
"toolkit/content/tests/chrome/window_preferences3.xhtml",
|
"toolkit/content/tests/chrome/window_preferences3.xhtml",
|
||||||
"toolkit/content/tests/chrome/window_preferences_beforeaccept.xhtml",
|
"toolkit/content/tests/chrome/window_preferences_beforeaccept.xhtml",
|
||||||
"toolkit/content/tests/chrome/window_preferences_commandretarget.xhtml",
|
"toolkit/content/tests/chrome/window_preferences_commandretarget.xhtml",
|
||||||
"toolkit/content/tests/chrome/window_preferences_disabled.xhtml",
|
|
||||||
"toolkit/content/tests/chrome/window_preferences_onsyncfrompreference.xhtml",
|
"toolkit/content/tests/chrome/window_preferences_onsyncfrompreference.xhtml",
|
||||||
"toolkit/content/tests/chrome/window_subframe_origin.xhtml",
|
"toolkit/content/tests/chrome/window_subframe_origin.xhtml",
|
||||||
"toolkit/content/tests/chrome/window_titlebar.xhtml",
|
"toolkit/content/tests/chrome/window_titlebar.xhtml",
|
||||||
|
|
|
@ -187,9 +187,9 @@ var gConnectionsDialog = {
|
||||||
|
|
||||||
// Update http
|
// Update http
|
||||||
var httpProxyURLPref = Preferences.get("network.proxy.http");
|
var httpProxyURLPref = Preferences.get("network.proxy.http");
|
||||||
httpProxyURLPref.updateControlDisabledState(proxyTypePref.value != 1);
|
httpProxyURLPref.disabled = proxyTypePref.value != 1;
|
||||||
var httpProxyPortPref = Preferences.get("network.proxy.http_port");
|
var httpProxyPortPref = Preferences.get("network.proxy.http_port");
|
||||||
httpProxyPortPref.updateControlDisabledState(proxyTypePref.value != 1);
|
httpProxyPortPref.disabled = proxyTypePref.value != 1;
|
||||||
|
|
||||||
// Now update the other protocols
|
// Now update the other protocols
|
||||||
this.updateProtocolPrefs();
|
this.updateProtocolPrefs();
|
||||||
|
@ -197,14 +197,17 @@ var gConnectionsDialog = {
|
||||||
var shareProxiesPref = Preferences.get(
|
var shareProxiesPref = Preferences.get(
|
||||||
"network.proxy.share_proxy_settings"
|
"network.proxy.share_proxy_settings"
|
||||||
);
|
);
|
||||||
shareProxiesPref.updateControlDisabledState(proxyTypePref.value != 1);
|
shareProxiesPref.disabled =
|
||||||
|
proxyTypePref.value != 1 || shareProxiesPref.locked;
|
||||||
var autologinProxyPref = Preferences.get("signon.autologin.proxy");
|
var autologinProxyPref = Preferences.get("signon.autologin.proxy");
|
||||||
autologinProxyPref.updateControlDisabledState(proxyTypePref.value == 0);
|
autologinProxyPref.disabled =
|
||||||
|
proxyTypePref.value == 0 || autologinProxyPref.locked;
|
||||||
var noProxiesPref = Preferences.get("network.proxy.no_proxies_on");
|
var noProxiesPref = Preferences.get("network.proxy.no_proxies_on");
|
||||||
noProxiesPref.updateControlDisabledState(proxyTypePref.value == 0);
|
noProxiesPref.disabled = proxyTypePref.value == 0 || noProxiesPref.locked;
|
||||||
|
|
||||||
var autoconfigURLPref = Preferences.get("network.proxy.autoconfig_url");
|
var autoconfigURLPref = Preferences.get("network.proxy.autoconfig_url");
|
||||||
autoconfigURLPref.updateControlDisabledState(proxyTypePref.value != 2);
|
autoconfigURLPref.disabled =
|
||||||
|
proxyTypePref.value != 2 || autoconfigURLPref.locked;
|
||||||
|
|
||||||
this.updateReloadButton();
|
this.updateReloadButton();
|
||||||
|
|
||||||
|
@ -221,10 +224,9 @@ var gConnectionsDialog = {
|
||||||
var socksDNSPref = Preferences.get("network.proxy.socks_remote_dns");
|
var socksDNSPref = Preferences.get("network.proxy.socks_remote_dns");
|
||||||
var proxyTypePref = Preferences.get("network.proxy.type");
|
var proxyTypePref = Preferences.get("network.proxy.type");
|
||||||
var isDefinitelySocks4 =
|
var isDefinitelySocks4 =
|
||||||
proxyTypePref.value == 1 && socksVersionPref.value == 4;
|
!socksVersionPref.disabled && socksVersionPref.value == 4;
|
||||||
socksDNSPref.updateControlDisabledState(
|
socksDNSPref.disabled =
|
||||||
isDefinitelySocks4 || proxyTypePref.value == 0
|
isDefinitelySocks4 || proxyTypePref.value == 0 || socksDNSPref.locked;
|
||||||
);
|
|
||||||
return undefined;
|
return undefined;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -243,9 +245,8 @@ var gConnectionsDialog = {
|
||||||
var disableReloadPref = Preferences.get(
|
var disableReloadPref = Preferences.get(
|
||||||
"pref.advanced.proxies.disable_button.reload"
|
"pref.advanced.proxies.disable_button.reload"
|
||||||
);
|
);
|
||||||
disableReloadPref.updateControlDisabledState(
|
disableReloadPref.disabled =
|
||||||
proxyTypeCur != 2 || proxyType != 2 || typedURL != pacURL
|
proxyTypeCur != 2 || proxyType != 2 || typedURL != pacURL;
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
readProxyType() {
|
readProxyType() {
|
||||||
|
@ -288,15 +289,11 @@ var gConnectionsDialog = {
|
||||||
proxyServerURLPref.updateElements();
|
proxyServerURLPref.updateElements();
|
||||||
proxyPortPref.updateElements();
|
proxyPortPref.updateElements();
|
||||||
let prefIsShared = proxyPrefs[i] != "socks" && shareProxiesPref.value;
|
let prefIsShared = proxyPrefs[i] != "socks" && shareProxiesPref.value;
|
||||||
proxyServerURLPref.updateControlDisabledState(
|
proxyServerURLPref.disabled = proxyTypePref.value != 1 || prefIsShared;
|
||||||
proxyTypePref.value != 1 || prefIsShared
|
proxyPortPref.disabled = proxyServerURLPref.disabled;
|
||||||
);
|
|
||||||
proxyPortPref.updateControlDisabledState(
|
|
||||||
proxyTypePref.value != 1 || prefIsShared
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
var socksVersionPref = Preferences.get("network.proxy.socks_version");
|
var socksVersionPref = Preferences.get("network.proxy.socks_version");
|
||||||
socksVersionPref.updateControlDisabledState(proxyTypePref.value != 1);
|
socksVersionPref.disabled = proxyTypePref.value != 1;
|
||||||
this.updateDNSPref();
|
this.updateDNSPref();
|
||||||
return undefined;
|
return undefined;
|
||||||
},
|
},
|
||||||
|
@ -450,7 +447,7 @@ var gConnectionsDialog = {
|
||||||
// called to update checked element property to reflect current pref value
|
// called to update checked element property to reflect current pref value
|
||||||
let enabled = this.isDnsOverHttpsEnabled();
|
let enabled = this.isDnsOverHttpsEnabled();
|
||||||
let uriPref = Preferences.get("network.trr.uri");
|
let uriPref = Preferences.get("network.trr.uri");
|
||||||
uriPref.updateControlDisabledState(!enabled || this.isDnsOverHttpsLocked());
|
uriPref.disabled = !enabled || this.isDnsOverHttpsLocked();
|
||||||
// this is the first signal we get when the prefs are available, so
|
// this is the first signal we get when the prefs are available, so
|
||||||
// lazy-init if appropriate
|
// lazy-init if appropriate
|
||||||
if (!this._areTrrPrefsReady) {
|
if (!this._areTrrPrefsReady) {
|
||||||
|
|
|
@ -345,7 +345,7 @@ const Preferences = (window.Preferences = (function() {
|
||||||
window.addEventListener("unload", Preferences, { once: true });
|
window.addEventListener("unload", Preferences, { once: true });
|
||||||
|
|
||||||
class Preference extends EventEmitter {
|
class Preference extends EventEmitter {
|
||||||
constructor({ id, type, inverted }) {
|
constructor({ id, type, inverted, disabled }) {
|
||||||
super();
|
super();
|
||||||
this.on("change", this.onChange.bind(this));
|
this.on("change", this.onChange.bind(this));
|
||||||
|
|
||||||
|
@ -357,6 +357,7 @@ const Preferences = (window.Preferences = (function() {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.inverted = !!inverted;
|
this.inverted = !!inverted;
|
||||||
|
this._disabled = !!disabled;
|
||||||
|
|
||||||
// In non-instant apply mode, we must try and use the last saved state
|
// In non-instant apply mode, we must try and use the last saved state
|
||||||
// from any previous opens of a child dialog instead of the value from
|
// from any previous opens of a child dialog instead of the value from
|
||||||
|
@ -532,12 +533,16 @@ const Preferences = (window.Preferences = (function() {
|
||||||
return Services.prefs.prefIsLocked(this.id);
|
return Services.prefs.prefIsLocked(this.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateControlDisabledState(val) {
|
get disabled() {
|
||||||
if (!this.id) {
|
return this._disabled;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
val = val || this.locked;
|
set disabled(val) {
|
||||||
|
this._disabled = !!val;
|
||||||
|
|
||||||
|
if (!this.id) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
const elements = getElementsByAttribute("preference", this.id);
|
const elements = getElementsByAttribute("preference", this.id);
|
||||||
for (const element of elements) {
|
for (const element of elements) {
|
||||||
|
@ -548,6 +553,8 @@ const Preferences = (window.Preferences = (function() {
|
||||||
label.disabled = val;
|
label.disabled = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasUserValue() {
|
get hasUserValue() {
|
||||||
|
|
|
@ -43,7 +43,6 @@ support-files =
|
||||||
window_preferences2.xhtml
|
window_preferences2.xhtml
|
||||||
window_preferences3.xhtml
|
window_preferences3.xhtml
|
||||||
window_preferences_commandretarget.xhtml
|
window_preferences_commandretarget.xhtml
|
||||||
window_preferences_disabled.xhtml
|
|
||||||
window_screenPosSize.xhtml
|
window_screenPosSize.xhtml
|
||||||
window_showcaret.xhtml
|
window_showcaret.xhtml
|
||||||
window_subframe_origin.xhtml
|
window_subframe_origin.xhtml
|
||||||
|
|
|
@ -413,15 +413,6 @@
|
||||||
ok(!GetPreference(aPrefWindow, "tests.static_preference_bool").value, "redirected command bool");
|
ok(!GetPreference(aPrefWindow, "tests.static_preference_bool").value, "redirected command bool");
|
||||||
}
|
}
|
||||||
|
|
||||||
function RunCheckDisabled(aPrefWindow)
|
|
||||||
{
|
|
||||||
ok(!GetXULElement(aPrefWindow, "disabled_checkbox").disabled, "Checkbox should be enabled");
|
|
||||||
GetPreference(aPrefWindow, "tests.disabled_preference_bool").updateControlDisabledState(true);
|
|
||||||
ok(GetXULElement(aPrefWindow, "disabled_checkbox").disabled, "Checkbox should be disabled");
|
|
||||||
GetPreference(aPrefWindow, "tests.locked_preference_bool").updateControlDisabledState(false);;
|
|
||||||
ok(GetXULElement(aPrefWindow, "locked_checkbox").disabled, "Locked checkbox should stay disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
function RunResetPrefTest(aPrefWindow)
|
function RunResetPrefTest(aPrefWindow)
|
||||||
{
|
{
|
||||||
// try resetting the prefs to default values
|
// try resetting the prefs to default values
|
||||||
|
@ -508,21 +499,11 @@
|
||||||
window.docShell.rootTreeItem.domWindow.openDialog("window_preferences_commandretarget.xhtml", "", "modal", RunCheckCommandRedirect, true);
|
window.docShell.rootTreeItem.domWindow.openDialog("window_preferences_commandretarget.xhtml", "", "modal", RunCheckCommandRedirect, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function RunTestDisabled()
|
|
||||||
{
|
|
||||||
// Because this pref is on the default branch and locked, we need to set it before opening the dialog.
|
|
||||||
const defaultBranch = kPref.getDefaultBranch("");
|
|
||||||
defaultBranch.setBoolPref("tests.locked_preference_bool", true);
|
|
||||||
defaultBranch.lockPref("tests.locked_preference_bool");
|
|
||||||
window.docShell.rootTreeItem.domWindow.openDialog("window_preferences_disabled.xhtml", "", "modal", RunCheckDisabled, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function RunTest()
|
function RunTest()
|
||||||
{
|
{
|
||||||
RunTestInstant();
|
RunTestInstant();
|
||||||
RunTestNonInstant();
|
RunTestNonInstant();
|
||||||
RunTestCommandRedirect();
|
RunTestCommandRedirect();
|
||||||
RunTestDisabled();
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
]]>
|
]]>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче