Bug 483370 - Buttons on Security tab are broken when windows are already open. r=mconnor
authorDão Gottwald <dao@mozilla.com>
Tue, 17 Mar 2009 14:08:07 +0100
changeset 26245 83f0470b40fa43f8778274faff86831235189436
parent 26244 844d5410d576b8780f4aa30408a0f2509e7c9749
child 26246 69aa67fe33144eac6314a2a99b9ac6bd7bd60eb3
push idunknown
push userunknown
push dateunknown
reviewersmconnor
bugs483370
milestone1.9.2a1pre
Bug 483370 - Buttons on Security tab are broken when windows are already open. r=mconnor
browser/components/preferences/cookies.js
toolkit/components/passwordmgr/content/passwordManager.js
--- a/browser/components/preferences/cookies.js
+++ b/browser/components/preferences/cookies.js
@@ -74,21 +74,20 @@ var gCookiesWindow = {
     this._loadCookies();
     this._tree.treeBoxObject.view = this._view;
     if (aInitialLoad)
       this.sort("rawHost");
     if (this._view.rowCount > 0)
       this._tree.view.selection.select(0);
 
     if (aInitialLoad) {
-      if ("arguments" in window && window.arguments[0] &&
-          window.arguments[0].filterString) {
-        document.getElementById("filter").value = window.arguments[0].filterString;
-        this.filter();
-      }
+      if ("arguments" in window &&
+          window.arguments[0] &&
+          window.arguments[0].filterString)
+        this.setFilter(window.arguments[0].filterString);
     }
     else {
       if (document.getElementById("filter").value != "")
         this.filter();
     }
 
     this._saveState();
   },
@@ -882,14 +881,19 @@ var gCookiesWindow = {
 
     // if the view is not empty then select the first item
     if (view.rowCount > 0)
       view.selection.select(0);
 
     document.getElementById("cookiesIntro").value = gCookiesWindow._bundle.getString("cookiesFiltered");
   },
 
+  setFilter: function (aFilterString) {
+    document.getElementById("filter").value = aFilterString;
+    this.filter();
+  },
+
   focusFilterBox: function () {
     var filter = document.getElementById("filter");
     filter.focus();
     filter.select();
   }
 };
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -48,25 +48,29 @@ var kSignonBundle;
 function SignonsStartup() {
   kSignonBundle = document.getElementById("signonBundle");
   document.getElementById("togglePasswords").label = kSignonBundle.getString("showPasswords");
   document.getElementById("togglePasswords").accessKey = kSignonBundle.getString("showPasswordsAccessKey");
   document.getElementById("signonsIntro").value = kSignonBundle.getString("loginsSpielAll");
   LoadSignons();
 
   // filter the table if requested by caller
-  if (window.arguments && window.arguments[0] &&
-      window.arguments[0].filterString) {
-    document.getElementById("filter").value = window.arguments[0].filterString;
-    _filterPasswords();
-  }
+  if (window.arguments &&
+      window.arguments[0] &&
+      window.arguments[0].filterString)
+    setFilter(window.arguments[0].filterString);
 
   FocusFilterBox();
 }
 
+function setFilter(aFilterString) {
+  document.getElementById("filter").value = aFilterString;
+  _filterPasswords();
+}
+
 var signonsTreeView = {
   _filterSet : [],
   _lastSelectedRanges : [],
   selection: null,
 
   rowCount : 0,
   setTree : function(tree) {},
   getImageSrc : function(row,column) {},