Bug 1034912, part 2 - Remove dangerous public destructor of DeviceStorageFile. r=dhylands

This commit is contained in:
Andrew McCreight 2014-07-31 10:05:59 -07:00
parent 7d76e0867a
commit 23cdfd9cc2
2 changed files with 6 additions and 13 deletions

View File

@ -23,7 +23,6 @@
#define DEVICESTORAGE_SDCARD "sdcard"
#define DEVICESTORAGE_CRASHES "crashes"
class DeviceStorageFile;
class nsIInputStream;
class nsIOutputStream;
@ -39,13 +38,6 @@ class DeviceStorageFileSystem;
namespace ipc {
class FileDescriptor;
}
template<>
struct HasDangerousPublicDestructor<DeviceStorageFile>
{
static const bool value = true;
};
} // namespace mozilla
class DeviceStorageFile MOZ_FINAL
@ -126,6 +118,7 @@ public:
nsresult CreateFileDescriptor(mozilla::ipc::FileDescriptor& aFileDescriptor);
private:
~DeviceStorageFile() {}
void Init();
void NormalizeFilePath();
void AppendRelativePath(const nsAString& aPath);

View File

@ -142,10 +142,10 @@ GetFreeBytes(const nsAString& aStorageName)
// This function makes the assumption that the various types
// are all stored on the same filesystem. So we use pictures.
DeviceStorageFile dsf(NS_LITERAL_STRING(DEVICESTORAGE_PICTURES),
aStorageName);
nsRefPtr<DeviceStorageFile> dsf(new DeviceStorageFile(NS_LITERAL_STRING(DEVICESTORAGE_PICTURES),
aStorageName));
int64_t freeBytes = 0;
dsf.GetDiskFreeSpace(&freeBytes);
dsf->GetDiskFreeSpace(&freeBytes);
return freeBytes;
}
@ -3574,8 +3574,8 @@ nsDOMDeviceStorage::GetDefaultStorageName(const nsAString& aStorageType,
bool
nsDOMDeviceStorage::IsAvailable()
{
DeviceStorageFile dsf(mStorageType, mStorageName);
return dsf.IsAvailable();
nsRefPtr<DeviceStorageFile> dsf(new DeviceStorageFile(mStorageType, mStorageName));
return dsf->IsAvailable();
}
NS_IMETHODIMP