Bug 952817 - VariablesView.createHierarchy should always be called when the view is emptied, r=benvie
authorVictor Porof <vporof@mozilla.com>
Tue, 07 Jan 2014 10:03:17 +0200
changeset 179270 641671b50e97ef438aa05f8edb4806f5f6dfbb20
parent 179269 b1732c430f6485a6d69739e8c2cbe35f79527550
child 179271 972dd693614f7af7f23e8087bda4dd8ce3da4a60
push id462
push userraliiev@mozilla.com
push dateTue, 22 Apr 2014 00:22:30 +0000
treeherdermozilla-release@ac5db8c74ac0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbenvie
bugs952817
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 952817 - VariablesView.createHierarchy should always be called when the view is emptied, r=benvie
browser/devtools/app-manager/content/manifest-editor.js
browser/devtools/debugger/debugger-controller.js
browser/devtools/shared/widgets/VariablesView.jsm
browser/devtools/webconsole/webconsole.js
--- a/browser/devtools/app-manager/content/manifest-editor.js
+++ b/browser/devtools/app-manager/content/manifest-editor.js
@@ -109,17 +109,16 @@ ManifestEditor.prototype = {
     let parent = this.manifest;
     while (path.length) {
       parent = parent[path.shift()];
     }
     return parent;
   },
 
   update: function() {
-    this.editor.createHierarchy();
     this.editor.rawObject = this.manifest;
     this.editor.commitHierarchy();
 
     // Wait until the animation from commitHierarchy has completed
     let deferred = promise.defer();
     setTimeout(deferred.resolve, this.editor.lazyEmptyDelay + 1);
     return deferred.promise;
   },
--- a/browser/devtools/debugger/debugger-controller.js
+++ b/browser/devtools/debugger/debugger-controller.js
@@ -836,17 +836,16 @@ StackFrames.prototype = {
       DebuggerView.Sources.highlightBreakpoint(where, { noEditorUpdate: true });
     }
 
     // Don't display the watch expressions textbox inputs in the pane.
     DebuggerView.WatchExpressions.toggleContents(false);
 
     // Start recording any added variables or properties in any scope and
     // clear existing scopes to create each one dynamically.
-    DebuggerView.Variables.createHierarchy();
     DebuggerView.Variables.empty();
 
     // If watch expressions evaluation results are available, create a scope
     // to contain all the values.
     if (this._syncedWatchExpressions && aDepth == 0) {
       let label = L10N.getStr("watchExpressionsScopeLabel");
       let scope = DebuggerView.Variables.addScope(label);
 
--- a/browser/devtools/shared/widgets/VariablesView.jsm
+++ b/browser/devtools/shared/widgets/VariablesView.jsm
@@ -149,31 +149,32 @@ VariablesView.prototype = {
    *        The number of milliseconds to delay the operation if
    *        lazy emptying of this container is enabled.
    */
   empty: function(aTimeout = this.lazyEmptyDelay) {
     // If there are no items in this container, emptying is useless.
     if (!this._store.length) {
       return;
     }
+
+    this._store.length = 0;
+    this._itemsByElement.clear();
+    this._prevHierarchy = this._currHierarchy;
+    this._currHierarchy = new Map(); // Don't clear, this is just simple swapping.
+
     // Check if this empty operation may be executed lazily.
     if (this.lazyEmpty && aTimeout > 0) {
       this._emptySoon(aTimeout);
       return;
     }
 
-    let list = this._list;
-
-    while (list.hasChildNodes()) {
-      list.firstChild.remove();
+    while (this._list.hasChildNodes()) {
+      this._list.firstChild.remove();
     }
 
-    this._store.length = 0;
-    this._itemsByElement.clear();
-
     this._appendEmptyNotice();
     this._toggleSearchVisibility(false);
   },
 
   /**
    * Emptying this container and rebuilding it immediately afterwards would
    * result in a brief redraw flicker, because the previously expanded nodes
    * may get asynchronously re-expanded, after fetching the prototype and
@@ -187,19 +188,16 @@ VariablesView.prototype = {
    *
    * @see VariablesView.empty
    * @see VariablesView.commitHierarchy
    */
   _emptySoon: function(aTimeout) {
     let prevList = this._list;
     let currList = this._list = this.document.createElement("scrollbox");
 
-    this._store.length = 0;
-    this._itemsByElement.clear();
-
     this.window.setTimeout(() => {
       prevList.removeEventListener("keypress", this._onViewKeyPress, false);
       prevList.removeEventListener("keydown", this._onViewKeyDown, false);
       currList.addEventListener("keypress", this._onViewKeyPress, false);
       currList.addEventListener("keydown", this._onViewKeyDown, false);
       currList.setAttribute("orient", "vertical");
 
       this._parent.removeChild(prevList);
@@ -2884,35 +2882,31 @@ VariablesView.prototype["@@iterator"] =
 Scope.prototype["@@iterator"] =
 Variable.prototype["@@iterator"] =
 Property.prototype["@@iterator"] = function*() {
   yield* this._store;
 };
 
 /**
  * Forget everything recorded about added scopes, variables or properties.
- * @see VariablesView.createHierarchy
+ * @see VariablesView.commitHierarchy
  */
 VariablesView.prototype.clearHierarchy = function() {
   this._prevHierarchy.clear();
   this._currHierarchy.clear();
 };
 
 /**
- * Start recording a hierarchy of any added scopes, variables or properties.
- * @see VariablesView.commitHierarchy
- */
-VariablesView.prototype.createHierarchy = function() {
-  this._prevHierarchy = this._currHierarchy;
-  this._currHierarchy = new Map(); // Don't clear, this is just simple swapping.
-};
-
-/**
- * Briefly flash the variables that changed between the previous and current
- * scope/variable/property hierarchies and reopen previously expanded nodes.
+ * Perform operations on all the VariablesView Scopes, Variables and Properties
+ * after you've added all the items you wanted.
+ *
+ * Calling this method is optional, and does the following:
+ *   - styles the items overridden by other items in parent scopes
+ *   - reopens the items which were previously expanded
+ *   - flashes the items whose values changed
  */
 VariablesView.prototype.commitHierarchy = function() {
   for (let [, currItem] of this._currHierarchy) {
     // Avoid performing expensive operations.
     if (this.commitHierarchyIgnoredItems[currItem._nameString]) {
       continue;
     }
     let overridden = this.isOverridden(currItem);
--- a/browser/devtools/webconsole/webconsole.js
+++ b/browser/devtools/webconsole/webconsole.js
@@ -3464,17 +3464,16 @@ JSTerm.prototype = {
    *        - objectActor: the grip of the new ObjectActor you want to show in
    *        the view.
    *        - rawObject: the new raw object you want to show.
    *        - label: the new label for the inspected object.
    */
   _updateVariablesView: function JST__updateVariablesView(aOptions)
   {
     let view = aOptions.view;
-    view.createHierarchy();
     view.empty();
 
     // We need to avoid pruning the object inspection starting point.
     // That one is pruned when the console message is removed.
     view.controller.releaseActors(aActor => {
       return view._consoleLastObjectActor != aActor;
     });