bug 803330 - fix row count assertion failure in page info dialog draft
authorDavid Keeler <dkeeler@mozilla.com>
Thu, 14 Jul 2016 17:21:14 -0700
changeset 387871 c350ee220dce1720a3e02cd96fafea5a67f75b78
parent 387623 08f8a5aacd8308a73f6040fe522be7ba38497561
child 525472 9b2d49c8d6ffeb77cd639acd01571cfa5565cb1d
push id23094
push userdkeeler@mozilla.com
push dateFri, 15 Jul 2016 00:21:29 +0000
bugs803330
milestone50.0a1
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
browser/base/content/pageinfo/pageInfo.js
--- 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);
   },