Bug 881386 - DeviceStorage: Add .default attribute to webidl. r=Ms2ger
authorDave Hylands <dhylands@mozilla.com>
Wed, 12 Jun 2013 09:30:23 -0700
changeset 146269 28946fa58c2605e1b7740ece308654acd41edd7b
parent 146268 b51316b2af6c4b8de998ce3f4ddcacb71258c375
child 146270 015a2a5a469835afd63138df0d41fea675d6c864
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs881386
milestone24.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 881386 - DeviceStorage: Add .default attribute to webidl. r=Ms2ger
dom/devicestorage/DeviceStorage.h
dom/devicestorage/nsDeviceStorage.cpp
dom/webidl/DeviceStorage.webidl
--- a/dom/devicestorage/DeviceStorage.h
+++ b/dom/devicestorage/DeviceStorage.h
@@ -219,16 +219,18 @@ public:
   already_AddRefed<DOMCursor>
   EnumerateEditable(const nsAString& aPath,
                     const EnumerationParameters& aOptions, ErrorResult& aRv);
 
   already_AddRefed<DOMRequest> FreeSpace(ErrorResult& aRv);
   already_AddRefed<DOMRequest> UsedSpace(ErrorResult& aRv);
   already_AddRefed<DOMRequest> Available(ErrorResult& aRv);
 
+  bool Default();
+
   // Uses XPCOM GetStorageName
 
   static void CreateDeviceStorageFor(nsPIDOMWindow* aWin,
                                      const nsAString& aType,
                                      nsDOMDeviceStorage** aStore);
 
   static void CreateDeviceStoragesFor(nsPIDOMWindow* aWin,
                                       const nsAString& aType,
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -3038,21 +3038,28 @@ nsDOMDeviceStorage::GetRootDirectoryForF
     ds = this;
   }
   if (!ds || !ds->mRootDirectory) {
     return NS_ERROR_FAILURE;
   }
   return ds->mRootDirectory->Clone(aRootDirectory);
 }
 
-NS_IMETHODIMP
-nsDOMDeviceStorage::GetDefault(bool* aDefault) {
+bool
+nsDOMDeviceStorage::Default()
+{
   nsString defaultStorageName;
   GetWritableStorageName(mStorageType, defaultStorageName);
-  *aDefault = mStorageName.Equals(defaultStorageName);
+  return mStorageName.Equals(defaultStorageName);
+}
+
+NS_IMETHODIMP
+nsDOMDeviceStorage::GetDefault(bool* aDefault)
+{
+  *aDefault = Default();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::GetStorageName(nsAString& aStorageName)
 {
   aStorageName = mStorageName;
   return NS_OK;
--- a/dom/webidl/DeviceStorage.webidl
+++ b/dom/webidl/DeviceStorage.webidl
@@ -39,9 +39,13 @@ interface DeviceStorage : EventTarget {
   [Throws]
   DOMRequest usedSpace();
   [Throws]
   DOMRequest available();
 
   // Note that the storageName is just a name (like sdcard), and doesn't
   // include any path information.
   readonly attribute DOMString storageName;
+
+  // Determines if this storage area is the one which will be used by default
+  // for storing new files.
+  readonly attribute boolean default;
 };