Bug 876277 - Add getScopeAtIndex() to make scopes more easily accessible from tests, and fix a few inconsistencies in VariablesView.jsm, r=past
authorVictor Porof <vporof@mozilla.com>
Fri, 13 Sep 2013 16:23:15 +0300
changeset 147076 1757ae16bf8a50e52b588685dc9068ffadea60e7
parent 147075 ecdd787c9eff242c0e438fea2e3b8dd1532755c5
child 147077 0cb94386602a48e9c51fb1366866a612414e18fa
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerspast
bugs876277
milestone26.0a1
Bug 876277 - Add getScopeAtIndex() to make scopes more easily accessible from tests, and fix a few inconsistencies in VariablesView.jsm, r=past
browser/devtools/shared/widgets/VariablesView.jsm
--- a/browser/devtools/shared/widgets/VariablesView.jsm
+++ b/browser/devtools/shared/widgets/VariablesView.jsm
@@ -569,16 +569,28 @@ VariablesView.prototype = {
       if (result) {
         return result;
       }
     }
     return null;
   },
 
   /**
+   * Gets the scope at the specified index.
+   *
+   * @param number aIndex
+   *        The scope's index.
+   * @return Scope
+   *         The scope if found, undefined if not.
+   */
+  getScopeAtIndex: function(aIndex) {
+    return this._store[aIndex];
+  },
+
+  /**
    * Searches for the scope in this container displayed by the specified node.
    *
    * @param nsIDOMNode aNode
    *        The node to search for.
    * @return Scope
    *         The matched scope, or null if nothing is found.
    */
   getScopeForNode: function(aNode) {
@@ -1071,21 +1083,22 @@ function Scope(aView, aName, aFlags = {}
   this._openNonEnum = this._openNonEnum.bind(this);
   this._batchAppend = this._batchAppend.bind(this);
 
   // Inherit properties and flags from the parent view. You can override
   // each of these directly onto any scope, variable or property instance.
   this.eval = aView.eval;
   this.switch = aView.switch;
   this.delete = aView.delete;
+  this.preventDisableOnChage = aView.preventDisableOnChage;
+  this.preventDescriptorModifiers = aView.preventDescriptorModifiers;
+  this.editableNameTooltip = aView.editableNameTooltip;
   this.editableValueTooltip = aView.editableValueTooltip;
-  this.editableNameTooltip = aView.editableNameTooltip;
   this.editButtonTooltip = aView.editButtonTooltip;
   this.deleteButtonTooltip = aView.deleteButtonTooltip;
-  this.preventDescriptorModifiers = aView.preventDescriptorModifiers;
   this.contextMenuId = aView.contextMenuId;
   this.separatorStr = aView.separatorStr;
 
   // Creating maps and arrays thousands of times for variables or properties
   // with a large number of children fills up a lot of memory. Make sure
   // these are instantiated only if needed.
   XPCOMUtils.defineLazyGetter(this, "_store", () => new Map());
   XPCOMUtils.defineLazyGetter(this, "_enumItems", () => []);