bug 1034360 - OCSP preferences UI: remove unnecessary part, improve necessary part r=dao
authorDavid Keeler <dkeeler@mozilla.com>
Wed, 09 Jul 2014 13:29:41 -0700
changeset 193214 d29d680876576abcc66c0742977883b27da0e0c8
parent 193213 a61e96de3acb0acba4def22f3bc9f33b70183564
child 193215 47ff2362d955f1fd1016082a738c5015a5d3342b
push id27112
push usercbook@mozilla.com
push dateThu, 10 Jul 2014 12:47:23 +0000
treeherdermozilla-central@6e9f72bdd32e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1034360
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1034360 - OCSP preferences UI: remove unnecessary part, improve necessary part r=dao
browser/components/preferences/advanced.js
browser/components/preferences/advanced.xul
browser/components/preferences/in-content/advanced.js
browser/components/preferences/in-content/advanced.xul
browser/locales/en-US/chrome/browser/preferences/advanced.dtd
toolkit/locales/en-US/chrome/mozapps/preferences/ocsp.dtd
toolkit/locales/jar.mn
toolkit/mozapps/preferences/jar.mn
toolkit/mozapps/preferences/ocsp.js
toolkit/mozapps/preferences/ocsp.xul
--- a/browser/components/preferences/advanced.js
+++ b/browser/components/preferences/advanced.js
@@ -153,16 +153,39 @@ var gAdvancedPane = {
    */
   writeCheckSpelling: function ()
   {
     var checkbox = document.getElementById("checkSpelling");
     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.
    */
   updateHardwareAcceleration: function()
   {
 #ifdef XP_WIN
     var fromPref = document.getElementById("layers.acceleration.disabled");
     var toPref = document.getElementById("gfx.direct2d.disabled");
@@ -818,25 +841,16 @@ var gAdvancedPane = {
   showCertificates: function ()
   {
     document.documentElement.openWindow("mozilla:certmanager",
                                         "chrome://pippki/content/certManager.xul",
                                         "", 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.
    */
   showSecurityDevices: function ()
   {
     document.documentElement.openWindow("mozilla:devicemanager",
                                         "chrome://pippki/content/device_manager.xul",
                                         "", null);
   }
--- a/browser/components/preferences/advanced.xul
+++ b/browser/components/preferences/advanced.xul
@@ -86,25 +86,28 @@
       <preference id="app.update.service.enabled"
                   name="app.update.service.enabled"
                   type="bool"/>
 #endif
 #endif
 
       <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"
                   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
     <stringbundle id="bundleShell" src="chrome://browser/locale/shellservice.properties"/>
     <stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
 #endif
     <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
 
@@ -412,24 +415,30 @@
               <radio label="&certs.auto;" accesskey="&certs.auto.accesskey;"
                      value="Select Automatically"/>
               <radio label="&certs.ask;" accesskey="&certs.ask.accesskey;"
                      value="Ask Every Time"/>
             </radiogroup>
 
             <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();"
                       preference="security.disable_button.openDeviceManager"/>
             </hbox>
         </tabpanel>
 
       </tabpanels>
--- a/browser/components/preferences/in-content/advanced.js
+++ b/browser/components/preferences/in-content/advanced.js
@@ -139,16 +139,38 @@ var gAdvancedPane = {
    * unchanged and represents a value not strictly allowed in UI.
    */
   writeCheckSpelling: function ()
   {
     var checkbox = document.getElementById("checkSpelling");
     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.
    */
   updateHardwareAcceleration: function()
   {
 #ifdef XP_WIN
@@ -790,26 +812,16 @@ var gAdvancedPane = {
   showCertificates: function ()
   {
     openDialog("chrome://pippki/content/certManager.xul",
                "mozilla:certmanager",
                "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.
    */
   showSecurityDevices: function ()
   {
     openDialog("chrome://pippki/content/device_manager.xul",
                "mozilla:devicemanager",
                "modal=yes", null);
   }
--- a/browser/components/preferences/in-content/advanced.xul
+++ b/browser/components/preferences/in-content/advanced.xul
@@ -102,27 +102,32 @@
               type="bool"/>
 #endif
 #endif
 
   <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"
               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
   <stringbundle id="bundleShell" src="chrome://browser/locale/shellservice.properties"/>
   <stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
 #endif
   <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
 
@@ -434,24 +439,30 @@
           <radio label="&certs.auto;" accesskey="&certs.auto.accesskey;"
                 value="Select Automatically"/>
           <radio label="&certs.ask;" accesskey="&certs.ask.accesskey;"
                 value="Ask Every Time"/>
         </radiogroup>
 
         <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();"
                   preference="security.disable_button.openDeviceManager"/>
         </hbox>
     </tabpanel>
   </tabpanels>
 </tabbox>
--- a/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
@@ -123,14 +123,14 @@
 <!ENTITY offlineAppRemove.confirm        "Remove offline data">
 
 <!ENTITY certificateTab.label            "Certificates">
 <!ENTITY certSelection.description       "When a server requests my personal certificate:">
 <!ENTITY certs.auto                      "Select one automatically">
 <!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">
deleted file mode 100644
--- a/toolkit/locales/en-US/chrome/mozapps/preferences/ocsp.dtd
+++ /dev/null
@@ -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">
--- a/toolkit/locales/jar.mn
+++ b/toolkit/locales/jar.mn
@@ -99,17 +99,16 @@
   locale/@AB_CD@/mozapps/extensions/update.dtd                    (%chrome/mozapps/extensions/update.dtd)
   locale/@AB_CD@/mozapps/extensions/update.properties             (%chrome/mozapps/extensions/update.properties)
   locale/@AB_CD@/mozapps/extensions/newaddon.dtd                  (%chrome/mozapps/extensions/newaddon.dtd)
   locale/@AB_CD@/mozapps/extensions/newaddon.properties           (%chrome/mozapps/extensions/newaddon.properties)
   locale/@AB_CD@/mozapps/handling/handling.dtd                    (%chrome/mozapps/handling/handling.dtd)
   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)
   locale/@AB_CD@/mozapps/profile/createProfileWizard.dtd          (%chrome/mozapps/profile/createProfileWizard.dtd)
   locale/@AB_CD@/mozapps/profile/profileSelection.properties      (%chrome/mozapps/profile/profileSelection.properties)
   locale/@AB_CD@/mozapps/profile/profileSelection.dtd             (%chrome/mozapps/profile/profileSelection.dtd)
   locale/@AB_CD@/mozapps/update/updates.dtd                       (%chrome/mozapps/update/updates.dtd)
   locale/@AB_CD@/mozapps/update/updates.properties                (%chrome/mozapps/update/updates.properties)
--- a/toolkit/mozapps/preferences/jar.mn
+++ b/toolkit/mozapps/preferences/jar.mn
@@ -1,13 +1,11 @@
 # 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/.
 
 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)
   content/mozapps/preferences/removemp.js                       (removemp.js)
   content/mozapps/preferences/removemp.xul                      (removemp.xul)
deleted file mode 100644
--- a/toolkit/mozapps/preferences/ocsp.js
+++ /dev/null
@@ -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;
-  }
-};
deleted file mode 100644
--- a/toolkit/mozapps/preferences/ocsp.xul
+++ /dev/null
@@ -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>