Bug 586555 - groupItemStorageSanity: if it's a check, let's really check it! r=tim
authorRaymond Lee <raymond@raysquare.com>
Thu, 04 Aug 2011 23:40:10 +0800
changeset 74057 7715c3c492ae754211b4881fedb0fe8a045e69ff
parent 73952 eef25ec2d58e3f7d845438209ba2d95c44f0e441
child 74058 9c3ea24a7bffc54d8169042c8a15090e602b4126
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewerstim
bugs586555
milestone8.0a1
Bug 586555 - groupItemStorageSanity: if it's a check, let's really check it! r=tim
browser/base/content/tabview/groupitems.js
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -2228,22 +2228,24 @@ let GroupItems = {
     
     return (groupItemsData && !Utils.isEmptyObject(groupItemsData));
   },
 
   // ----------
   // Function: groupItemStorageSanity
   // Given persistent storage data for a groupItem, returns true if it appears to not be damaged.
   groupItemStorageSanity: function GroupItems_groupItemStorageSanity(groupItemData) {
-    // TODO: check everything
-    // Bug 586555
-    var sane = true;
-    if (!Utils.isRect(groupItemData.bounds)) {
+    let sane = true;
+    if (!groupItemData.bounds || !Utils.isRect(groupItemData.bounds)) {
       Utils.log('GroupItems.groupItemStorageSanity: bad bounds', groupItemData.bounds);
       sane = false;
+    } else if ((groupItemData.userSize && 
+               !Utils.isPoint(groupItemData.userSize)) ||
+               !groupItemData.id) {
+      sane = false;
     }
 
     return sane;
   },
 
   // ----------
   // Function: register
   // Adds the given <GroupItem> to the list of groupItems we're tracking.