Backout of bug 52352 due to increased leaks on the unit testers
authorDave Townsend <dtownsend@oxymoronical.com>
Wed, 20 Aug 2008 13:59:41 +0100
changeset 17160 7b75ed52358c868fa4bffd146bf3ba480907588e
parent 17159 21c24bbd01c029ebee70f4017e88d46ed0aa9edf
child 17162 30da9cae7cf2aa0445c3c7cdcae0aeea0b5710f1
child 18252 53c8273602533d6cba68bcc9de66b3f2bf36806f
push idunknown
push userunknown
push dateunknown
bugs52352
milestone1.9.1a2pre
Backout of bug 52352 due to increased leaks on the unit testers
dom/src/offline/nsDOMOfflineResourceList.cpp
dom/src/offline/nsDOMOfflineResourceList.h
widget/src/os2/nsFilePicker.cpp
--- a/dom/src/offline/nsDOMOfflineResourceList.cpp
+++ b/dom/src/offline/nsDOMOfflineResourceList.cpp
@@ -68,17 +68,17 @@
 
 // To prevent abuse of the resource list for data storage, the number
 // of offline urls and their length are limited.
 
 static const char kMaxEntriesPref[] =  "offline.max_site_resources";
 #define DEFAULT_MAX_ENTRIES 100
 #define MAX_URI_LENGTH 2048
 
-static nsCString gCachedAsciiHost;
+static nsCAutoString gCachedAsciiHost;
 static char **gCachedKeys = nsnull;
 static PRUint32 gCachedKeysCount = 0;
 
 //
 // nsDOMOfflineResourceList
 //
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMOfflineResourceList)
@@ -185,17 +185,17 @@ nsDOMOfflineResourceList::Init()
                    CheckSameOriginURI(mManifestURI, mDocumentURI, PR_TRUE);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Dynamically-managed resources are stored as a separate ownership list
   // from the manifest.
   rv = mManifestURI->GetAsciiSpec(mDynamicOwnerSpec);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  mDynamicOwnerSpec.AppendLiteral("#dynamic");
+  mDynamicOwnerSpec.Append("#dynamic");
 
   nsCOMPtr<nsIURI> innerURI = NS_GetInnermostURI(mDocumentURI);
   if (!innerURI)
     return NS_ERROR_FAILURE;
 
   rv = innerURI->GetAsciiHost(mAsciiHost);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -1002,10 +1002,13 @@ void
 nsDOMOfflineResourceList::ClearCachedKeys()
 {
   if (gCachedKeys) {
     NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(gCachedKeysCount, gCachedKeys);
     gCachedKeys = nsnull;
     gCachedKeysCount = 0;
   }
 
-  gCachedAsciiHost = EmptyCString();
+  gCachedAsciiHost = "";
 }
+
+
+
--- a/dom/src/offline/nsDOMOfflineResourceList.h
+++ b/dom/src/offline/nsDOMOfflineResourceList.h
@@ -105,18 +105,18 @@ private:
 
   PRBool mInitialized;
   PRBool mToplevel;
   nsCOMPtr<nsIURI> mManifestURI;
   nsCOMPtr<nsIURI> mDocumentURI;
   nsCOMPtr<nsIWeakReference> mWindow;
   nsCOMPtr<nsIOfflineCacheSession> mCacheSession;
   nsCOMPtr<nsIOfflineCacheUpdate> mCacheUpdate;
-  nsCString mAsciiHost;
-  nsCString mDynamicOwnerSpec;
+  nsCAutoString mAsciiHost;
+  nsCAutoString mDynamicOwnerSpec;
 
   nsCOMArray<nsIDOMEventListener> mCheckingListeners;
   nsCOMArray<nsIDOMEventListener> mErrorListeners;
   nsCOMArray<nsIDOMEventListener> mNoUpdateListeners;
   nsCOMArray<nsIDOMEventListener> mDownloadingListeners;
   nsCOMArray<nsIDOMEventListener> mProgressListeners;
   nsCOMArray<nsIDOMEventListener> mCachedListeners;
   nsCOMArray<nsIDOMEventListener> mUpdateReadyListeners;
--- a/widget/src/os2/nsFilePicker.cpp
+++ b/widget/src/os2/nsFilePicker.cpp
@@ -509,29 +509,29 @@ void nsFilePicker::InitNative(nsIWidget 
   mTitle.Assign(aTitle);
   mMode = aMode;
 }
 
 
 //-------------------------------------------------------------------------
 void nsFilePicker::GetFileSystemCharset(nsCString & fileSystemCharset)
 {
-  static nsCString charset;
+  static nsCAutoString aCharset;
+  nsresult rv;
 
-  if (charset.IsEmpty()) {
-    nsresult rv;
+  if (aCharset.Length() < 1) {
     nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);
-    if (NS_SUCCEEDED(rv))
-      rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName, charset);
+	  if (NS_SUCCEEDED(rv)) 
+		  rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName, aCharset);
 
     NS_ASSERTION(NS_SUCCEEDED(rv), "error getting platform charset");
-    if (NS_FAILED(rv))
-      charset.AssignLiteral("IBM850");
+	  if (NS_FAILED(rv)) 
+		  aCharset.AssignLiteral("IBM850");
   }
-  fileSystemCharset = charset;
+  fileSystemCharset = aCharset;
 }
 
 //-------------------------------------------------------------------------
 char * nsFilePicker::ConvertToFileSystemCharset(const nsAString& inString)
 {
   char *outString = nsnull;
   nsresult rv = NS_OK;