Closed Bug 813195 Opened 12 years ago Closed 12 years ago

[Apps] Cannot retry to download hosted apps with cache manifest

Categories

(Core Graveyard :: DOM: Apps, defect)

defect
Not set
normal

Tracking

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

RESOLVED FIXED
mozilla20
blocking-basecamp +
Tracking Status
firefox18 --- fixed
firefox19 --- fixed
firefox20 --- fixed

People

(Reporter: arcturus, Assigned: fabrice)

References

Details

(Keywords: feature, Whiteboard: [qa-])

Attachments

(1 file, 1 obsolete file)

When we are unable to download a hosted application that has a cache manifest (this can happen if the user lost connectivity meanwhile downloading and app), we will enter in the following state:

|app.installState === 'pending' && !app.downloading|

There is now way to retry the download. For packaged apps we can call the method |.download()| but this don't work for hosted apps.
Component: General → DOM: Apps
Product: Boot2Gecko → Core
Version: unspecified → Trunk
blocking-basecamp: --- → ?
:fabrice, IMHO, my desired option is to call always the download() method, no matter if it's a packaged app or if it's a hosted one.

Internally I understand that behaviors are completely different but will be clear for the API semantic.
blocking-basecamp: ? → +
Calling .download() *should* work. Even for hosted apps. But could be that that is broken.
It's not broken, it's just not there at all.
Assignee: nobody → fabrice
Attached patch patch (obsolete) — Splinter Review
Let me know if that works, I could not find in gaia how to restart the download...
Attachment #683715 - Flags: feedback?(ferjmoreno)
Attachment #683715 - Flags: feedback?(arcturus)
Attached patch wip v2Splinter Review
Better wip. I was actually able to complete a full update cycle with this one, but then gaia kept asking me to update the same set of apps.
Attachment #683715 - Attachment is obsolete: true
Attachment #683715 - Flags: feedback?(ferjmoreno)
Attachment #683715 - Flags: feedback?(arcturus)
Attachment #683764 - Flags: feedback?(ferjmoreno)
Attachment #683764 - Flags: feedback?(arcturus)
Thanks Fabrice, I was able to test restarting a cancelled appcache download with the attached patch and Francisco's app_resume branch [1].

However, I still see the issue of the system app not being able to receive notifications about a restarted download in same cases. Particularly, the cases where the system app looses the reference to the application which download has been cancelled. I am wondering if we could fire an event (maybe 'install' again or a new 'retryInstall' or 'download' or whatever) over the 'navigator.mozApps.mgmt'.

[1] https://github.com/arcturus/gaia/tree/apps_resume
Attachment #683764 - Flags: feedback?(ferjmoreno)
Nothing else to add to Fernando comment, we were checking with :julienw and they will need to listen to an event in the system app to show the notifications, which one is the best one, I guess we need to decide.

Thanks!
Attachment #683764 - Flags: feedback?(arcturus)
Attachment #683764 - Flags: review?(ferjmoreno)
Comment on attachment 683764 [details] [diff] [review]
wip v2

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

r=me with the comments addressed, please :)

::: dom/apps/src/Webapps.jsm
@@ +19,5 @@
>  Cu.import("resource://gre/modules/PermissionsInstaller.jsm");
>  Cu.import("resource://gre/modules/OfflineCacheInstaller.jsm");
>  
>  function debug(aMsg) {
> +  dump("-*-*- Webapps.jsm : " + aMsg + "\n");

Comment this line in the final patch, please :)

@@ +778,1 @@
>        debug("startDownload: No app found for " + aManifestURL);

Should we fire an 'ondownloaderror' here?

@@ +783,5 @@
>      let file = FileUtils.getFile(DIRECTORY_NAME,
>                                   ["webapps", id, "update.webapp"], true);
>  
> +    if (!file.exists()) {
> +      // This is a hosted app, let's check if it has a appcache and download it.

nit: 81 chars :)
nit: Also 'an appcache' or only 'appcache'

@@ +795,5 @@
> +        } else {
> +          // hosted app with no appcache, nothing to do, but we fire a
> +          // downloaded event
> +          DOMApplicationRegistry.broadcastMessage("Webapps:PackageEvent",
> +                                                    { type: "downloaded",

nit: alignment

@@ +798,5 @@
> +          DOMApplicationRegistry.broadcastMessage("Webapps:PackageEvent",
> +                                                    { type: "downloaded",
> +                                                      manifestURL: aManifestURL,
> +                                                      app: app,
> +                                                      manifest: aResults[0].manifest });

I think we are not using the manifest in the message handler http://mxr.mozilla.org/mozilla-central/source/dom/apps/src/Webapps.js#604
Attachment #683764 - Flags: review?(ferjmoreno) → review+
https://hg.mozilla.org/mozilla-central/rev/37b088859341
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Whiteboard: [qa-]
Keywords: feature
adding smoketest keyword.  this has been appearing when apps have updates and appears in the notifications dialog.   we can test this fix if hosted apps have a manifest available now.
Keywords: smoketest
Whiteboard: [qa-]
(In reply to Tony Chung [:tchung] from comment #13)
> adding smoketest keyword.  this has been appearing when apps have updates
> and appears in the notifications dialog.   we can test this fix if hosted
> apps have a manifest available now.

Unrelated. This bug focuses on installed apps. The marketplace apps issue I think is still open a bug and is a separate problem, as it deals with a preloaded app.
Keywords: smoketest
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: