Closed Bug 792651 Opened 12 years ago Closed 8 years ago

Web Apps should have the ability to specify storage requirements in the permissions property

Categories

(Firefox for Android Graveyard :: Web Apps (PWAs), enhancement, P2)

18 Branch
ARM
Android
enhancement

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: cscott, Unassigned)

Details

(Whiteboard: [WebRuntime] [blocking-webrtandroid1-])

I am writing an offline webapp which includes a decent amount of media resources: http://nell-balloons.github.cscott.net

The offline storage requirements (which are pretty modest) are larger than the amount of storage allowed by Firefox/Android.

Really, there should be no fixed storage limits (local storage or appcache) for webapps -- the manifest should specify their size (appcache size could be inferred from the appcache) and the user should grant permission to use that amount of storage when they install the app.

Otherwise webapps will always be second-class citizens, limited in the amount of (offline) code the contains or (offline) data they can manipulate.
Component: DOM: Apps → Web Apps
Product: Core → Firefox for Android
QA Contact: aaron.train
Version: unspecified → Firefox 18
That's right. On desktop, we allowed the exact behavior you specified for appcache. So this isn't working on FF Android? That's a problem.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → Android
Hardware: x86 → ARM
Summary: WebApps should be able to specify their storage requirements → Web Apps should have a large appcache quota if the content is within the app origin
I don't think I agree with your rewrite of the bug title.

I don't want a "large" appcache quota -- I want an (effectively) unlimited one.  If I as a user want to download a 10G application for my desktop, there's nothing preventing me from doing it.  I look at the file size, see that the application is 10G, and say, "wow, what a pig, but warcraft XCVIII is worth it!".

Webapps are currently artificially limited in size, based on some obscure preference.  That's not right.  The manifest should say, "this is a 10 gigabyte application" and then (if the user chooses to install it) that's how much space it should get.  Not "large appcache quota" -- "appcache quota as specified in manifest" (like my bug title put it).  Those are two different things.

I think the "raised limit for offline apps" you are referring to is the offline-apps.quota.warn/offline-apps.quota.max pref, implemented in bug 397416 in 2008.  That appears to be separate from the browser.cache.offline.capacity pref implemented in bug 367447 and increased in size in bug 427134.

Those limits for android are set in mobile/android/app/mobile.js and are tiny:

pref("browser.cache.offline.capacity", 5120); // kilobytes
pref("offline-apps.quota.max", 2048); // kilobytes
pref("offline-apps.quota.warn", 1024); // kilobytes

...but that's not really what this bug is about -- this bug is asking that these limits apply *per-app* according to limits specified in the manifest and approved by the user *for that particular app*.
We don't need to put this in the app manifest - on desktop, we gave unlimited access to appcache and indexed db on the app origin. On android, I'm not sure if that's feasible given the limitations of the mobile device supporting a smaller storage size, so that's why I changed it to say "larger quota." Unless Jonas disagrees here that we could do unlimited access to appcache on the app origin on a mobile device. Jonas - Thoughts?
Surely there would be some considerations for the targeted platform where in this case it is mobile. The defined defaults are small, perhaps a happy median between the current values and N shall suffice?
Again: Android devices vary greatly with respect to amount of usable storage, as do apps.  I still think the right thing to do is to allow the app to request a specific amount of storage.  Otherwise some webapps will fail to work on all phones, just because some phones don't have enough storage to accomodate them.
(incidentally, what I propose would be pretty easy to implement: just preset the appropriate prefs in the webapp's profile at install time.)
What I think we should do is to enable saying:

{
  ...
  permissions: {
    storage: {
      size: "unlimited"
    }
  },
  ...
}


In the manifest and only then would we enable unlimited quota for IndexedDB and appcache. That makes it possible to in the future change the size to a value like "50MB" or some such.
That would be fine with me.  But is the "storage" line referring to "local storage" or "appcache storage"?  Right now they are two different things.

It would be reasonable for the appcache space to be specified implicitly by the manifest -- since the webapp manifest names an appcache manifest, we could (in principle) do HEAD requests on all the appcache manifest entries and sum them up to get a total appcache storage size.  That would be displayed in the marketplace, presumably ("Joe's Very Big App (Install) (12.77M)").  But if done that way you might have to adjust the appcache quota every time the app got updated.  It might be better to do:

  appcache: {
     size: "13M"
  }

and allow the app to grow somewhat.  If you needed to later grow beyond 13M you'd update the manifest -- and presumably the user would be prompted to reauthorize the new space request (as they would if you added any other new permissions to your manifest).
I'd rather just grant unlimited (or a large amount) of storage to these apps and not bother the manifest. If we need to move that storage to the sdcard, we can/should. I'm more concerned about privacy issues if we do that though. I guess apps storing sensitive information locally can encrypt it themselves with DOMCrypt....
(In reply to cscott from comment #8)
> That would be fine with me.  But is the "storage" line referring to "local
> storage" or "appcache storage"?  Right now they are two different things.

That's why I'm only proposing "unlimited" for now. We are working on bringing appcache, indexedDB and localStorage under the same quota mechanism, at which point we could implement arbitrary limits. But for now we can't.

(In reply to Wesley Johnston (:wesj) from comment #9)
> I'd rather just grant unlimited (or a large amount) of storage to these apps
> and not bother the manifest. If we need to move that storage to the sdcard,
> we can/should.

I think moving storage to the SD card would be very hard since it would mean putting the whole gecko profile there. And it seems scary to rely on the user not deleting those files when clearing the card once pictures are transferred to another device for example.

Of course, that's somewhat independent from the question of if we grant unlimited storage by default or only when requested.
Summary: Web Apps should have a large appcache quota if the content is within the app origin → Web Apps should have the ability to specify storage requirements in the permissions property
Priority: -- → P2
Whiteboard: [blocking-webrtandroid1-]
Severity: normal → enhancement
Whiteboard: [blocking-webrtandroid1-] → [WebRuntime] [blocking-webrtandroid1-]
Per bug 1235869, we're going to disable the Android web runtime, so we won't fix this bug in it.

(This is part of a bulk resolution of bugs in the Firefox for Android::Web Apps component, from which I attempted to exclude bugs that are not specific to the runtime, but it's possible that I included one accidentally.  If so, I'm sorry, and please reopen the bug!)
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.