Back out dougt (bug 788588 et al.) for burning the tree (and some nostalgia).
authorKyle Huey <khuey@kylehuey.com>
Wed, 05 Sep 2012 15:59:49 -0700
changeset 104354 fd4d9c386f973197c25d8103275b3dc04b989680
parent 104340 627f6297acea92a8d3bab0989cb3242df02b92a6
child 104355 8a11353cad22ba883227444f7c734d3fa815a397
child 104377 1f1e5cdae68d482dbaf2c348333503e0097d89bb
push id14471
push userryanvm@gmail.com
push dateWed, 05 Sep 2012 23:10:59 +0000
treeherdermozilla-inbound@c6768c151b64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs788588
milestone18.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
Back out dougt (bug 788588 et al.) for burning the tree (and some nostalgia).
dom/devicestorage/DeviceStorage.h
dom/devicestorage/DeviceStorageRequestParent.cpp
dom/devicestorage/nsDeviceStorage.cpp
dom/devicestorage/nsDeviceStorage.h
dom/devicestorage/test/Makefile.in
dom/devicestorage/test/devicestorage_common.js
dom/devicestorage/test/test_add.html
dom/devicestorage/test/test_addCorrectType.html
dom/devicestorage/test/test_basic.html
dom/devicestorage/test/test_diskSpace.html
dom/devicestorage/test/test_dotdot.html
dom/devicestorage/test/test_enumerate.html
dom/devicestorage/test/test_enumerateMultipleContinue.html
dom/devicestorage/test/test_enumerateNoParam.html
dom/devicestorage/test/test_enumerateOptions.html
dom/devicestorage/test/test_lastModificationFilter.html
dom/devicestorage/test/test_overwrite.html
dom/devicestorage/test/test_sanity.html
dom/devicestorage/test/test_stat.html
dom/devicestorage/test/test_watch.html
dom/devicestorage/test/test_watchOther.html
toolkit/content/devicestorage.properties
toolkit/content/jar.mn
--- a/dom/devicestorage/DeviceStorage.h
+++ b/dom/devicestorage/DeviceStorage.h
@@ -45,19 +45,16 @@ private:
 
   nsresult EnumerateInternal(const JS::Value & aName,
                              const JS::Value & aOptions,
                              JSContext* aCx,
                              uint8_t aArgc, 
                              bool aEditable, 
                              nsIDOMDeviceStorageCursor** aRetval);
 
-  static bool IsMimeTypeCorrectForStorageType(nsAString& aType,
-					      nsIDOMBlob* aBlob);
-
   nsString mStorageType;
   nsCOMPtr<nsIFile> mRootDirectory;
 
   nsCOMPtr<nsIPrincipal> mPrincipal;
 
   bool mIsWatchingFile;
   bool mAllowedToWatchFile;
 
--- a/dom/devicestorage/DeviceStorageRequestParent.cpp
+++ b/dom/devicestorage/DeviceStorageRequestParent.cpp
@@ -308,17 +308,17 @@ DeviceStorageRequestParent::StatFileEven
 
 nsresult
 DeviceStorageRequestParent::StatFileEvent::CancelableRun()
 {
   NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
 
   nsCOMPtr<nsIRunnable> r;
   uint64_t diskUsage = 0;
-  DeviceStorageFile::DirectoryDiskUsage(mFile->mFile, &diskUsage, mFile->mStorageType);
+  DeviceStorageFile::DirectoryDiskUsage(mFile->mFile, &diskUsage);
   int64_t freeSpace = 0;
   nsresult rv = mFile->mFile->GetDiskSpaceAvailable(&freeSpace);
   if (NS_FAILED(rv)) {
     freeSpace = 0;
   }
   
   r = new PostStatResultEvent(mParent, freeSpace, diskUsage);
   NS_DispatchToMainThread(r);
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -34,27 +34,29 @@
 #include "nsCRT.h"
 #include "mozilla/Services.h"
 #include "nsIObserverService.h"
 #include "GeneratedEvents.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
 #include "nsIMIMEService.h"
 #include "nsCExternalHandlerService.h"
 
-#include "nsIStringBundle.h"
-
 // Microsoft's API Name hackery sucks
 #undef CreateEvent
 
 #ifdef MOZ_WIDGET_GONK
 #include "nsIVolume.h"
 #include "nsIVolumeService.h"
 #endif
 
-#define DEVICESTORAGE_PROPERTIES "chrome://global/content/devicestorage.properties"
+#define DEBUG_ISTYPE 1
+
+#ifdef DEBUG_ISTYPE
+#include "nsIConsoleService.h"
+#endif
 
 using namespace mozilla::dom;
 using namespace mozilla::dom::devicestorage;
 
 #include "nsDirectoryServiceDefs.h"
 
 class IOEventComplete : public nsRunnable
 {
@@ -77,19 +79,17 @@ public:
     return NS_OK;
   }
 
 private:
   nsRefPtr<DeviceStorageFile> mFile;
   nsCString mType;
 };
 
-DeviceStorageFile::DeviceStorageFile(const nsAString& aStorageType,
-				     nsIFile* aFile,
-				     const nsAString& aPath)
+DeviceStorageFile::DeviceStorageFile(const nsAString& aStorageType, nsIFile* aFile, const nsAString& aPath)
   : mPath(aPath)
   , mStorageType(aStorageType)
   , mEditable(false)
 {
   NS_ASSERTION(aFile, "Must not create a DeviceStorageFile with a null nsIFile");
   // always take a clone
   nsCOMPtr<nsIFile> file;
   aFile->Clone(getter_AddRefs(mFile));
@@ -146,50 +146,82 @@ DeviceStorageFile::IsSafePath()
         PL_strcmp(token, "..") == 0 ) {
       return false;
     }
   }
   return true;
 }
 
 bool
-DeviceStorageFile::IsType(nsIFile* aFile, const nsAString& aStorageType)
+DeviceStorageFile::IsType(nsAString& aType)
 {
-  // String bundles are cached by the bundle service.
-  nsCOMPtr<nsIStringBundleService> stringService = mozilla::services::GetStringBundleService();
-  if (!stringService) {
-    return false;
+  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
+
+  // in testing, we ignore filtering for the testing types
+  if (mozilla::Preferences::GetBool("device.storage.testing", false) &&
+      (aType.Equals(NS_LITERAL_STRING("testing")) ||
+       aType.Equals(NS_LITERAL_STRING("testing-other")))) {
+    return true;
   }
 
-  nsCOMPtr<nsIStringBundle> filterBundle;
-  if (NS_FAILED(stringService->CreateBundle(DEVICESTORAGE_PROPERTIES,
-					    getter_AddRefs(filterBundle)))) {
+#ifdef DEBUG_ISTYPE
+  nsCOMPtr<nsIConsoleService> svc = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
+  char buffer[1024];
+  nsCString path;
+  mFile->GetNativePath(path);
+
+  PRIntervalTime iStart = PR_IntervalNow();
+#endif
+
+  nsAutoCString mimeType;
+  nsCOMPtr<nsIMIMEService> mimeService = do_GetService(NS_MIMESERVICE_CONTRACTID);
+  if (!mimeService) {
     return false;
   }
 
-  nsString path;
-  aFile->GetPath(path);
+  nsresult rv = mimeService->GetTypeFromFile(mFile, mimeType);
+  if (NS_FAILED(rv)) {
+#ifdef DEBUG_ISTYPE
+    sprintf(buffer, "GetTypeFromFile failed for %s (took: %dms)\n",
+	    path.get(),
+	    PR_IntervalToMilliseconds(PR_IntervalNow() - iStart));
 
-  int32_t dotIdx = path.RFindChar(PRUnichar('.'));
-  if (dotIdx == kNotFound) {
+    nsString data;
+    CopyASCIItoUTF16(buffer, data);
+    svc->LogStringMessage(data.get());
+    printf("%s\n", buffer);
+#endif
     return false;
   }
 
-  nsAutoString extensionMatch;
-  extensionMatch.AssignASCII("*");
-  extensionMatch.Append(Substring(path, dotIdx));
-  extensionMatch.AppendASCII(";");
+#ifdef DEBUG_ISTYPE
+  sprintf(buffer, "IsType of %s is %s (took: %dms)\n",
+	  path.get(),
+	  mimeType.get(),
+	  PR_IntervalToMilliseconds(PR_IntervalNow() - iStart));
 
-  nsString extensionListStr;
-  if (NS_FAILED(filterBundle->GetStringFromName(aStorageType.BeginReading(),
-						getter_Copies(extensionListStr)))) {
-    return false;
+  nsString data;
+  CopyASCIItoUTF16(buffer, data);
+  svc->LogStringMessage(data.get());
+  printf("%s\n", buffer);
+#endif
+
+  if (aType.Equals(NS_LITERAL_STRING("pictures"))) {
+    return StringBeginsWith(mimeType, NS_LITERAL_CSTRING("image/"));
   }
 
-  return FindInReadable(extensionMatch, extensionListStr);
+  if (aType.Equals(NS_LITERAL_STRING("videos"))) {
+    return StringBeginsWith(mimeType, NS_LITERAL_CSTRING("video/"));
+  }
+
+  if (aType.Equals(NS_LITERAL_STRING("music"))) {
+    return StringBeginsWith(mimeType, NS_LITERAL_CSTRING("audio/"));
+  }
+
+  return false;
 }
 
 void
 DeviceStorageFile::NormalizeFilePath() {
 #if defined(XP_WIN)
   PRUnichar* cur = mPath.BeginWriting();
   PRUnichar* end = mPath.EndWriting();
   for (; cur < end; ++cur) {
@@ -313,17 +345,17 @@ DeviceStorageFile::Remove()
 {
   NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
 
   bool check;
   nsresult rv = mFile->Exists(&check);
   if (NS_FAILED(rv)) {
     return rv;
   }
-
+  
   if (!check) {
     return NS_OK;
   }
 
   rv = mFile->Remove(true);
   if (NS_FAILED(rv)) {
     return rv;
   }
@@ -398,17 +430,17 @@ DeviceStorageFile::collectFilesInternal(
       nsRefPtr<DeviceStorageFile> dsf = new DeviceStorageFile(mStorageType, f);
       dsf->SetPath(newPath);
       aFiles.AppendElement(dsf);
     }
   }
 }
 
 void
-DeviceStorageFile::DirectoryDiskUsage(nsIFile* aFile, uint64_t* aSoFar, const nsAString& aStorageType)
+DeviceStorageFile::DirectoryDiskUsage(nsIFile* aFile, uint64_t* aSoFar)
 {
   if (!aFile) {
     return;
   }
 
   nsresult rv;
   nsCOMPtr<nsISimpleEnumerator> e;
   rv = aFile->GetDirectoryEntries(getter_AddRefs(e));
@@ -434,28 +466,22 @@ DeviceStorageFile::DirectoryDiskUsage(ns
       continue;
     }
 
     bool isLink;
     rv = f->IsSymlink(&isLink);
     if (NS_FAILED(rv)) {
       continue;
     }
-
     if (isLink) {
       // for now, lets just totally ignore symlinks.
       NS_WARNING("DirectoryDiskUsage ignores symlinks");
     } else if (isDir) {
-      DirectoryDiskUsage(f, aSoFar, aStorageType);
+      DirectoryDiskUsage(f, aSoFar);
     } else if (isFile) {
-
-      if (!DeviceStorageFile::IsType(f, aStorageType)) {
-	continue;
-      }
-
       int64_t size;
       rv = f->GetFileSize(&size);
       if (NS_SUCCEEDED(rv)) {
 	*aSoFar += size;
       }
     }
   }
 }
@@ -516,54 +542,53 @@ nsDOMDeviceStorage::SetRootDirectoryForT
   // Picture directory
   if (aType.Equals(NS_LITERAL_STRING("pictures"))) {
 #ifdef MOZ_WIDGET_GONK
     NS_NewLocalFile(NS_LITERAL_STRING("/sdcard"), false, getter_AddRefs(f));
 #elif defined (MOZ_WIDGET_COCOA)
     dirService->Get(NS_OSX_PICTURE_DOCUMENTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
 #elif defined (XP_UNIX)
     dirService->Get(NS_UNIX_XDG_PICTURES_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
-#elif defined (XP_WIN)
-    dirService->Get(NS_WIN_PERSONAL_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
 #endif
   }
 
   // Video directory
   else if (aType.Equals(NS_LITERAL_STRING("videos"))) {
 #ifdef MOZ_WIDGET_GONK
     NS_NewLocalFile(NS_LITERAL_STRING("/sdcard"), false, getter_AddRefs(f));
 #elif defined (MOZ_WIDGET_COCOA)
     dirService->Get(NS_OSX_MOVIE_DOCUMENTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
 #elif defined (XP_UNIX)
     dirService->Get(NS_UNIX_XDG_VIDEOS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
-#elif defined (XP_WIN)
-    dirService->Get(NS_WIN_PERSONAL_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
 #endif
   }
 
   // Music directory
   else if (aType.Equals(NS_LITERAL_STRING("music"))) {
 #ifdef MOZ_WIDGET_GONK
     NS_NewLocalFile(NS_LITERAL_STRING("/sdcard"), false, getter_AddRefs(f));
 #elif defined (MOZ_WIDGET_COCOA)
     dirService->Get(NS_OSX_MUSIC_DOCUMENTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
 #elif defined (XP_UNIX)
     dirService->Get(NS_UNIX_XDG_MUSIC_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
-#elif defined (XP_WIN)
-    dirService->Get(NS_WIN_PERSONAL_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
 #endif
   }
 
-  // in testing, we default all device storage types to a temp directory
-  if (f && mozilla::Preferences::GetBool("device.storage.testing", false)) {
-    dirService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
-    if (f) {
-      f->AppendRelativeNativePath(NS_LITERAL_CSTRING("device-storage-testing"));
-      f->Create(nsIFile::DIRECTORY_TYPE, 0777);
-      f->Normalize();
+  // in testing, we have access to a few more directory locations
+  if (mozilla::Preferences::GetBool("device.storage.testing", false)) {
+
+    // testing directory
+    if (aType.Equals(NS_LITERAL_STRING("testing")) ||
+	aType.Equals(NS_LITERAL_STRING("testing-other"))) {
+      dirService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
+      if (f) {
+        f->AppendRelativeNativePath(NS_LITERAL_CSTRING("device-storage-testing"));
+        f->Create(nsIFile::DIRECTORY_TYPE, 0777);
+        f->Normalize();
+      }
     }
   }
 
 #ifdef MOZ_WIDGET_GONK
   RegisterForSDCardChanges(this);
 #endif
 
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
@@ -778,17 +803,17 @@ ContinueCursorEvent::Run() {
 
   nsDOMDeviceStorageCursor* cursor = static_cast<nsDOMDeviceStorageCursor*>(mRequest.get());
   nsString cursorStorageType;
   cursor->GetStorageType(cursorStorageType);
 
   while (cursor->mFiles.Length() > 0) {
     nsRefPtr<DeviceStorageFile> file = cursor->mFiles[0];
     cursor->mFiles.RemoveElementAt(0);
-    if (!DeviceStorageFile::IsType(file->mFile, cursorStorageType)) {
+    if (!file->IsType(cursorStorageType)) {
       continue;
     }
     val = nsIFileToJsval(cursor->GetOwner(), file);
     cursor->mOkToCallContinue = true;
     break;
   }
 
   mRequest->FireSuccess(val);
@@ -1192,17 +1217,17 @@ public:
 
   ~StatFileEvent() {}
 
   NS_IMETHOD Run()
   {
     NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
     nsCOMPtr<nsIRunnable> r;
     uint64_t diskUsage = 0;
-    DeviceStorageFile::DirectoryDiskUsage(mFile->mFile, &diskUsage, mFile->mStorageType);
+    DeviceStorageFile::DirectoryDiskUsage(mFile->mFile, &diskUsage);
     int64_t freeSpace = 0;
     nsresult rv = mFile->mFile->GetDiskSpaceAvailable(&freeSpace);
     if (NS_FAILED(rv)) {
       freeSpace = 0;
     }
 
     r = new PostStatResultEvent(mRequest, freeSpace, diskUsage);
     NS_DispatchToMainThread(r);
@@ -1547,75 +1572,27 @@ nsDOMDeviceStorage::CreateDeviceStorages
                                             nsDOMDeviceStorage** aStore)
 {
   nsRefPtr<nsDOMDeviceStorage> storage = new nsDOMDeviceStorage();
   if (NS_SUCCEEDED(storage->Init(aWin, aType))) {
     NS_ADDREF(*aStore = storage);
   }
 }
 
-bool
-nsDOMDeviceStorage::IsMimeTypeCorrectForStorageType(nsAString& aType, nsIDOMBlob* aBlob)
-{
-  NS_ASSERTION(aBlob, "Calling IsMimeTypeCorrectForStorageType without a blob");
-
-  nsString mimeType;
-  if (NS_FAILED(aBlob->GetType(mimeType))) {
-    return false;
-  }
-
-  if (aType.Equals(NS_LITERAL_STRING("pictures"))) {
-    return StringBeginsWith(mimeType, NS_LITERAL_STRING("image/"));
-  }
-
-  if (aType.Equals(NS_LITERAL_STRING("videos"))) {
-    return StringBeginsWith(mimeType, NS_LITERAL_STRING("video/"));
-  }
-
-  if (aType.Equals(NS_LITERAL_STRING("music"))) {
-    return StringBeginsWith(mimeType, NS_LITERAL_STRING("audio/"));
-  }
-
-  return false;
-}
-
 NS_IMETHODIMP
 nsDOMDeviceStorage::Add(nsIDOMBlob *aBlob, nsIDOMDOMRequest * *_retval)
 {
-  if (!aBlob) {
-    return NS_OK;
-  }
-
-  nsCOMPtr<nsIMIMEService> mimeSvc = do_GetService(NS_MIMESERVICE_CONTRACTID);
-  if (!mimeSvc) {
-    return NS_ERROR_FAILURE;
-  }
-
-  // if mimeType isn't set, we will not get a correct
-  // extension, and AddNamed() will fail.  This will post an
-  // onerror to the requestee.
-  nsString mimeType;
-  aBlob->GetType(mimeType);
-
-  nsCString extension;
-  mimeSvc->GetPrimaryExtension(NS_LossyConvertUTF16toASCII(mimeType), EmptyCString(), extension);
-  // if extension is null here, we will ignore it for now.
-  // AddNamed() will check the file path and fail.  This
-  // will post an onerror to the requestee.
-
   // possible race here w/ unique filename
   char buffer[128];
-  NS_MakeRandomString(buffer, ArrayLength(buffer));
+  NS_MakeRandomString(buffer, 128);
 
-  nsAutoCString path;
-  path.Assign(nsDependentCString(buffer));
-  path.Append(".");
-  path.Append(extension);
+  nsString path;
+  path.AssignWithConversion(nsDependentCString(buffer));
 
-  return AddNamed(aBlob, NS_ConvertASCIItoUTF16(path), _retval);
+  return AddNamed(aBlob, path, _retval);
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::AddNamed(nsIDOMBlob *aBlob,
                              const nsAString & aPath,
                              nsIDOMDOMRequest * *_retval)
 {
   // if the blob is null here, bail
@@ -1628,27 +1605,24 @@ nsDOMDeviceStorage::AddNamed(nsIDOMBlob 
   }
 
   nsRefPtr<DOMRequest> request = new DOMRequest(win);
   NS_ADDREF(*_retval = request);
 
   nsCOMPtr<nsIRunnable> r;
 
   nsRefPtr<DeviceStorageFile> dsf = new DeviceStorageFile(mStorageType, mRootDirectory, aPath);
-  if (!DeviceStorageFile::IsType(dsf->mFile, mStorageType) || !IsMimeTypeCorrectForStorageType(mStorageType, aBlob)) {
-    r = new PostErrorEvent(request, POST_ERROR_EVENT_ILLEGAL_TYPE, dsf);
-  }
-  else if (!dsf->IsSafePath()) {
+
+  if (!dsf->IsSafePath()) {
     r = new PostErrorEvent(request, POST_ERROR_EVENT_ILLEGAL_FILE_NAME, dsf);
   }
   else {
     r = new DeviceStorageRequest(DeviceStorageRequest::DEVICE_STORAGE_REQUEST_WRITE,
-				 win, mPrincipal, dsf, request, aBlob);
+                                 win, mPrincipal, dsf, request, aBlob);
   }
-
   NS_DispatchToMainThread(r);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::Get(const JS::Value & aPath,
                         JSContext* aCx,
                         nsIDOMDOMRequest * *_retval)
@@ -1688,16 +1662,17 @@ nsDOMDeviceStorage::GetInternal(const JS
                            POST_ERROR_EVENT_NON_STRING_TYPE_UNSUPPORTED,
                            dsf);
     NS_DispatchToMainThread(r);
     return NS_OK;
   }
 
   nsRefPtr<DeviceStorageFile> dsf = new DeviceStorageFile(mStorageType, mRootDirectory, path);
   dsf->SetEditable(aEditable);
+
   if (!dsf->IsSafePath()) {
     r = new PostErrorEvent(request, POST_ERROR_EVENT_ILLEGAL_FILE_NAME, dsf);
   } else {
     r = new DeviceStorageRequest(DeviceStorageRequest::DEVICE_STORAGE_REQUEST_READ,
                                  win, mPrincipal, dsf, request);
   }
   NS_DispatchToMainThread(r);
   return NS_OK;
@@ -2153,9 +2128,9 @@ nsDOMDeviceStorage::GetContextForEventHa
 }
 
 JSContext *
 nsDOMDeviceStorage::GetJSContextForEventHandlers()
 {
   return nsDOMEventTargetHelper::GetJSContextForEventHandlers();
 }
 
-NS_IMPL_EVENT_HANDLER(nsDOMDeviceStorage, change)
+NS_IMPL_EVENT_HANDLER(nsDOMDeviceStorage, change)
\ No newline at end of file
--- a/dom/devicestorage/nsDeviceStorage.h
+++ b/dom/devicestorage/nsDeviceStorage.h
@@ -28,17 +28,16 @@ class nsPIDOMWindow;
 #include "mozilla/Mutex.h"
 #include "DeviceStorage.h"
 
 
 #define POST_ERROR_EVENT_FILE_DOES_NOT_EXIST         "File location doesn't exists"
 #define POST_ERROR_EVENT_FILE_NOT_ENUMERABLE         "File location is not enumerable"
 #define POST_ERROR_EVENT_PERMISSION_DENIED           "Permission Denied"
 #define POST_ERROR_EVENT_ILLEGAL_FILE_NAME           "Illegal file name"
-#define POST_ERROR_EVENT_ILLEGAL_TYPE                "Illegal content type"
 #define POST_ERROR_EVENT_UNKNOWN                     "Unknown"
 #define POST_ERROR_EVENT_NON_STRING_TYPE_UNSUPPORTED "Non-string type unsupported"
 #define POST_ERROR_EVENT_NOT_IMPLEMENTED             "Not implemented"
 
 using namespace mozilla::dom;
 
 class DeviceStorageFile MOZ_FINAL
   : public nsISupports {
@@ -53,25 +52,25 @@ public:
   void SetPath(const nsAString& aPath);
   void SetEditable(bool aEditable);
 
   NS_DECL_ISUPPORTS
 
   // we want to make sure that the names of file can't reach
   // outside of the type of storage the user asked for.
   bool IsSafePath();
+  bool IsType(nsAString& aType);
 
   nsresult Remove();
   nsresult Write(nsIInputStream* aInputStream);
   nsresult Write(InfallibleTArray<uint8_t>& bits);
   void CollectFiles(nsTArray<nsRefPtr<DeviceStorageFile> > &aFiles, uint64_t aSince = 0);
   void collectFilesInternal(nsTArray<nsRefPtr<DeviceStorageFile> > &aFiles, uint64_t aSince, nsAString& aRootPath);
 
-  static bool IsType(nsIFile* aFile, const nsAString& aStorageType);
-  static void DirectoryDiskUsage(nsIFile* aFile, uint64_t* aSoFar, const nsAString& aStorageType);
+  static void DirectoryDiskUsage(nsIFile* aFile, uint64_t* aSoFar);
 
 private:
   void NormalizeFilePath();
   void AppendRelativePath();
 };
 
 class ContinueCursorEvent MOZ_FINAL: public nsRunnable
 {
--- a/dom/devicestorage/test/Makefile.in
+++ b/dom/devicestorage/test/Makefile.in
@@ -5,27 +5,22 @@
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/devicestorage/test/
 
 include $(DEPTH)/config/autoconf.mk
 
-#  man, our mime database sucks hard.  followup bug # 788273
-#		test_add.html \
-
 MOCHITEST_FILES	= \
 		test_sanity.html \
-		test_addCorrectType.html \
 		test_basic.html \
 		test_enumerate.html \
 		test_enumerateMultipleContinue.html \
 		test_overwrite.html \
-		test_diskSpace.html \
 		test_dotdot.html \
 		test_enumerateOptions.html \
 		test_lastModificationFilter.html \
 		test_stat.html \
 		test_watch.html \
 		test_watchOther.html \
 		devicestorage_common.js \
 		$(NULL)
--- a/dom/devicestorage/test/devicestorage_common.js
+++ b/dom/devicestorage/test/devicestorage_common.js
@@ -49,18 +49,18 @@ function getRandomBuffer() {
   var buffer = new ArrayBuffer(size);
   var view = new Uint8Array(buffer);
   for (var i = 0; i < size; i++) {
     view[i] = parseInt(Math.random() * 255);
   }
   return buffer;
 }
 
-function createRandomBlob(mime) {
-  return blob = new Blob([getRandomBuffer()], {type: mime});
+function createRandomBlob() {
+  return blob = new Blob([getRandomBuffer()], {type: 'binary/random'});
 }
 
 function randomFilename(l) {
   var set = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
   var result = "";
   for (var i=0; i<l; i++) {
     var r = Math.floor(set.length * Math.random());
     result += set.substring(r, r + 1);
deleted file mode 100644
--- a/dom/devicestorage/test/test_add.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=786922
--->
-<head>
-  <title>Test for basic sanity of the device storage API </title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="devicestorage_common.js"></script>
-
-<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=786922">Mozilla Bug 786922</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-  
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-
-devicestorage_setup();
-
-function add(storage, mime) {
-  dump("adding: " + mime + "\n");
-  return navigator.getDeviceStorage(storage).add(createRandomBlob(mime));
-}
-
-var tests = [
-  function () { return add("pictures", "image/png")},
-  function () { return add("videos",   "video/webm")},
-  function () { return add("music",    "audio/wav")},
-];
-
-function fail(e) {
-  ok(false, "onerror was called");
-  devicestorage_cleanup();
-}
-
-function next(e) {
-
-  if (e != undefined)
-    ok(true, "addError was called");
-  
-  var f = tests.pop();
-
-  if (f == undefined) {
-    devicestorage_cleanup();
-    return;
-  }
-
-  request = f();
-  request.onsuccess = next;
-  request.onerror = fail;
-}
-
-next();
-
-</script>
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/dom/devicestorage/test/test_addCorrectType.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=786922
--->
-<head>
-  <title>Test for basic sanity of the device storage API </title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="devicestorage_common.js"></script>
-
-<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=786922">Mozilla Bug 786922</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-  
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-
-devicestorage_setup();
-
-function addNamed(storage, mime, fileExtension) {
-  dump("adding: " + mime + " " + fileExtension + "\n");
-  return navigator.getDeviceStorage(storage).addNamed(createRandomBlob(mime), randomFilename(40) + "." + fileExtension);
-}
-
-// These tests must all fail
-var tests = [
-  function () { return addNamed("pictures", "kyle/smash", ".png")},
-  function () { return addNamed("pictures", "image/png",  ".poo")},
-  function () { return addNamed("music",    "kyle/smash", ".mp3")},
-  function () { return addNamed("music",    "music/mp3",  ".poo")},
-  function () { return addNamed("videos",   "kyle/smash", ".ogv")},
-  function () { return addNamed("videos",   "video/ogv",  ".poo")},
-];
-
-function fail(e) {
-  ok(false, "addSuccess was called");
-  devicestorage_cleanup();
-}
-
-function next(e) {
-
-  if (e != undefined)
-    ok(true, "addError was called");
-  
-  var f = tests.pop();
-
-  if (f == undefined) {
-    devicestorage_cleanup();
-    return;
-  }
-
-  request = f();
-  request.onsuccess = fail;
-  request.onerror = next;
-}
-
-next();
-
-</script>
-</pre>
-</body>
-</html>
-
--- a/dom/devicestorage/test/test_basic.html
+++ b/dom/devicestorage/test/test_basic.html
@@ -28,19 +28,19 @@ function unload() {
 
   delete gFileReader;
   gFileReader = null;
 }
 
 
 devicestorage_setup();
 
-var gFileName = "devicestorage/hi.png";
+var gFileName = "devicestorage/hi";
 var gData = "My name is Doug Turner.  My IRC nick is DougT.  I like Maple cookies."
-var gDataBlob = new Blob([gData], {type: 'image/png'});
+var gDataBlob = new Blob([gData], {type: 'text/plain'});
 var gFileReader = new FileReader();
 
 function getAfterDeleteSuccess(e) {
   ok(false, "file was deleted not successfully");
   devicestorage_cleanup();
 }
 
 function getAfterDeleteError(e) {
@@ -48,30 +48,30 @@ function getAfterDeleteError(e) {
   devicestorage_cleanup();
 }
 
 function deleteSuccess(e) {
 
   ok(e.target.result == gFileName, "File name should match");
   dump(e.target.result + "\n")
 
-  var storage = navigator.getDeviceStorage("pictures");
+  var storage = navigator.getDeviceStorage("testing");
   request = storage.get(e.target.result);
   request.onsuccess = getAfterDeleteSuccess;
   request.onerror = getAfterDeleteError;
 
 }
 
 function deleteError(e) {
   ok(false, "deleteError was called : " + e.target.error.name);
   devicestorage_cleanup();
 }
 
 function getSuccess(e) {
-  var storage = navigator.getDeviceStorage("pictures");
+  var storage = navigator.getDeviceStorage("testing");
   ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
 
   ok(e.target.result.name == gFileName, "File name should match");
 
   var name = e.target.result.name;
 
   gFileReader.readAsArrayBuffer(gDataBlob);
   gFileReader.onload = function(e) {
@@ -96,35 +96,35 @@ function getError(e) {
   ok(false, "getError was called : " + e.target.error.name);
   devicestorage_cleanup();
 }
 
 function addSuccess(e) {
 
   ok(e.target.result == gFileName, "File name should match");
 
-  var storage = navigator.getDeviceStorage("pictures");
+  var storage = navigator.getDeviceStorage("testing");
   request = storage.get(gFileName);
   request.onsuccess = getSuccess;
   request.onerror = getError;
 
   ok(true, "addSuccess was called");
 }
 
 function addError(e) {
   ok(false, "addError was called : " + e.target.error.name);
   devicestorage_cleanup();
 }
 
 ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
 
-var storage = navigator.getDeviceStorage("pictures");
+var storage = navigator.getDeviceStorage("testing");
 ok(storage, "Should have gotten a storage");
 
-request = storage.addNamed(gDataBlob, "devicestorage/hi.png");
+request = storage.addNamed(gDataBlob, "devicestorage/hi");
 ok(request, "Should have a non-null request");
 
 request.onsuccess = addSuccess;
 request.onerror = addError;
 
 </script>
 </pre>
 </body>
deleted file mode 100644
--- a/dom/devicestorage/test/test_diskSpace.html
+++ /dev/null
@@ -1,101 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html> <!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=717103
--->
-<head>
-  <title>Test for the device storage API </title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="devicestorage_common.js"></script>
-
-<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-  
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-devicestorage_setup();
-
-
-var freeBytes = -1;
-var stats = 0;
-
-function stat(s, file_list_length) {
-  if (freeBytes == -1) {
-    freeBytes = s.target.result.freeBytes;
-  }
-
-  ok(freeBytes == s.target.result.freeBytes, "Free bytes should be the same");
-  ok(file_list_length * 1024 == s.target.result.totalBytes, "space taken up by files should match")
-
-  stats = stats + 1;
-
-  if (stats == 2) {
-    devicestorage_cleanup();
-  }
-}
-
-function addSuccess(e) {
-  added = added - 1;
-
-  if (added == 0) {
-    request = pictures.stat();
-    request.onsuccess = function(s) {stat(s, picture_files.length)};
-
-    request = videos.stat();
-    request.onsuccess = function(s) {stat(s, video_files.length)};
-
-    request = music.stat();
-    request.onsuccess = function(s) {stat(s, music_files.length)};
-  }
-}
-
-function addError(e) {
-  ok(false, "addError was called : " + e.target.error.name);
-  devicestorage_cleanup();
-}
-
-ok(true, "hi");
-
-var pictures = navigator.getDeviceStorage("pictures");
-var picture_files = [ "a.png", "b.png", "c.png", "d.png", "e.png" ];
-
-var videos = navigator.getDeviceStorage("videos");
-var video_files = [ "a.ogv", "b.ogv" ];
-
-var music = navigator.getDeviceStorage("music");
-var music_files = [ "a.mp3", "b.mp3", "c.mp3" ];
-
-var added = picture_files.length + video_files.length + music_files.length;
-
-for (var i=0; i < picture_files.length; i++) {
- request = pictures.addNamed(createRandomBlob('image/png'), picture_files[i]);
- request.onsuccess = addSuccess;
- request.onerror = addError;
-}
-
-for (var i=0; i < video_files.length; i++) {
- request = videos.addNamed(createRandomBlob('video/ogv'), video_files[i]);
- request.onsuccess = addSuccess;
- request.onerror = addError;
-}
-
-for (var i=0; i < music_files.length; i++) {
- request = music.addNamed(createRandomBlob('audio/mp3'), music_files[i]);
- request.onsuccess = addSuccess;
- request.onerror = addError;
-}
-
-</script>
-</pre>
-</body>
-</html>
-
--- a/dom/devicestorage/test/test_dotdot.html
+++ b/dom/devicestorage/test/test_dotdot.html
@@ -20,27 +20,27 @@ https://bugzilla.mozilla.org/show_bug.cg
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 devicestorage_setup();
 
 function testingStorage() {
-  return navigator.getDeviceStorage("pictures");
+  return navigator.getDeviceStorage("testing");
 }
 
 var tests = [
-  function () { return testingStorage().addNamed(createRandomBlob('image/png'), gFileName); },
+  function () { return testingStorage().addNamed(createRandomBlob(), gFileName); },
   function () { return testingStorage().delete(gFileName); },
   function () { return testingStorage().get(gFileName); },
   function () { var r = testingStorage().enumerate("../"); return r; }
 ];
 
-var gFileName = "../owned.png";
+var gFileName = "../owned";
 
 function fail(e) {
   ok(false, "addSuccess was called");
   dump(request);
   devicestorage_cleanup();
 }
 
 function next(e) {
--- a/dom/devicestorage/test/test_enumerate.html
+++ b/dom/devicestorage/test/test_enumerate.html
@@ -62,27 +62,27 @@ function addSuccess(e) {
   }
 }
 
 function addError(e) {
   ok(false, "addError was called : " + e.target.error.name);
   devicestorage_cleanup();
 }
 
-var storage = navigator.getDeviceStorage("pictures");
+var storage = navigator.getDeviceStorage("testing");
 ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
-var prefix = "devicestorage/" + randomFilename(12) + ".png"
+var prefix = "devicestorage/" + randomFilename(12)
 
-var files = [ "a.png", "b.png", "c.png", "d/a.png", "d/b.png", "d/c.png", "d/d.png", "The/quick/brown/fox/jumps/over/the/lazy/dog.png"]
+var files = [ "a", "b", "c", "d/a", "d/b", "d/c", "d/d", "The/quick/brown/fox/jumps/over/the/lazy/dog"]
 var addedSoFar = 0;
 
 
 for (var i=0; i<files.length; i++) {
 
- request = storage.addNamed(createRandomBlob('image/png'), prefix + '/' + files[i]);
+ request = storage.addNamed(createRandomBlob(), prefix + '/' + files[i]);
 
  ok(request, "Should have a non-null request");
  request.onsuccess = addSuccess;
  request.onerror = addError;
 }
 
 </script>
 </pre>
--- a/dom/devicestorage/test/test_enumerateMultipleContinue.html
+++ b/dom/devicestorage/test/test_enumerateMultipleContinue.html
@@ -25,17 +25,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 devicestorage_setup();
 
 function enumerateSuccess(e) {
 }
 
 function enumerateFailure(e) {
 }
 
-var cursor = navigator.getDeviceStorage("pictures").enumerate();
+var cursor = navigator.getDeviceStorage("testing").enumerate();
 cursor.onsuccess = enumerateSuccess;
 cursor.onerror = enumerateFailure;
 
 try {
  cursor.continue();
 }
 catch (e) {
   ok(true, "Calling continue before enumerateSuccess fires should throw");
--- a/dom/devicestorage/test/test_enumerateNoParam.html
+++ b/dom/devicestorage/test/test_enumerateNoParam.html
@@ -66,27 +66,27 @@ function addSuccess(e) {
   }
 }
 
 function addError(e) {
   ok(false, "addError was called : " + e.target.error.name);
   devicestorage_cleanup();
 }
 
-var storage = navigator.getDeviceStorage("pictures");
+var storage = navigator.getDeviceStorage("testing");
 ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
 var prefix = "devicestorage/" + randomFilename(12)
 
-var files = [ "a.png", "b.png", "c.png" ]
+var files = [ "a", "b", "c" ]
 var addedSoFar = 0;
 
 
 for (var i=0; i<files.length; i++) {
 
- request = storage.addNamed(createRandomBlob('image/png'), prefix + '/' + files[i]);
+ request = storage.addNamed(createRandomBlob(), prefix + '/' + files[i]);
 
  ok(request, "Should have a non-null request");
  request.onsuccess = addSuccess;
  request.onerror = addError;
 }
 
 </script>
 </pre>
--- a/dom/devicestorage/test/test_enumerateOptions.html
+++ b/dom/devicestorage/test/test_enumerateOptions.html
@@ -20,17 +20,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 devicestorage_setup()
 
-storage = navigator.getDeviceStorage("pictures");
+storage = navigator.getDeviceStorage("testing");
 
 
 throws = false;
 try {
 var cursor = storage.enumerate();
 } catch(e) {throws = true}
 ok(!throws, "enumerate no parameter");
 
--- a/dom/devicestorage/test/test_lastModificationFilter.html
+++ b/dom/devicestorage/test/test_lastModificationFilter.html
@@ -39,17 +39,17 @@ function verifyAndDelete(prefix, files, 
   var index = files.indexOf(filename);
   ok(index > -1, "filename should be in the enumeration : " + e.target.result.name);
   if (index == -1)
     return;
 
   files.remove(index);
 
   // clean up
-  var storage = navigator.getDeviceStorage("pictures");
+  var storage = navigator.getDeviceStorage("testing");
   var cleanup = storage.delete(prefix + "/" + filename);
   cleanup.onsuccess = function(e) {}
 }
 
 function addFiles(prefix, files, date, callback) {
 
   const Cc = SpecialPowers.wrap(Components).classes;
   const Ci = Components.interfaces;
@@ -71,25 +71,25 @@ function addFiles(prefix, files, date, c
   callback();
 }
 
 
 devicestorage_setup();
 
 var prefix = "devicestorage/" + randomFilename(12)
 
-var oldFiles = ["a.png", "b.png", "c.png"];
-var newFiles = ["d.png", "e.png", "f.png"];
+var oldFiles = ["a", "b", "c"];
+var newFiles = ["d", "e", "f"];
 
 // 157795200 is a long long time ago.
 addFiles(prefix, oldFiles, 157795200, addNewFiles);
 
 function enumerateNew() {
 
-  var storage = navigator.getDeviceStorage("pictures");
+  var storage = navigator.getDeviceStorage("testing");
   ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
 
 // 836031600 is a long time ago
   var cursor = storage.enumerate(prefix, {"since": new Date(836031600)});
   cursor.onsuccess = function(e) {
     verifyAndDelete(prefix, newFiles, e);
     if (e.target.result) {
       e.target.continue();
--- a/dom/devicestorage/test/test_overwrite.html
+++ b/dom/devicestorage/test/test_overwrite.html
@@ -18,17 +18,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-var filename = "devicestorage/aaaa.png"
+var filename = "devicestorage/aaaa"
 
 devicestorage_setup();
 
 
 function deleteSuccess(e) {
   devicestorage_cleanup();
 }
 
@@ -40,47 +40,47 @@ function deleteError(e) {
 function addOverwritingSuccess(e) {
   ok(false, "addOverwritingSuccess was called.");
   devicestorage_cleanup();
 }
 
 function addOverwritingError(e) {
   ok(true, "Adding to the same location should fail");
 
-  var storage = navigator.getDeviceStorage("pictures");
+  var storage = navigator.getDeviceStorage("testing");
   request = storage.delete(filename)
   request.onsuccess = deleteSuccess;
   request.onerror = deleteError;
 }
 
 function addSuccess(e) {
   ok(true, "addSuccess was called");
 
-  var storage = navigator.getDeviceStorage("pictures");
+  var storage = navigator.getDeviceStorage("testing");
   ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
 
-  request = storage.addNamed(createRandomBlob('image/png'), filename);
+  request = storage.addNamed(createRandomBlob(), filename);
   ok(request, "Should have a non-null request");
 
   request.onsuccess = addOverwritingSuccess;
   request.onerror = addOverwritingError;
 }
 
 function addError(e) {
   // test file is already exists.  clean it up and try again..
-  var storage = navigator.getDeviceStorage("pictures");
+  var storage = navigator.getDeviceStorage("testing");
   request = storage.delete(filename)
   request.onsuccess = runtest;
 }
 
 function runtest() {
-  var storage = navigator.getDeviceStorage("pictures");
+  var storage = navigator.getDeviceStorage("testing");
   ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
 
-  request = storage.addNamed(createRandomBlob('image/png'), filename);
+  request = storage.addNamed(createRandomBlob(), filename);
   ok(request, "Should have a non-null request");
 
   request.onsuccess = addSuccess;
   request.onerror = addError;
 }
 
 runtest();
 
--- a/dom/devicestorage/test/test_sanity.html
+++ b/dom/devicestorage/test/test_sanity.html
@@ -33,24 +33,18 @@ var throws = false;
 try {
  storage = navigator.getDeviceStorage();
 } catch(e) {throws = true}
 ok(throws, "getDeviceStorage takes one arg");
 
 storage = navigator.getDeviceStorage("kilimanjaro");
 ok(!storage, "kilimanjaro - Should not have this type of storage");
 
-storage = navigator.getDeviceStorage("pictures");
-ok(storage, "pictures - Should have getDeviceStorage");
-
-storage = navigator.getDeviceStorage("music");
-ok(storage, "music - Should have getDeviceStorage");
-
-storage = navigator.getDeviceStorage("videos");
-ok(storage, "videos - Should have getDeviceStorage");
+storage = navigator.getDeviceStorage("testing");
+ok(storage, "testing - Should have getDeviceStorage");
 
 var cursor = storage.enumerate();
 ok(cursor, "Should have a non-null cursor");
 
 devicestorage_cleanup();
 
 </script>
 </pre>
--- a/dom/devicestorage/test/test_stat.html
+++ b/dom/devicestorage/test/test_stat.html
@@ -30,33 +30,33 @@ function statSuccess(e) {
   devicestorage_cleanup();
 }
 
 function statError(e) {
   ok(false, "statError was called");
   devicestorage_cleanup();
 }
 
-var storage = navigator.getDeviceStorage("pictures");
+var storage = navigator.getDeviceStorage("testing");
 ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
 
 function addError(e) {
   ok(false, "addError was called : " + e.target.error.name);
   devicestorage_cleanup();
 }
 
 function addSuccess(e) {
   request = storage.stat();
   ok(request, "Should have a non-null request");
 
   request.onsuccess = statSuccess;
   request.onerror = statError;
 }
 
-request = storage.addNamed(createRandomBlob('image/png'), "a/b.png");
+request = storage.addNamed(createRandomBlob(), "a/b");
 request.onsuccess = addSuccess;
 request.onerror = addError;
 
 </script>
 </pre>
 </body>
 </html>
 
--- a/dom/devicestorage/test/test_watch.html
+++ b/dom/devicestorage/test/test_watch.html
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 devicestorage_setup();
 
-var gFileName = randomFilename(20) + ".png"
+var gFileName = randomFilename(20);
 
 function addSuccess(e) {
 }
 
 function addError(e) {
   ok(false, "addError was called : " + e.target.error.name);
   devicestorage_cleanup();
 }
@@ -44,21 +44,21 @@ function onChange(e) {
     devicestorage_cleanup();
   }
   else {
     // we may see other file changes during the test, and
     // that is completely ok
   }
 }
 
-var storage = navigator.getDeviceStorage("pictures");
+var storage = navigator.getDeviceStorage("testing");
 ok(storage, "Should have storage");
 storage.addEventListener("change", onChange);
 
-request = storage.addNamed(createRandomBlob('image/png'), gFileName);
+request = storage.addNamed(createRandomBlob(), gFileName);
 ok(request, "Should have a non-null request");
 
 request.onsuccess = addSuccess;
 request.onerror = addError;
 
 </script>
 </pre>
 </body>
--- a/dom/devicestorage/test/test_watchOther.html
+++ b/dom/devicestorage/test/test_watchOther.html
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 devicestorage_setup();
 
-var gFileName = randomFilename(20) + ".png"
+var gFileName = randomFilename(20);
 
 function addSuccess(e) {
 }
 
 function addError(e) {
   ok(false, "addError was called : " + e.target.error.name);
   devicestorage_cleanup();
 }
@@ -49,25 +49,25 @@ function onChange(e) {
   }
 }
 
 function onChangeFail(e) {
   dump("onChangeFail: " + e.path + " " + e.reason + "\n");
   ok(false, "We should never see any changes");
 }
 
-var storage = navigator.getDeviceStorage("pictures");
+var storage = navigator.getDeviceStorage("testing");
 ok(storage, "Should have storage");
 storage.addEventListener("change", onChange);
 
-var storageOther = navigator.getDeviceStorage("music");
+var storageOther = navigator.getDeviceStorage("testing-other");
 ok(storageOther, "Should have storage");
 storageOther.addEventListener("change", onChangeFail);
 
-request = storage.addNamed(createRandomBlob('image/png'), gFileName);
+request = storage.addNamed(createRandomBlob(), gFileName);
 ok(request, "Should have a non-null request");
 
 request.onsuccess = addSuccess;
 request.onerror = addError;
 
 </script>
 </pre>
 </body>
deleted file mode 100644
--- a/toolkit/content/devicestorage.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-pictures=*.jpe; *.jpg; *.jpeg; *.gif; *.png; *.bmp;
-music=*.mp3; *.ogg; *.m4a; *.m4b; *.m4p; *.m4v; *.m4r; *.3gp; *.mp4; *.aac;
-videos=*.avi; *.divx; *.flv; *.m4v; *.mkv; *.mov; *.mp4; *.mpeg; *.mpg; *.ogm; *.ogv; *.ogx; *.rm; *.rmvb; *.smil; *.webm; *.wmv; *.xvid
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -23,17 +23,16 @@ toolkit.jar:
 +  content/global/charsetOverlay.js           (charsetOverlay.js)
 +  content/global/charsetOverlay.xul          (charsetOverlay.xul)
 *  content/global/contentAreaUtils.js         (contentAreaUtils.js)
    content/global/customizeCharset.js         (customizeCharset.js)
    content/global/customizeCharset.xul        (customizeCharset.xul)
    content/global/customizeToolbar.css        (customizeToolbar.css)
 *  content/global/customizeToolbar.js         (customizeToolbar.js)
    content/global/customizeToolbar.xul        (customizeToolbar.xul)
-   content/global/devicestorage.properties    (devicestorage.properties)
    content/global/editMenuOverlay.js          (editMenuOverlay.js)
 *+ content/global/editMenuOverlay.xul         (editMenuOverlay.xul)
    content/global/finddialog.js               (finddialog.js)
 *+ content/global/finddialog.xul              (finddialog.xul)
    content/global/findUtils.js                (findUtils.js)
    content/global/filepicker.properties       (filepicker.properties)
 *+ content/global/globalOverlay.js            (globalOverlay.js)
 +  content/global/mozilla.xhtml               (mozilla.xhtml)