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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 this.data.splice(oldPosition, 1); 626 this.data.splice(oldPosition, 1);
627 this.data.splice(newPosition, 0, item); 627 this.data.splice(newPosition, 0, item);
628 this.boxObject.invalidateRange(Math.min(oldPosition, newPosition), Math.ma x(oldPosition, newPosition)); 628 this.boxObject.invalidateRange(Math.min(oldPosition, newPosition), Math.ma x(oldPosition, newPosition));
629 } 629 }
630 }, 630 },
631 631
632 QueryInterface: XPCOMUtils.generateQI([Ci.nsITreeView]), 632 QueryInterface: XPCOMUtils.generateQI([Ci.nsITreeView]),
633 633
634 setTree: function(boxObject) 634 setTree: function(boxObject)
635 { 635 {
636 if (!boxObject)
637 return;
638
636 this.init(); 639 this.init();
637 this.boxObject = boxObject; 640 this.boxObject = boxObject;
638 641
639 if (this.boxObject) 642 this.noGroupDummy = {index: 0, filter: {text: this.boxObject.treeBody.getAtt ribute("noGroupText"), dummy: true}};
643 this.noFiltersDummy = {index: 0, filter: {text: this.boxObject.treeBody.getA ttribute("noFiltersText"), dummy: true}};
644 this.editDummy = {filter: {text: ""}};
645
646 let atomService = Cc["@mozilla.org/atom-service;1"].getService(Ci.nsIAtomSer vice);
647 let stringAtoms = ["col-filter", "col-enabled", "col-hitcount", "col-lasthit ", "type-invalid", "type-comment", "type-blocking", "type-whitelist", "type-elem hide", "type-elemhideexception", "type-cssproperty"];
648 let boolAtoms = ["selected", "dummy", "slow", "disabled"];
649
650 this.atoms = {};
651 for (let atom of stringAtoms)
652 this.atoms[atom] = atomService.getAtom(atom);
653 for (let atom of boolAtoms)
640 { 654 {
641 this.noGroupDummy = {index: 0, filter: {text: this.boxObject.treeBody.getA ttribute("noGroupText"), dummy: true}}; 655 this.atoms[atom + "-true"] = atomService.getAtom(atom + "-true");
642 this.noFiltersDummy = {index: 0, filter: {text: this.boxObject.treeBody.ge tAttribute("noFiltersText"), dummy: true}}; 656 this.atoms[atom + "-false"] = atomService.getAtom(atom + "-false");
643 this.editDummy = {filter: {text: ""}}; 657 }
644 658
645 let atomService = Cc["@mozilla.org/atom-service;1"].getService(Ci.nsIAtomS ervice); 659 let columns = this.boxObject.columns;
646 let stringAtoms = ["col-filter", "col-enabled", "col-hitcount", "col-lasth it", "type-invalid", "type-comment", "type-blocking", "type-whitelist", "type-el emhide", "type-elemhideexception", "type-cssproperty"]; 660 for (let i = 0; i < columns.length; i++)
647 let boolAtoms = ["selected", "dummy", "slow", "disabled"]; 661 if (columns[i].element.hasAttribute("sortDirection"))
662 this.sortBy(columns[i].id, columns[i].element.getAttribute("sortDirectio n"));
648 663
649 this.atoms = {}; 664 this.refresh(true);
650 for (let atom of stringAtoms)
651 this.atoms[atom] = atomService.getAtom(atom);
652 for (let atom of boolAtoms)
653 {
654 this.atoms[atom + "-true"] = atomService.getAtom(atom + "-true");
655 this.atoms[atom + "-false"] = atomService.getAtom(atom + "-false");
656 }
657
658 let columns = this.boxObject.columns;
659 for (let i = 0; i < columns.length; i++)
660 if (columns[i].element.hasAttribute("sortDirection"))
661 this.sortBy(columns[i].id, columns[i].element.getAttribute("sortDirect ion"));
662
663 this.refresh(true);
664 }
665 665
666 // Stop propagation of keypress events so that these aren't intercepted by 666 // Stop propagation of keypress events so that these aren't intercepted by
667 // the findbar. 667 // the findbar.
668 this.treeElement.inputField.addEventListener("keypress", event => { 668 this.treeElement.inputField.addEventListener("keypress", event => {
669 event.stopPropagation(); 669 event.stopPropagation();
670 }, false); 670 }, false);
671 }, 671 },
672 672
673 selection: null, 673 selection: null,
674 674
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 getProgressMode: () => null, 834 getProgressMode: () => null,
835 getImageSrc: () => null, 835 getImageSrc: () => null,
836 isSeparator: () => false, 836 isSeparator: () => false,
837 performAction: () => {}, 837 performAction: () => {},
838 performActionOnRow: () => {}, 838 performActionOnRow: () => {},
839 performActionOnCell: () => {}, 839 performActionOnCell: () => {},
840 getCellValue: () => null, 840 getCellValue: () => null,
841 setCellValue: () => {}, 841 setCellValue: () => {},
842 selectionChanged: () => {} 842 selectionChanged: () => {}
843 }; 843 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld