Bug 876277 - Remove the ugly _wasToggled hack from the VariablesView that tests relied on, r=past
authorVictor Porof <vporof@mozilla.com>
Fri, 13 Sep 2013 16:23:15 +0300
changeset 147077 0cb94386602a48e9c51fb1366866a612414e18fa
parent 147076 1757ae16bf8a50e52b588685dc9068ffadea60e7
child 147078 04c318f79c84e50a8a4c170e3b728b313adf956b
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerspast
bugs876277
milestone26.0a1
Bug 876277 - Remove the ugly _wasToggled hack from the VariablesView that tests relied on, r=past
browser/devtools/shared/widgets/VariablesView.jsm
--- a/browser/devtools/shared/widgets/VariablesView.jsm
+++ b/browser/devtools/shared/widgets/VariablesView.jsm
@@ -1354,17 +1354,16 @@ Scope.prototype = {
   /**
    * Toggles between the scope's collapsed and expanded state.
    */
   toggle: function(e) {
     if (e && e.button != 0) {
       // Only allow left-click to trigger this event.
       return;
     }
-    this._wasToggled = true;
     this.expanded ^= 1;
 
     // Make sure the scope and its contents are visibile.
     for (let [, variable] of this._store) {
       variable.header = true;
       variable._matched = true;
     }
     if (this.ontoggle) {
@@ -1795,40 +1794,31 @@ Scope.prototype = {
       }
       // Variable or property is matched.
       else {
         variable._matched = true;
 
         // If the variable was ever expanded, there's a possibility it may
         // contain some matched properties, so make sure they're visible
         // ("expand downwards").
-
-        if (variable._wasToggled && aLowerCaseQuery) {
+        if (variable._store.size) {
           variable.expand();
         }
-        if (variable._isExpanded && !aLowerCaseQuery) {
-          variable._wasToggled = true;
-        }
 
         // If the variable is contained in another Scope, Variable, or Property,
         // the parent may not be a match, thus hidden. It should be visible
         // ("expand upwards").
-        while ((variable = variable.ownerView) &&  /* Parent object exists. */
-               variable instanceof Scope) {
-
-          // Show and expand the parent, as it is certainly accessible.
+        while ((variable = variable.ownerView) && variable instanceof Scope) {
           variable._matched = true;
-          aLowerCaseQuery && variable.expand();
+          variable.expand();
         }
       }
 
       // Proceed with the search recursively inside this variable or property.
-      if (currentObject._wasToggled ||
-          currentObject.getter ||
-          currentObject.setter) {
+      if (currentObject._store.size || currentObject.getter || currentObject.setter) {
         currentObject._performSearch(aLowerCaseQuery);
       }
     }
   },
 
   /**
    * Sets if this object instance is a matched or non-matched item.
    * @param boolean aStatus
@@ -2002,17 +1992,16 @@ Scope.prototype = {
   _fetched: false,
   _retrieved: false,
   _committed: false,
   _batchItems: null,
   _batchTimeout: null,
   _locked: false,
   _isExpanding: false,
   _isExpanded: false,
-  _wasToggled: false,
   _isContentVisible: true,
   _isHeaderVisible: true,
   _isArrowVisible: true,
   _isMatch: true,
   _idString: "",
   _nameString: "",
   _target: null,
   _arrow: null,
@@ -2921,17 +2910,16 @@ VariablesView.prototype.commitHierarchy 
     }
 
     // Make sure this variable is not handled in ulteror commits for the
     // same hierarchy.
     currVariable._committed = true;
 
     // Re-expand the variable if not previously collapsed.
     if (expanded) {
-      currVariable._wasToggled = prevVariable._wasToggled;
       currVariable.expand();
     }
     // This variable was either not changed or removed, no need to continue.
     if (!changed) {
       continue;
     }
 
     // Apply an attribute determining the flash type and duration.