Bug 1140712 - do not use '=' inside 'if()' condition in mailnews/addrbook/content/abResultsPane.js as it triggers JS strict warnings. r=mkmelin, a=rkent
authoraceman <acelists@atlas.sk>
Tue, 10 Mar 2015 14:38:52 +0100
changeset 25789 6832d62c544f02b8ebe80ab07609e6b40e639765
parent 25788 d5574ecdac1cb6f5028fa8dbfe1b945022f62865
child 25790 dab4d97e387701c054661b581f2d2d8074c5b66b
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, rkent
bugs1140712
Bug 1140712 - do not use '=' inside 'if()' condition in mailnews/addrbook/content/abResultsPane.js as it triggers JS strict warnings. r=mkmelin, a=rkent
mailnews/addrbook/content/abResultsPane.js
--- a/mailnews/addrbook/content/abResultsPane.js
+++ b/mailnews/addrbook/content/abResultsPane.js
@@ -69,42 +69,42 @@ function SetAbView(aURI)
 
   var directory = GetDirectoryFromURI(aURI);
 
   if (!gAbView)
     gAbView = Components.classes["@mozilla.org/addressbook/abview;1"]
                         .createInstance(Components.interfaces.nsIAbView);
 
   var actualSortColumn = gAbView.setView(directory, GetAbViewListener(),
-					 sortColumn, sortDirection);
+                                         sortColumn, sortDirection);
 
   gAbResultsTree.treeBoxObject.view =
     gAbView.QueryInterface(Components.interfaces.nsITreeView);
 
   UpdateSortIndicators(actualSortColumn, sortDirection);
 
   // If the selected address book is LDAP and the search box is empty,
   // inform the user of the empty results pane.
-  if (aURI.indexOf("moz-abldapdirectory") != -1 &&
-      aURI.indexOf("?") == -1) {
-    let element = null;
-    if (element = document.getElementById("abResultsTree"))
-      element.setAttribute("hidden", "true");
-    if (element = document.getElementById("CardViewOuterBox"))
-      element.setAttribute("hidden", "true");
-    if (element = document.getElementById("blankResultsPaneMessageBox"))
-      element.setAttribute("hidden", "false");
+  let abResultsTree = document.getElementById("abResultsTree");
+  let cardViewOuterBox = document.getElementById("CardViewOuterBox");
+  let blankResultsPaneMessageBox = document.getElementById("blankResultsPaneMessageBox");
+  if (aURI.startsWith("moz-abldapdirectory://") && !aURI.contains("?")) {
+    if (abResultsTree)
+      abResultsTree.hidden = true;
+    if (cardViewOuterBox)
+      cardViewOuterBox.hidden = true;
+    if (blankResultsPaneMessageBox)
+      blankResultsPaneMessageBox.hidden = false;
   } else {
-    let element = null;
-    if (element = document.getElementById("abResultsTree"))
-      element.removeAttribute("hidden");
-    if (element = document.getElementById("CardViewOuterBox"))
-      element.removeAttribute("hidden");
-    if (element = document.getElementById("blankResultsPaneMessageBox"))
-      element.setAttribute("hidden", "true");
+    if (abResultsTree)
+      abResultsTree.hidden = false;
+    if (cardViewOuterBox)
+      cardViewOuterBox.hidden = false;
+    if (blankResultsPaneMessageBox)
+      blankResultsPaneMessageBox.hidden = true;
   }
 }
 
 function CloseAbView()
 {
   if (gAbView)
     gAbView.clearView();
 }