diff --git a/dom/devicestorage/DeviceStorage.h b/dom/devicestorage/DeviceStorage.h index 11b7817bbe7..3f2b0d99010 100644 --- a/dom/devicestorage/DeviceStorage.h +++ b/dom/devicestorage/DeviceStorage.h @@ -224,6 +224,8 @@ public: already_AddRefed UsedSpace(ErrorResult& aRv); already_AddRefed Available(ErrorResult& aRv); + bool Default(); + // Uses XPCOM GetStorageName static void CreateDeviceStorageFor(nsPIDOMWindow* aWin, diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 89c877618d4..5fa3e357630 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -3043,11 +3043,18 @@ nsDOMDeviceStorage::GetRootDirectoryForFile(const nsAString& aName, nsIFile** aR 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; } diff --git a/dom/webidl/DeviceStorage.webidl b/dom/webidl/DeviceStorage.webidl index 72c4385cc1a..faa25374858 100644 --- a/dom/webidl/DeviceStorage.webidl +++ b/dom/webidl/DeviceStorage.webidl @@ -44,4 +44,8 @@ interface DeviceStorage : EventTarget { // 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; };