diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-02.js b/browser/devtools/debugger/test/browser_dbg_variables-view-02.js index 94c561e2efb..85c52e1b524 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-02.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-02.js @@ -2,7 +2,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ /** - * Tests that creating, collpasing and expanding variables in the + * Tests that creating, collapsing and expanding variables in the * variables view works as expected. */ @@ -22,7 +22,7 @@ function test() { ok(testScope, "Should have created a scope."); - is(duplVar, null, + is(duplVar, testVar, "Shouldn't be able to duplicate variables in the same scope."); ok(testVar, diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-01.js b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-01.js index 9c6f28bd7c2..6aed9a15a68 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-01.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-01.js @@ -96,8 +96,9 @@ function testVariablesAndPropertiesFiltering() { } function firstFilter() { + let expanded = once(gVariables, "fetched"); typeText(gSearchBox, "constructor"); - testFiltered(); + return expanded.then(testFiltered); } function secondFilter() { @@ -128,13 +129,13 @@ function testVariablesAndPropertiesFiltering() { is(constr2Var.expanded, false, "The constr2Var should not be expanded."); + let expanded = once(gVariables, "fetched"); clearText(gSearchBox); typeText(gSearchBox, "constructor"); - testFiltered(); + expanded.then(testFiltered); } - firstFilter(); - secondFilter(); + firstFilter().then(secondFilter); } function prepareVariablesAndProperties() { diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-02.js b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-02.js index ccb74fbd3f6..5bb55e1c48b 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-02.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-02.js @@ -103,8 +103,9 @@ function testVariablesAndPropertiesFiltering() { } function firstFilter() { + let expanded = once(gVariables, "fetched"); typeText(gSearchBox, "\"Function\""); - testFiltered(); + return expanded.then(testFiltered); } function secondFilter() { @@ -136,12 +137,12 @@ function testVariablesAndPropertiesFiltering() { "The constr2Var should not be expanded."); backspaceText(gSearchBox, 10); + let expanded = once(gVariables, "fetched"); typeText(gSearchBox, "\"Function\""); - testFiltered(); + expanded.then(testFiltered); } - firstFilter(); - secondFilter(); + firstFilter().then(secondFilter); } function prepareVariablesAndProperties() { diff --git a/browser/devtools/shared/widgets/VariablesView.jsm b/browser/devtools/shared/widgets/VariablesView.jsm index 03a6e5821d1..31495ffbe12 100644 --- a/browser/devtools/shared/widgets/VariablesView.jsm +++ b/browser/devtools/shared/widgets/VariablesView.jsm @@ -550,11 +550,22 @@ VariablesView.prototype = { */ _doSearch: function(aToken) { if (this.controller.supportsSearch()) { - this.empty(); - let scope = this.addScope(aToken); - scope.expanded = true; // Expand the scope by default. - scope.locked = true; // Prevent collapsing the scope. + // Retrieve the main Scope in which we add attributes + let scope = this._store[0]._store.get(""); + if (!aToken) { + // Prune the view from old previous content + // so that we delete the intermediate search results + // we created in previous searches + for (let property of scope._store.values()) { + property.remove(); + } + } + // Retrieve new attributes eventually hidden in splits this.controller.performSearch(scope, aToken); + // Filter already displayed attributes + if (aToken) { + scope._performSearch(aToken.toLowerCase()); + } return; } for (let scope of this._store) { @@ -1288,7 +1299,7 @@ Scope.prototype = { */ addItem: function(aName = "", aDescriptor = {}, aRelaxed = false) { if (this._store.has(aName) && !aRelaxed) { - return null; + return this._store.get(aName); } let child = this._createChild(aName, aDescriptor); diff --git a/browser/devtools/shared/widgets/VariablesViewController.jsm b/browser/devtools/shared/widgets/VariablesViewController.jsm index 670d16ea929..4f030d902f8 100644 --- a/browser/devtools/shared/widgets/VariablesViewController.jsm +++ b/browser/devtools/shared/widgets/VariablesViewController.jsm @@ -637,7 +637,10 @@ VariablesViewController.prototype = { * The query string */ performSearch: function(aScope, aToken) { - this._populateFromObjectWithIterator(aScope, this.objectActor, aToken); + this._populateFromObjectWithIterator(aScope, this.objectActor, aToken) + .then(() => { + this.view.emit("fetched", "search", aScope); + }); }, /**