bug 1034360 - OCSP preferences UI: remove unnecessary part, improve necessary part r=dao

This commit is contained in:
David Keeler 2014-07-09 13:29:41 -07:00
parent d639df89f1
commit fe85da6067
10 changed files with 75 additions and 101 deletions

View File

@ -157,6 +157,29 @@ var gAdvancedPane = {
return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0;
},
/**
* security.OCSP.enabled is an integer value for legacy reasons.
* A value of 1 means OCSP is enabled. Any other value means it is disabled.
*/
readEnableOCSP: function ()
{
var preference = document.getElementById("security.OCSP.enabled");
// This is the case if the preference is the default value.
if (preference.value === undefined) {
return true;
}
return preference.value == 1;
},
/**
* See documentation for readEnableOCSP.
*/
writeEnableOCSP: function ()
{
var checkbox = document.getElementById("enableOCSP");
return checkbox.checked ? 1 : 0;
},
/**
* When the user toggles the layers.acceleration.disabled pref,
* sync its new value to the gfx.direct2d.disabled pref too.
@ -822,15 +845,6 @@ var gAdvancedPane = {
"", null);
},
/**
* Displays a dialog in which OCSP preferences can be configured.
*/
showOCSP: function ()
{
document.documentElement.openSubDialog("chrome://mozapps/content/preferences/ocsp.xul",
"", null);
},
/**
* Displays a dialog from which the user can manage his security devices.
*/

View File

@ -91,7 +91,7 @@
<preference id="browser.search.update" name="browser.search.update" type="bool"/>
<!-- Encryption tab -->
<!-- Certificates tab -->
<preference id="security.default_personal_cert" name="security.default_personal_cert" type="string"/>
<preference id="security.disable_button.openCertManager"
@ -100,6 +100,9 @@
<preference id="security.disable_button.openDeviceManager"
name="security.disable_button.openDeviceManager"
type="bool"/>
<preference id="security.OCSP.enabled"
name="security.OCSP.enabled"
type="int"/>
</preferences>
#ifdef HAVE_SHELL_SERVICE
@ -417,14 +420,20 @@
<separator/>
<checkbox id="enableOCSP"
label="&enableOCSP.label;"
accesskey="&enableOCSP.accesskey;"
onsyncfrompreference="return gAdvancedPane.readEnableOCSP();"
onsynctopreference="return gAdvancedPane.writeEnableOCSP();"
preference="security.OCSP.enabled"/>
<separator/>
<hbox>
<button id="viewCertificatesButton"
label="&viewCerts.label;" accesskey="&viewCerts.accesskey;"
oncommand="gAdvancedPane.showCertificates();"
preference="security.disable_button.openCertManager"/>
<button id="verificationButton"
label="&verify2.label;" accesskey="&verify2.accesskey;"
oncommand="gAdvancedPane.showOCSP();"/>
<button id="viewSecurityDevicesButton"
label="&viewSecurityDevices.label;" accesskey="&viewSecurityDevices.accesskey;"
oncommand="gAdvancedPane.showSecurityDevices();"

View File

@ -144,6 +144,28 @@ var gAdvancedPane = {
return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0;
},
/**
* security.OCSP.enabled is an integer value for legacy reasons.
* A value of 1 means OCSP is enabled. Any other value means it is disabled.
*/
readEnableOCSP: function ()
{
var preference = document.getElementById("security.OCSP.enabled");
// This is the case if the preference is the default value.
if (preference.value === undefined) {
return true;
}
return preference.value == 1;
},
/**
* See documentation for readEnableOCSP.
*/
writeEnableOCSP: function ()
{
var checkbox = document.getElementById("enableOCSP");
return checkbox.checked ? 1 : 0;
},
/**
* When the user toggles the layers.acceleration.disabled pref,
@ -794,16 +816,6 @@ var gAdvancedPane = {
"modal=yes", null);
},
/**
* Displays a dialog in which OCSP preferences can be configured.
*/
showOCSP: function ()
{
openDialog("chrome://mozapps/content/preferences/ocsp.xul",
"mozilla:crlmanager",
"modal=yes", null);
},
/**
* Displays a dialog from which the user can manage his security devices.
*/

View File

@ -107,7 +107,7 @@
name="browser.search.update"
type="bool"/>
<!-- Encryption tab -->
<!-- Certificates tab -->
<preference id="security.default_personal_cert"
name="security.default_personal_cert"
type="string"/>
@ -115,9 +115,14 @@
<preference id="security.disable_button.openCertManager"
name="security.disable_button.openCertManager"
type="bool"/>
<preference id="security.disable_button.openDeviceManager"
name="security.disable_button.openDeviceManager"
type="bool"/>
<preference id="security.OCSP.enabled"
name="security.OCSP.enabled"
type="int"/>
</preferences>
#ifdef HAVE_SHELL_SERVICE
@ -439,14 +444,20 @@
<separator/>
<checkbox id="enableOCSP"
label="&enableOCSP.label;"
accesskey="&enableOCSP.accesskey;"
onsyncfrompreference="return gAdvancedPane.readEnableOCSP();"
onsynctopreference="return gAdvancedPane.writeEnableOCSP();"
preference="security.OCSP.enabled"/>
<separator/>
<hbox>
<button id="viewCertificatesButton"
label="&viewCerts.label;" accesskey="&viewCerts.accesskey;"
oncommand="gAdvancedPane.showCertificates();"
preference="security.disable_button.openCertManager"/>
<button id="verificationButton"
label="&verify2.label;" accesskey="&verify2.accesskey;"
oncommand="gAdvancedPane.showOCSP();"/>
<button id="viewSecurityDevicesButton"
label="&viewSecurityDevices.label;" accesskey="&viewSecurityDevices.accesskey;"
oncommand="gAdvancedPane.showSecurityDevices();"

View File

@ -128,9 +128,9 @@
<!ENTITY certs.auto.accesskey "S">
<!ENTITY certs.ask "Ask me every time">
<!ENTITY certs.ask.accesskey "A">
<!ENTITY enableOCSP.label "Query OCSP responder servers to confirm the current validity of certificates">
<!ENTITY enableOCSP.accesskey "Q">
<!ENTITY viewCerts.label "View Certificates">
<!ENTITY viewCerts.accesskey "C">
<!ENTITY verify2.label "Validation">
<!ENTITY verify2.accesskey "V">
<!ENTITY viewSecurityDevices.label "Security Devices">
<!ENTITY viewSecurityDevices.accesskey "D">

View File

@ -1,9 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY ocspDialog.title "Certificate Validation">
<!ENTITY enableOCSP.label "Use the Online Certificate Status Protocol (OCSP) to confirm the current validity of certificates">
<!ENTITY enableOCSP.accesskey "U">
<!ENTITY requireOCSP.label "When an OCSP server connection fails, treat the certificate as invalid">
<!ENTITY requireOCSP.accesskey "W">

View File

@ -104,7 +104,6 @@
locale/@AB_CD@/mozapps/handling/handling.properties (%chrome/mozapps/handling/handling.properties)
locale/@AB_CD@/mozapps/plugins/plugins.dtd (%chrome/mozapps/plugins/plugins.dtd)
locale/@AB_CD@/mozapps/plugins/plugins.properties (%chrome/mozapps/plugins/plugins.properties)
locale/@AB_CD@/mozapps/preferences/ocsp.dtd (%chrome/mozapps/preferences/ocsp.dtd)
locale/@AB_CD@/mozapps/preferences/changemp.dtd (%chrome/mozapps/preferences/changemp.dtd)
locale/@AB_CD@/mozapps/preferences/removemp.dtd (%chrome/mozapps/preferences/removemp.dtd)
locale/@AB_CD@/mozapps/preferences/preferences.properties (%chrome/mozapps/preferences/preferences.properties)

View File

@ -4,8 +4,6 @@
toolkit.jar:
% content mozapps %content/mozapps/
content/mozapps/preferences/ocsp.js (ocsp.js)
content/mozapps/preferences/ocsp.xul (ocsp.xul)
content/mozapps/preferences/fontbuilder.js (fontbuilder.js)
content/mozapps/preferences/changemp.js (changemp.js)
content/mozapps/preferences/changemp.xul (changemp.xul)

View File

@ -1,22 +0,0 @@
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var gOCSPDialog = {
_updateUI: function (called_by) {
var securityOCSPEnabled = document.getElementById("security.OCSP.enabled");
var enableOCSP = document.getElementById("enableOCSP");
var requireOCSP = document.getElementById("requireOCSP");
if (called_by) {
securityOCSPEnabled.value = enableOCSP.checked ? 1 : 0
} else {
enableOCSP.checked = parseInt(securityOCSPEnabled.value) != 0;
}
requireOCSP.disabled = !enableOCSP.checked;
return undefined;
}
};

View File

@ -1,38 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<?xml-stylesheet href="chrome://global/skin/"?>
<!DOCTYPE prefwindow [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % ocspDTD SYSTEM "chrome://mozapps/locale/preferences/ocsp.dtd">
%brandDTD;
%ocspDTD;
]>
<prefwindow id="OCSPDialog" type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
dlgbuttons="accept,cancel"
title="&ocspDialog.title;">
<prefpane id="OCSPDialogPane" onpaneload="gOCSPDialog._updateUI(0)">
<script type="application/javascript" src="chrome://mozapps/content/preferences/ocsp.js"/>
<preferences>
<preference id="security.OCSP.enabled" name="security.OCSP.enabled" type="int"/>
<preference id="security.OCSP.require" name="security.OCSP.require" type="bool"/>
</preferences>
<checkbox id="enableOCSP"
label="&enableOCSP.label;"
accesskey="&enableOCSP.accesskey;"
oncommand="gOCSPDialog._updateUI(1)"/>
<checkbox id="requireOCSP"
preference="security.OCSP.require"
label="&requireOCSP.label;"
accesskey="&requireOCSP.accesskey;"/>
</prefpane>
</prefwindow>