Bug 742626 - Allow indexedDB parent directory to not be the default profile directory. r=bent
authorGregor Wagner <anygregor@gmail.com>
Thu, 21 Jun 2012 09:39:12 -0700
changeset 97299 6f0cb242f0e623dba6fc79d92fa6832bcdac336f
parent 97298 5de10f87c56e971dda9b0718d90f9a4febfa1e4f
child 97300 cc426bd053fe7a214b1d3b99ccefdf74c0ce1524
push id865
push usertim.taubert@gmx.de
push dateFri, 22 Jun 2012 15:35:25 +0000
treeherderfx-team@06873a64a192 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs742626
milestone16.0a1
Bug 742626 - Allow indexedDB parent directory to not be the default profile directory. r=bent
dom/indexedDB/IndexedDatabaseManager.cpp
xpcom/io/nsAppDirectoryServiceDefs.h
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -209,18 +209,20 @@ IndexedDatabaseManager::GetOrCreate()
       instance->mCurrentWindowIndex = BAD_TLS_INDEX;
       return nsnull;
     }
 
     nsresult rv;
 
     if (sIsMainProcess) {
       nsCOMPtr<nsIFile> dbBaseDirectory;
-      rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
-                                  getter_AddRefs(dbBaseDirectory));
+      rv = NS_GetSpecialDirectory(NS_APP_INDEXEDDB_PARENT_DIR, getter_AddRefs(dbBaseDirectory));
+      if (NS_FAILED(rv)) {
+          rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(dbBaseDirectory));
+      }
       NS_ENSURE_SUCCESS(rv, nsnull);
 
       rv = dbBaseDirectory->Append(NS_LITERAL_STRING("indexedDB"));
       NS_ENSURE_SUCCESS(rv, nsnull);
 
       rv = dbBaseDirectory->GetPath(instance->mDatabaseBasePath);
       NS_ENSURE_SUCCESS(rv, nsnull);
 
--- a/xpcom/io/nsAppDirectoryServiceDefs.h
+++ b/xpcom/io/nsAppDirectoryServiceDefs.h
@@ -81,9 +81,11 @@
 
 #define NS_APP_DOWNLOADS_50_FILE                "DLoads"
          
 #define NS_APP_SEARCH_50_FILE                   "SrchF"
          
 #define NS_APP_INSTALL_CLEANUP_DIR              "XPIClnupD"  //location of xpicleanup.dat xpicleanup.exe 
 
 #define NS_APP_STORAGE_50_FILE                  "UStor" // sqlite database used as mozStorage profile db
+
+#define NS_APP_INDEXEDDB_PARENT_DIR             "indexedDBPDir"
 #endif