Bug 1169096 - Fix remote filtering on nested attributes. r=past

This commit is contained in:
Alexandre Poirot 2015-07-21 13:24:25 -07:00
parent 143c0a0dea
commit a81016d903
5 changed files with 32 additions and 16 deletions

View File

@ -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,

View File

@ -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() {

View File

@ -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() {

View File

@ -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);

View File

@ -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);
});
},
/**