Closed Bug 939800 Opened 11 years ago Closed 6 years ago

inform user that sdcard is not usable when plugged to computer via usb

Categories

(Firefox OS Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: rodrigue.villetard, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0 (Beta/Release)
Build ID: 20131104040207

Steps to reproduce:

Write an app using the getDeviceStorage API. 

Storing on sdcard, usb cable plugged and usb sharing enabled.

version of FOS :  1.2.0.0-prerelease (2013-11-15 14:10:18)

example of code  used : 

<code>
    var filename = 'rosette_'+date.getTime()+'.zip';
    var request = sdcard.addNamed(blob,filename);
    request.onsuccess=function() {
        alert(this.result + 'saved.');
    };

    request.onerror = function() {
        alert('ouch!!!  error: ' + this.error + ' ' + this.error.name)
    }; 
</code>


Actual results:


After the permission screen about data storage (allowed), the DOMRequest failed (onerror function), with an **DOMError** typed object, with name : **Unknown Error**.

Unplug the phone, and everything work fine.


Expected results:

The device should inform the user that it cannot use the sdcard right now, because it is plugged to the computer. At least, the error object returned to the developper should be more informative.

Sure I could test that by myself, but I think that the error screen should be  consistent and shared by all apps. The  screen used  by the gallery app for instance.

note: It may be possible that the DOMError message is different with other versions of FirefoxOS ([object DOMError] SecurityError)
You can already detect when a device storage area is being shared by listening to the "change" event on that storage. The `reason` property of the event will be "shared" if the storage is being shared.

Also, I don't agree that the device should inform the user directly in this case, since different apps will likely want to inform the user of this issue at different times (or say different things), depending on what they're trying to do.
Oh, I guess I should add: you can check `storage.available();` to get the current availability. You may already be aware of that, though.
Firefox OS is not being worked on
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.