Bug 497089 When tests finish, free various message headers/global variables. r=bienvenu
authorMark Banner <bugzilla@standard8.plus.com>
Tue, 09 Jun 2009 20:00:33 +0100
changeset 2812 d1a9b79cf5c22d89450042fd415bffa1396e6073
parent 2811 3c7a12447bdc958fd2620f7275fa43f39fd173c6
child 2813 f1fcff5eb0617cfe9fce4f82a06a30d18ba36189
push idunknown
push userunknown
push dateunknown
reviewersbienvenu
bugs497089
Bug 497089 When tests finish, free various message headers/global variables. r=bienvenu
mailnews/base/test/unit/test_bccInDatabase.js
mailnews/base/test/unit/test_bug428427.js
mailnews/base/test/unit/test_bug471682.js
mailnews/base/test/unit/test_junkWhitelisting.js
mailnews/base/test/unit/test_searchJunk.js
mailnews/base/test/unit/test_searchTag.js
mailnews/db/msgdb/test/unit/test_propertyEnumerator.js
mailnews/local/test/unit/test_msgCopy.js
--- a/mailnews/base/test/unit/test_bccInDatabase.js
+++ b/mailnews/base/test/unit/test_bccInDatabase.js
@@ -66,11 +66,12 @@ function run_test()
 function continueTest()
 {
   //dump("\nbccList >" + hdr.bccList);
   //dump("\nccList >" + hdr.ccList);
   //dump("\n");
   do_check_true(hdr.bccList.indexOf("Another Person") >= 0);
   do_check_true(hdr.bccList.indexOf("<u1@example.com>") >= 0);
   do_check_false(hdr.bccList.indexOf("IDoNotExist") >=0);
+  hdr = null;
   do_test_finished();
 }
 
--- a/mailnews/base/test/unit/test_bug428427.js
+++ b/mailnews/base/test/unit/test_bug428427.js
@@ -189,17 +189,20 @@ function testVirtualFolder()
    
   // remove tag from one item to decrease count
   var message1 = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
   message1.appendElement(hdrs[1], false);
 
   gLocalInboxFolder.removeKeywordsFromMessages(message1, tag1);
   do_check_eq(3, virtualFolder.getTotalMessages(false));
   do_check_eq(1, virtualFolder.getNumUnread(false));
-  
+
+  // End of test, so release our header references
+  hdrs = null;
+
   do_test_finished();
   return true;
 }
 
 // helper functions
 
 // adapted from commandglue.js
 function CreateVirtualFolder(newName, parentFolder, searchFolderURIs, searchTerm, searchOnline)
@@ -255,9 +258,8 @@ function makeSearchTerm(aFolder, aStrVal
   value.str = aStrValue;
   searchTerm.value = value;
   searchTerm.attrib = aAttrib;
   searchTerm.op = aOp;
   searchTerm.booleanAnd = false;
   searchSession = null;
   return searchTerm;
 }
-
--- a/mailnews/base/test/unit/test_bug471682.js
+++ b/mailnews/base/test/unit/test_bug471682.js
@@ -116,11 +116,13 @@ var step5 =
   {
     var dbSize = gSubfolder.msgDatabase.dBFolderInfo.folderSize;
     var dbDate = gSubfolder.msgDatabase.dBFolderInfo.folderDate;
     var filePath = gSubfolder.filePath;
     var date = parseInt(filePath.lastModifiedTime/1000);
     var size = filePath.fileSize;
     do_check_eq(size, dbSize);
     do_check_eq(date, dbDate);
+    // End of test, so release our header reference
+    gHdr = null;
     do_test_finished();
   }
 }
--- a/mailnews/base/test/unit/test_junkWhitelisting.js
+++ b/mailnews/base/test/unit/test_junkWhitelisting.js
@@ -213,11 +213,14 @@ function continueTest()
   spamSettings.initialize(server);
   do_check_false(spamSettings.checkWhiteList(hdrs[kDomainTest]));
 
   // stop suppressing whitelist by domain
   server.setBoolValue("inhibitWhiteListingIdentityDomain", false);
   spamSettings.initialize(server);
   do_check_true(spamSettings.checkWhiteList(hdrs[kDomainTest]));
 
+  // Free our globals
+  hdrs = null;
+
   do_test_finished();
 }
 
--- a/mailnews/base/test/unit/test_searchJunk.js
+++ b/mailnews/base/test/unit/test_searchJunk.js
@@ -252,11 +252,12 @@ function testJunkSearch()
                          test.attrib,
                          test.op,
                          test.count,
                          testJunkSearch);
   }
   else
   {
     testObject = null;
+    hdr = null;
     do_test_finished();
   }
 }
--- a/mailnews/base/test/unit/test_searchTag.js
+++ b/mailnews/base/test/unit/test_searchTag.js
@@ -402,12 +402,13 @@ function testKeywordSearch()
                          nsMsgSearchAttrib.Keywords,
                          test.op,
                          test.count,
                          testKeywordSearch);
   }
   else
   {
     testObject = null;
+    hdr = null;
     do_test_finished();
   }
 }
 
--- a/mailnews/db/msgdb/test/unit/test_propertyEnumerator.js
+++ b/mailnews/db/msgdb/test/unit/test_propertyEnumerator.js
@@ -88,10 +88,11 @@ function continue_test()
     //dump("\nProperty 2 is " + property);
     properties.push(property);
   }
   do_check_true(properties.indexOf("flags") >= 0);
   do_check_true(properties.indexOf("size") >= 0);
   do_check_true(properties.indexOf("iamnew") >= 0);
   do_check_true(properties.indexOf("idonotexist") < 0);
 
+  gHdr = null;
   do_test_finished();
 }
--- a/mailnews/local/test/unit/test_msgCopy.js
+++ b/mailnews/local/test/unit/test_msgCopy.js
@@ -67,13 +67,14 @@ var copyListener =
   SetMessageKey: function(aKey)
   {
     hdrs.push(gLocalInboxFolder.GetMessageHeader(aKey));
   },
   SetMessageId: function(aMessageId) {},
   OnStopCopy: function(aStatus)
   {
     var copiedMessage = gLocalInboxFolder.GetMessageHeader(hdrs[0]);
-    do_check_eq(copiedMessage.getStringProperty("keywords"), tag1);    
+    do_check_eq(copiedMessage.getStringProperty("keywords"), tag1);
+    hdrs = null;
     do_test_finished();
   }
 };