bug 803330 - fix row count assertion failure in page info dialog
When calling rowCountChanged on an nsITreeBoxObject, the implementation assumes
that the row count has actually changed. pageInfoTreeView violated this
assumption in addRows by first calling rowCountChanged and then updating its row
count. This patch fixes the issue by using the power of decomposition. That is,
there's already a perfectly fine function called 'addRow' that can be called
once for each row being added.
MozReview-Commit-ID: HP6LkP4ICLf
--- a/browser/base/content/pageinfo/pageInfo.js
+++ b/browser/base/content/pageinfo/pageInfo.js
@@ -53,21 +53,18 @@ pageInfoTreeView.prototype = {
this.rowCountChanged(this.rows - 1, 1);
if (this.selection.count == 0 && this.rowCount && !gImageElement) {
this.selection.select(0);
}
},
addRows: function(rows)
{
- this.data = this.data.concat(rows);
- this.rowCountChanged(this.rows, rows.length);
- this.rows = this.data.length;
- if (this.selection.count == 0 && this.rowCount && !gImageElement) {
- this.selection.select(0);
+ for (let row of rows) {
+ this.addRow(row);
}
},
rowCountChanged: function(index, count)
{
this.tree.rowCountChanged(index, count);
},