From ea4f46740c85f585f4b8459c51ecde7b6f9a8548 Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Wed, 23 Oct 2013 15:03:03 -0700 Subject: [PATCH] Bug 929816 - Allow devicestorage testing mode to work on travis. r=mikeh --HG-- extra : amend_source : 6eeed813c1634a5c6113455c8b4319f3e8d0d5a9 --- dom/devicestorage/nsDeviceStorage.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 6b8e9c583aa..9c503523e25 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -762,10 +762,16 @@ DeviceStorageFile::GetRootDirectoryForType(const nsAString& aStorageType, // 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; }