Bug 1672159 - remove settingsCHange.dtd which is unneeded since bug 1668284. r=darktrojan
☠☠ backed out by 73f69fd3bf3c ☠ ☠
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Wed, 21 Oct 2020 13:17:59 +0300
changeset 30880 f14aad7b8928a5cac98c3b984ffe1a25ed28d941
parent 30879 d255a7f1770188b951f9fafc98531e8af53e8e2c
child 30881 1324593cec2b2880c752cb07f9db4078a3f04f9d
push id18092
push usermkmelin@iki.fi
push dateWed, 21 Oct 2020 10:25:27 +0000
treeherdercomm-central@85ce5884b204 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdarktrojan
bugs1672159, 1668284
Bug 1672159 - remove settingsCHange.dtd which is unneeded since bug 1668284. r=darktrojan
mail/base/jar.mn
mail/extensions/openpgp/content/ui/keyWizard.js
mail/extensions/openpgp/content/ui/keyWizard.xhtml
mail/locales/en-US/chrome/overrides/settingsChange.dtd
mail/locales/en-US/messenger/openpgp/keyWizard.ftl
mail/locales/jar.mn
--- a/mail/base/jar.mn
+++ b/mail/base/jar.mn
@@ -119,17 +119,16 @@ messenger.jar:
 % override chrome://mozapps/content/profile/profileDowngrade.xhtml chrome://messenger/content/profileDowngrade.xhtml
 
 *   content/messenger/buildconfig.html              (content/buildconfig.html)
     content/messenger/buildconfig.css               (content/buildconfig.css)
 % override chrome://global/content/buildconfig.html chrome://messenger/content/buildconfig.html
 % override chrome://global/content/buildconfig.css chrome://messenger/content/buildconfig.css
 
 # L10n resources and overrides.
-% override chrome://mozapps/locale/downloads/settingsChange.dtd chrome://messenger/locale/downloads/settingsChange.dtd
 % override chrome://mozapps/locale/profile/profileDowngrade.dtd chrome://messenger/locale/profileDowngrade.dtd
 % override chrome://global/locale/netError.dtd chrome://messenger/locale/netError.dtd
 
 comm.jar:
 % content communicator %content/communicator/
    content/communicator/contentAreaClick.js         (content/contentAreaClick.js)
    content/communicator/utilityOverlay.js           (content/utilityOverlay.js)
 
--- a/mail/extensions/openpgp/content/ui/keyWizard.js
+++ b/mail/extensions/openpgp/content/ui/keyWizard.js
@@ -352,17 +352,17 @@ async function wizardExternalKey() {
   kDialog.getButton("accept").label = createLabel;
   kDialog.getButton("accept").classList.add("primary");
 
   // If the user is already using an external GnuPG key, populate the input,
   // show the warning description, and enable the primary button.
   if (gIdentity.getBoolAttribute("is_gnupg_key_id")) {
     document.getElementById(
       "externalKey"
-    ).value = gIdentity.getUnicharAttribute(
+    ).value = "0x" + gIdentity.getUnicharAttribute(
       "last_entered_external_gnupg_key_id"
     );
     document.getElementById("openPgpExternalWarning").collapsed = false;
     kDialog.getButton("accept").removeAttribute("disabled");
   } else {
     document.getElementById("openPgpExternalWarning").collapsed = true;
     kDialog.getButton("accept").setAttribute("disabled", true);
   }
@@ -1009,29 +1009,50 @@ function passphrasePromptCallback(win, k
     overlay.classList.add("hide");
     kGenerating = false;
   }
 
   resultFlags.canceled = !prompt;
   return !prompt ? "" : passphrase.value;
 }
 
-function toggleSaveButton(event) {
-  kDialog
-    .getButton("accept")
-    .toggleAttribute("disabled", !event.target.value.trim());
-}
+var ExternalKeyWiz = {
+  oninput(input) {
+    input.value = this.addBlankSpace(input.value);
+    kDialog.getButton("accept").disabled =
+      input.value && !input.validity.valid;
+  },
+
+  onblur(input) {
+    input.value = this.addBlankSpace(input.value);
+  },
+
+  addBlankSpace(value) {
+    if (!value.startsWith("0x") && value != "0" && value) {
+      value = "0x" + value;
+    }
+    return value
+      .replace(/\s/g, "")
+      .trim();
+  },
+};
 
 /**
  * Save the GnuPG Key for the current identity and trigger a callback.
  */
 function openPgpExternalComplete() {
   gIdentity.setBoolAttribute("is_gnupg_key_id", true);
 
   let externalKey = document.getElementById("externalKey").value;
+  externalKey = externalKey.replace(/ /g, "").replace(/^0x/, "").toUpperCase();
+  if (externalKey.length == 40) {
+    // If full fingerprint was entered, grab the last 16 characters, which
+    // is what forms the key id
+    externalKey = externalKey.substr(-16);
+  }
   gIdentity.setUnicharAttribute(
     "last_entered_external_gnupg_key_id",
     externalKey
   );
   gIdentity.setUnicharAttribute("openpgp_key_id", externalKey);
 
   window.arguments[0].okExternalCallback();
   window.close();
--- a/mail/extensions/openpgp/content/ui/keyWizard.xhtml
+++ b/mail/extensions/openpgp/content/ui/keyWizard.xhtml
@@ -294,19 +294,21 @@
           <separator/>
 
           <hbox align="center">
             <label for="externalKey"
                    data-l10n-id="openpgp-external-key-label"></label>
             <hbox class="input-container" flex="1">
               <html:input id="externalKey" type="text"
                           class="input-inline"
-                          data-l10n-id="openpgp-external-key-input"
-                          oninput="toggleSaveButton(event)">
-              </html:input>
+                          placeholder="0x123456789ABCDEF"
+                          oninput="ExternalKeyWiz.oninput(this);"
+                          onblur="ExternalKeyWiz.onblur(this);"
+                          pattern="(0x)?[ 0-9a-fA-F]{16,40}"
+                          minlength="16"/>
             </hbox>
           </hbox>
 
           <separator/>
 
           <hbox id="openPgpExternalWarning"
                 class="inline-notification-container info-container"
                 collapsed="true">
deleted file mode 100644
--- a/mail/locales/en-US/chrome/overrides/settingsChange.dtd
+++ /dev/null
@@ -1,6 +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  settingsChangePreferences.label  "Settings can be changed using the Attachments tab in &brandShortName;'s Preferences.">
-<!ENTITY  settingsChangeOptions.label      "Settings can be changed using the Attachments tab in &brandShortName;'s Options.">
--- a/mail/locales/en-US/messenger/openpgp/keyWizard.ftl
+++ b/mail/locales/en-US/messenger/openpgp/keyWizard.ftl
@@ -177,11 +177,8 @@ openpgp-external-key-description = Confi
 
 openpgp-external-key-info = In addition, you must use Key Manager to import and accept the corresponding Public Key.
 
 openpgp-external-key-warning = <b>You may configure only one external GnuPG Key.</b> Your previous entry will be replaced.
 
 openpgp-save-external-button = Save key ID
 
 openpgp-external-key-label = Secret Key ID:
-
-openpgp-external-key-input =
-    .placeholder = 123456789341298340
--- a/mail/locales/jar.mn
+++ b/mail/locales/jar.mn
@@ -176,17 +176,16 @@
   locale/@AB_CD@/messenger/preferences/applicationManager.properties    (%chrome/messenger/preferences/applicationManager.properties)
   locale/@AB_CD@/messenger/preferences/preferences.properties           (%chrome/messenger/preferences/preferences.properties)
   locale/@AB_CD@/messenger/migration/migration.dtd                      (%chrome/messenger/migration/migration.dtd)
   locale/@AB_CD@/messenger/migration/migration.properties               (%chrome/messenger/migration/migration.properties)
   locale/@AB_CD@/messenger/newmailaccount/accountProvisioner.properties (%chrome/messenger/newmailaccount/accountProvisioner.properties)
   locale/@AB_CD@/messenger/newmailaccount/accountProvisioner.dtd        (%chrome/messenger/newmailaccount/accountProvisioner.dtd)
   locale/@AB_CD@/messenger/activity.dtd                                 (%chrome/messenger/activity.dtd)
   locale/@AB_CD@/messenger/activity.properties                          (%chrome/messenger/activity.properties)
-  locale/@AB_CD@/messenger/downloads/settingsChange.dtd                 (%chrome/overrides/settingsChange.dtd)
   locale/@AB_CD@/messenger/netError.dtd                                 (%chrome/overrides/netError.dtd)
   locale/@AB_CD@/messenger/profileDowngrade.dtd                         (%chrome/overrides/profileDowngrade.dtd)
   locale/@AB_CD@/messenger/newsError.dtd                                (%chrome/messenger/newsError.dtd)
   locale/@AB_CD@/messenger/chat.dtd                                     (%chrome/messenger/chat.dtd)
   locale/@AB_CD@/messenger/chat.properties                              (%chrome/messenger/chat.properties)
   locale/@AB_CD@/messenger/addbuddy.dtd                                 (%chrome/messenger/addbuddy.dtd)
   locale/@AB_CD@/messenger/joinChat.dtd                                 (%chrome/messenger/joinChat.dtd)
   locale/@AB_CD@/messenger/imAccounts.properties                        (%chrome/messenger/imAccounts.properties)