Closed Bug 989536 Opened 11 years ago Closed 11 years ago

[DeviceStorage] DeviceStorageFile::GetStatus should always return a valid status.

Categories

(Core :: DOM: Device Interfaces, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
1.4 S5 (11apr)

People

(Reporter: dhylands, Assigned: dhylands)

Details

(Whiteboard: [fxos:media])

Attachments

(1 file)

GetStatus should always return one of "unavailable", "available" or "shared". Line 1525: http://dxr.mozilla.org/mozilla-central/source/dom/devicestorage/nsDeviceStorage.cpp?from=DeviceStorageFile::GetStatus#1525 should be moved to the beginning of the function.
I would assume "unavailable" would be for when there is no SD card present and "shared" would remain the same?
(In reply to Ghislain Aus Lacroix [:aus] from comment #1) > I would assume "unavailable" would be for when there is no SD card present > and "shared" would remain the same? Sorry, I should mention why I'm curious :) The work I'm doing in bug 982006 relies on these strings to determine which type of error it should return. Currently, based on the code, I check for an empty string to determine that the SD card is simply not present and "shared" and "unavailable" mean the SD card is effectively "busy" because it's mounted to the host PC or being formatted. I'd like my patch to take these eventual changes into account if I realistically can. If not, I hope that this change would mean my code gets updated, too. :)
"shared" means unavailable because the volume is-about-to-be or is-currently being shared with the PC. "unavailable" means unavailable for any other reason. Typically this is due to missing media, but it could also happen if the sdcard is being formatted, or otherwise unmountable (corrupt - not a FAT filesystem, etc). "available" means that the sdcard was successfully mounted and is available for b2g to use. There shouldn't ever be an empty status (even with the existing code). If you've ever seen an empty status, I'd like to investigate that.
To get further detailed status information about the volume, you can call: DeviceStorageFile::StorageStatus(nsAString& aStatus) This returns "undefined" (if there are no volumes) or one of the following: http://dxr.mozilla.org/mozilla-central/source/dom/system/gonk/nsVolume.cpp#26 I see that function has the same bug that GetStatus does, so I'll fix it at the same time.
Err. That would be: DeviceStorageFile::GetStorageStatus(nsAString& aStatus) not StorageStatus
Another very small review.
Attachment #8398831 - Flags: review?(Jan.Varga)
Attachment #8398831 - Flags: review?(Jan.Varga) → review+
Whiteboard: [fxos:media]
Target Milestone: --- → 1.4 S5 (11apr)
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: