Bug 1567697 - Select the first preferences pane if the previously selected one is unavailable. r=Paenglab
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 23 Jul 2019 14:37:29 +1200
changeset 35422 214434e7ca135ecfa37459478c3b6604a6e34ca7
parent 35421 41c462c6bdfac1ffb4a4c2b2f2c7d042b3a312f7
child 35423 cb2b508896be5152e0e4ee0b9fe8a71eb591a104
push id2486
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:24:43 +0000
treeherdercomm-beta@1b30a9a6e7f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersPaenglab
bugs1567697
Bug 1567697 - Select the first preferences pane if the previously selected one is unavailable. r=Paenglab
mail/components/preferences/preferences.js
--- a/mail/components/preferences/preferences.js
+++ b/mail/components/preferences/preferences.js
@@ -41,18 +41,19 @@ var selector = document.getElementById("
     setTimeout(function() { pane.dispatchEvent(new CustomEvent("paneload")); }, 1);
   }
 
   if (prefPanes.length == 1) {
     selector.setAttribute("collapsed", "true");
   }
 
   window.addEventListener("DOMContentLoaded", function() {
-    if (document.documentElement.hasAttribute("lastSelected")) {
-      showPane(document.documentElement.getAttribute("lastSelected"));
+    let lastSelected = document.documentElement.getAttribute("lastSelected");
+    if (lastSelected && document.getElementById(lastSelected)) {
+      showPane(lastSelected);
     } else {
       showPane(prefPanes[0].id);
     }
   });
 
   document.documentElement.addEventListener("keydown", function(event) {
     if (event.keyCode == KeyEvent.DOM_VK_TAB ||
         event.keyCode == KeyEvent.DOM_VK_UP ||