Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/ui/filters-filterview.js

Issue 29332935: Issue 3448 - TypeError: this.treeElement is null error when closing Filter Preferences (Closed)
Patch Set: Removed unnecessary check as well (code unchanged beyond indentation) Created Dec. 21, 2015, 4:21 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/ui/filters-filterview.js
===================================================================
--- a/chrome/content/ui/filters-filterview.js
+++ b/chrome/content/ui/filters-filterview.js
@@ -628,45 +628,45 @@ var FilterView =
this.boxObject.invalidateRange(Math.min(oldPosition, newPosition), Math.max(oldPosition, newPosition));
}
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITreeView]),
setTree: function(boxObject)
{
+ if (!boxObject)
+ return;
+
this.init();
this.boxObject = boxObject;
- if (this.boxObject)
+ this.noGroupDummy = {index: 0, filter: {text: this.boxObject.treeBody.getAttribute("noGroupText"), dummy: true}};
+ this.noFiltersDummy = {index: 0, filter: {text: this.boxObject.treeBody.getAttribute("noFiltersText"), dummy: true}};
+ this.editDummy = {filter: {text: ""}};
+
+ let atomService = Cc["@mozilla.org/atom-service;1"].getService(Ci.nsIAtomService);
+ let stringAtoms = ["col-filter", "col-enabled", "col-hitcount", "col-lasthit", "type-invalid", "type-comment", "type-blocking", "type-whitelist", "type-elemhide", "type-elemhideexception", "type-cssproperty"];
+ let boolAtoms = ["selected", "dummy", "slow", "disabled"];
+
+ this.atoms = {};
+ for (let atom of stringAtoms)
+ this.atoms[atom] = atomService.getAtom(atom);
+ for (let atom of boolAtoms)
{
- this.noGroupDummy = {index: 0, filter: {text: this.boxObject.treeBody.getAttribute("noGroupText"), dummy: true}};
- this.noFiltersDummy = {index: 0, filter: {text: this.boxObject.treeBody.getAttribute("noFiltersText"), dummy: true}};
- this.editDummy = {filter: {text: ""}};
+ this.atoms[atom + "-true"] = atomService.getAtom(atom + "-true");
+ this.atoms[atom + "-false"] = atomService.getAtom(atom + "-false");
+ }
- let atomService = Cc["@mozilla.org/atom-service;1"].getService(Ci.nsIAtomService);
- let stringAtoms = ["col-filter", "col-enabled", "col-hitcount", "col-lasthit", "type-invalid", "type-comment", "type-blocking", "type-whitelist", "type-elemhide", "type-elemhideexception", "type-cssproperty"];
- let boolAtoms = ["selected", "dummy", "slow", "disabled"];
+ let columns = this.boxObject.columns;
+ for (let i = 0; i < columns.length; i++)
+ if (columns[i].element.hasAttribute("sortDirection"))
+ this.sortBy(columns[i].id, columns[i].element.getAttribute("sortDirection"));
- this.atoms = {};
- for (let atom of stringAtoms)
- this.atoms[atom] = atomService.getAtom(atom);
- for (let atom of boolAtoms)
- {
- this.atoms[atom + "-true"] = atomService.getAtom(atom + "-true");
- this.atoms[atom + "-false"] = atomService.getAtom(atom + "-false");
- }
-
- let columns = this.boxObject.columns;
- for (let i = 0; i < columns.length; i++)
- if (columns[i].element.hasAttribute("sortDirection"))
- this.sortBy(columns[i].id, columns[i].element.getAttribute("sortDirection"));
-
- this.refresh(true);
- }
+ this.refresh(true);
// Stop propagation of keypress events so that these aren't intercepted by
// the findbar.
this.treeElement.inputField.addEventListener("keypress", event => {
event.stopPropagation();
}, false);
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld