mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1034912, part 1 - Add fixes for B2G-specific uses of ~DeviceStorageFile. r=mccr8
This commit is contained in:
parent
2300c8c15a
commit
aeb223bef4
@ -4365,15 +4365,15 @@ nsDOMDeviceStorage::Observe(nsISupports *aSubject,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceStorageFile dsf(mStorageType, mStorageName);
|
nsRefPtr<DeviceStorageFile> dsf(new DeviceStorageFile(mStorageType, mStorageName));
|
||||||
nsString status, storageStatus;
|
nsString status, storageStatus;
|
||||||
|
|
||||||
// Get Status (one of "available, unavailable, shared")
|
// Get Status (one of "available, unavailable, shared")
|
||||||
dsf.GetStatus(status);
|
dsf->GetStatus(status);
|
||||||
DispatchStatusChangeEvent(status);
|
DispatchStatusChangeEvent(status);
|
||||||
|
|
||||||
// Get real volume status (defined in dom/system/gonk/nsIVolume.idl)
|
// Get real volume status (defined in dom/system/gonk/nsIVolume.idl)
|
||||||
dsf.GetStorageStatus(storageStatus);
|
dsf->GetStorageStatus(storageStatus);
|
||||||
DispatchStorageStatusChangeEvent(storageStatus);
|
DispatchStorageStatusChangeEvent(storageStatus);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -344,20 +344,21 @@ static nsresult GetDownloadDirectory(nsIFile **_directory,
|
|||||||
nsDOMDeviceStorage::GetDefaultStorageName(NS_LITERAL_STRING("sdcard"),
|
nsDOMDeviceStorage::GetDefaultStorageName(NS_LITERAL_STRING("sdcard"),
|
||||||
storageName);
|
storageName);
|
||||||
|
|
||||||
DeviceStorageFile dsf(NS_LITERAL_STRING("sdcard"),
|
nsRefPtr<DeviceStorageFile> dsf(
|
||||||
|
new DeviceStorageFile(NS_LITERAL_STRING("sdcard"),
|
||||||
storageName,
|
storageName,
|
||||||
NS_LITERAL_STRING("downloads"));
|
NS_LITERAL_STRING("downloads")));
|
||||||
NS_ENSURE_TRUE(dsf.mFile, NS_ERROR_FILE_ACCESS_DENIED);
|
NS_ENSURE_TRUE(dsf->mFile, NS_ERROR_FILE_ACCESS_DENIED);
|
||||||
|
|
||||||
// If we're not checking for availability we're done.
|
// If we're not checking for availability we're done.
|
||||||
if (aSkipChecks) {
|
if (aSkipChecks) {
|
||||||
dsf.mFile.forget(_directory);
|
dsf->mFile.forget(_directory);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check device storage status before continuing.
|
// Check device storage status before continuing.
|
||||||
nsString storageStatus;
|
nsString storageStatus;
|
||||||
dsf.GetStatus(storageStatus);
|
dsf->GetStatus(storageStatus);
|
||||||
|
|
||||||
// If we get an "unavailable" status, it means the sd card is not present.
|
// If we get an "unavailable" status, it means the sd card is not present.
|
||||||
// We'll also catch internal errors by looking for an empty string and assume
|
// We'll also catch internal errors by looking for an empty string and assume
|
||||||
@ -374,13 +375,13 @@ static nsresult GetDownloadDirectory(nsIFile **_directory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool alreadyThere;
|
bool alreadyThere;
|
||||||
nsresult rv = dsf.mFile->Exists(&alreadyThere);
|
nsresult rv = dsf->mFile->Exists(&alreadyThere);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
if (!alreadyThere) {
|
if (!alreadyThere) {
|
||||||
rv = dsf.mFile->Create(nsIFile::DIRECTORY_TYPE, 0770);
|
rv = dsf->mFile->Create(nsIFile::DIRECTORY_TYPE, 0770);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
dir = dsf.mFile;
|
dir = dsf->mFile;
|
||||||
#elif defined(ANDROID)
|
#elif defined(ANDROID)
|
||||||
// On mobile devices, we are avoiding exposing users to the file
|
// On mobile devices, we are avoiding exposing users to the file
|
||||||
// system, and don't save downloads to temp directories
|
// system, and don't save downloads to temp directories
|
||||||
|
Loading…
Reference in New Issue
Block a user