Bug 929816 - Allow devicestorage testing mode to work on travis. r=mikeh
authorDave Hylands <dhylands@mozilla.com>
Wed, 23 Oct 2013 15:03:03 -0700
changeset 166598 354e00efe670b860cc5fd606ff47543c2be3acae
parent 166597 1b1567b456a53fdc64c21048629d92a8c8ec72a2
child 166599 ed1936907636c49714ec1b07961d0ba8cc10c118
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikeh
bugs929816
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 929816 - Allow devicestorage testing mode to work on travis. r=mikeh
dom/devicestorage/nsDeviceStorage.cpp
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -757,20 +757,26 @@ DeviceStorageFile::GetRootDirectoryForTy
 #else
      f = sDirs->sdcard;
 #endif
   }
 
   // crash reports directory.
   else if (aStorageType.EqualsLiteral(DEVICESTORAGE_CRASHES)) {
     f = sDirs->crashes;
+  } else {
+    // Not a storage type that we recognize. Return null
+    return;
   }
 
-  // in testing, we default all device storage types to a temp directory
-  if (f && sDirs->temp) {
+  // In testing, we default all device storage types to a temp directory.
+  // sDirs->temp will only have been initialized (in InitDirs) if the
+  // preference device.storage.testing was set to true. We can't test the
+  // preference directly here, since we may not be on the main thread.
+  if (sDirs->temp) {
     f = sDirs->temp;
   }
 
   if (f) {
     f->Clone(aFile);
   }
 }