A DeviceStorage API change just landed in gecko b2g18, gaia master, gaia
v1.0.0 and gaia v1-train. (It landed on m-c over the weekend).
This is one of those bugs that requires synchronized changes to gecko
and gaia. If you have an old gecko and a new gaia (or vice versa) many
things will probably break. This means that if you pull the latest
version of gaia today, you'll need to build a new version of gecko.
Sorry about that! And if you build the latest gecko, you'll need to be
sure to install the latest gaia.
If you want details about the particular commits to gecko and gaia, see
https://bugzilla.mozilla.org/show_bug.cgi?id=834595
If you're interested in the API change itself, read on:
DeviceStorage used to have an async stat method that would return three
pieces of information to the caller:
1) whether the storage was available, in use (mounted by USB) or
unavailable (no sdcard)
2) how much space remained on the volume
3) how much space was used
The first two items were very quick to compute. The third one, however
was very slow because it was type specific: it had to compute how much
space was used by photos, videos, or music on the sdcard.
So the problem was that apps that just wanted to check to make sure that
the sdcard was available or that there was enough space to save a file
had to wait for stat() to compute how much space was being used.
To resolve this performance issue, stat() has been replaced with three
separate methods. Quoting Doug from the bug:
> nsIDOMDOMRequest freeSpace();
> e.target.result == free space for the given device storage object
>
>
> nsIDOMDOMRequest usedSpace();
> e.target.result == used space for the given device storage object
>
> nsIDOMDOMRequest available();
> e.target.result == same was what stat() state did.
We expect that this new API will result in noticeable improvements in
app startup times.