Closed Bug 809948 Opened 12 years ago Closed 12 years ago

[Webapps] Check for enough device storage before starting app download

Categories

(Core Graveyard :: DOM: Apps, defect)

defect
Not set
normal

Tracking

(blocking-basecamp:+, firefox18 fixed, firefox19 fixed)

RESOLVED FIXED
mozilla19
blocking-basecamp +
Tracking Status
firefox18 --- fixed
firefox19 --- fixed

People

(Reporter: ferjm, Assigned: ferjm)

References

Details

(Whiteboard: [qa-])

Attachments

(2 files, 3 obsolete files)

Currently, we have to start downloading the app and wait for it to fail due to insufficient device storage before triggering the 'ondownloaderror' event. We probably want to check that there is enough device storage *before* starting to download any data.
Blocks: 790558
Component: General → DOM: Apps
Product: Boot2Gecko → Core
Assignee: nobody → ferjmoreno
blocking-basecamp: --- → ?
No longer blocks: 802615
Should cover the install and update cases.

Blocking+ for required feature work:

AppUpdates-005 "As a user, I want the system to check that there is enough storage before beginning to download apps, so that I can avoid "not enough storage" errors."
blocking-basecamp: ? → +
Blocks: app-install
Attached patch v1 (obsolete) (deleted) — Splinter Review
With this patch the platform checks if there is enough free device storage before starting to download a package and triggers a 'ondownloaderror' in case that there is not enough space.

I've made the patch to simply trigger the 'ondownloaderror' because that is what we agreed to do, but this way the UI won't know if the download failed because of insufficient device storage, a connection error or whatever. If we want to show the specific cause of the download failure we might want to either add more information to 'ondownloaderror' or trigger a new type of event. What do you think?
Attachment #681440 - Flags: review?(fabrice)
Attached patch v1 (obsolete) (deleted) — Splinter Review
Attachment #681440 - Attachment is obsolete: true
Attachment #681440 - Flags: review?(fabrice)
Attachment #681441 - Flags: review?(fabrice)
Pointer to Github pull-request
Comment on attachment 681457 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gaia/pull/6401

This patch allows the system app to have permissions for accessing apps device storage.
Attachment #681457 - Flags: review?(fabrice)
(In reply to Fernando Jiménez Moreno [:ferjm] from comment #2)
> Created attachment 681440 [details] [diff] [review]
> v1
> I've made the patch to simply trigger the 'ondownloaderror' because that is
> what we agreed to do, but this way the UI won't know if the download failed
> because of insufficient device storage, a connection error or whatever. If
> we want to show the specific cause of the download failure we might want to
> either add more information to 'ondownloaderror' or trigger a new type of
> event. What do you think?

Please, ignore this comment. I've just realized that the error details are exposed via 'mozIDOMApplication.downloadError' :)
Attached patch v2 (deleted) — Splinter Review
Added the fix to include the app manifest along with the 'ondownloaderror' event.
Attachment #681441 - Attachment is obsolete: true
Attachment #681441 - Flags: review?(fabrice)
Attachment #681555 - Flags: review?(fabrice)
Attachment #681555 - Attachment is patch: true
Comment on attachment 681555 [details] [diff] [review]
v2

Review of attachment 681555 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/apps/src/Webapps.jsm
@@ +1360,5 @@
> +        onProgress: function notifProgress(aRequest, aContext,
> +                                           aProgress, aProgressMax) {
> +          debug("onProgress: " + aProgress + "/" + aProgressMax);
> +          app.progress = aProgress;
> +          DOMApplicationRegistry.broadcastMessage("Webapps:PackageEvent",

Nit: now that you have "self", you can use it there also.
Attachment #681555 - Flags: review?(fabrice) → review+
Marking leave-open until the PR for Gaia lands after the gecko pieces land.
Whiteboard: [leave-open]
https://hg.mozilla.org/mozilla-central/rev/d95d4e953df5
If storage space check fails during app install, the user needs to be prompted. I've created a bug for that here: https://bugzilla.mozilla.org/show_bug.cgi?id=812369

This is per the Oct 11 spec, page 8, here: https://www.dropbox.com/sh/b0kyykhzcfkpm8b/ReFTX_E72X
Comment on attachment 681457 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gaia/pull/6401

Hm, I really don't like that we have to give a content permission to make some chrome content work. I understand that this because you used browser.contentWindow.navigator, but we need to fix that.

Can we just use wm.getMostRecentWindow("...").navigator instead ?
Attachment #681457 - Flags: review?(fabrice) → review-
Attached patch Follow up (deleted) — Splinter Review
You are absolutely right. Thanks!
Attachment #681457 - Attachment is obsolete: true
Attachment #682427 - Flags: review?(fabrice)
Attachment #682427 - Flags: review?(fabrice) → review+
https://hg.mozilla.org/mozilla-central/rev/d0562b40fc01
With the follow up landed there is no need for any other Gaia patch, so I am removing the [leave-open] flag and closing as fixed.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [leave-open]
Keywords: verifyme
QA Contact: jsmith
Keywords: verifyme
Whiteboard: [qa-]
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: