Bug 881386 - DeviceStorage: Add .default attribute to webidl. r=Ms2ger

This commit is contained in:
Dave Hylands 2013-06-12 09:30:23 -07:00
parent 373947830a
commit 52ef1132e8
3 changed files with 16 additions and 3 deletions

View File

@ -224,6 +224,8 @@ public:
already_AddRefed<DOMRequest> UsedSpace(ErrorResult& aRv);
already_AddRefed<DOMRequest> Available(ErrorResult& aRv);
bool Default();
// Uses XPCOM GetStorageName
static void CreateDeviceStorageFor(nsPIDOMWindow* aWin,

View File

@ -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;
}

View File

@ -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;
};