On 02/09/2013, at 20:41, Dale Harvey wrote: > My first thought on this is testing, I am guessing we dont have any current > mechanism in which to simulate low / ran out of storage capacity for > integration tests, but we likely should
Good point. AFAIK there is no current mechanism to simulate low storage. However we can certainly test the dependent functionality (i.e. indexedDB, localStorage, offlineCache access or deviceStorage "onchange" event consumption) creating the appropriate mocks for it. Check [1] > > indexedDB and deviceStorage (and as far as I remember appcache) fail in > predictable ways when there is no space left on the device, and some apps > attempt to fallback gracefully (I know we did some work in the camera for > that) however these cases are very rarely exercised and have seen them to > have obvious bugs go unnoticed for a long time due to them being edge cases. > > I dont particularly understand why we would introduce another low storage > notification api for apps when the existing storage mechanisms already have > well defined error handling mechanisms (localstorage being the exception, I > dont really know what happens there, but if it doesnt already have one it > seems like we would just want it added to localstorage, and use existing ones > for the rest) I didn't mean to suggest introducing another low storage notification API for apps, but using the currently existing ones :). As I mentioned before, IMHO at least Gaia apps should fallback gracefully when an error of this kind is catch. Apps can listen to both, (A) the deviceStorage "onchange" event notifying about the detection of a low storage situation (and its recovery) so they can switch to a "low storage mode" and (B) errors associated to write attempts in the affected APIs. (A) should allow apps to change its UI to avoid that the user is allowed to request any action associated with a write in disk via any of the already mentioned APIs. (B) should allow apps to fallback gracefully when an attempt to write (if it is allowed by the app for any reason, because it didn't handled A or whatever) throws an error. Right now, Gaia apps are not working this way and that's an unfortunate UX issue. (Another example of bug report related to this for the camera app [2]) FYI localStorage also fails in a predictable way throwing a DOM_QUOTA_REACHED exception [3]. > The system wide notification makes sense though Great! Thanks for your feedback Dale! / Fernando [1] https://mxr.mozilla.org/gaia/source/apps/system/test/unit/storage_watcher_test.js [2] https://bugzilla.mozilla.org/show_bug.cgi?id=907601 [3] https://mxr.mozilla.org/mozilla-central/source/dom/src/storage/DOMStorageCache.cpp#491 _______________________________________________ dev-b2g mailing list [email protected] https://lists.mozilla.org/listinfo/dev-b2g
