Closed
Bug 1457973
Opened 7 years ago
Closed 5 years ago
Enable navigator.storage API on Firefox Android (Fennec), enabling navigator.storage() and navigator.persist()
Categories
(Firefox for Android Graveyard :: Web Apps (PWAs), defect, P2)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: formatkaka, Unassigned)
References
Details
(Keywords: dev-doc-needed)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Build ID: 20180426170554
Steps to reproduce:
As per MDN Docs for Storage Manager API at https://developer.mozilla.org/en-US/docs/Web/API/StorageManager#Browser_compatibility, the Storage API is available and enabled by default after firefox v 57 on mobile.
I am using firefox nightly v61 / stable v59 on android and both return `navigator.storage` as undefined.
Check out this codepen - https://codepen.io/formatkaka/pen/zWQbvr
Works perfectly for firefox dev edition on laptop.
Also works for chrome/edge on android.
Actual results:
returns undefined
Expected results:
should return StorageManager Object
[triage] Core API isn't working: P1. Susheel, this is a platform issue: maybe someone from the desktop side can take a look?
Flags: needinfo?(sdaswani)
Priority: -- → P1
Snorp, can your team take a look? Thanks!
Flags: needinfo?(sdaswani) → needinfo?(snorp)
Marion, can your team take a look?
Flags: needinfo?(snorp) → needinfo?(mdaly)
Comment 4•7 years ago
|
||
Andrew: can you give your two cents here?
Flags: needinfo?(mdaly) → needinfo?(bugmail)
Updated•7 years ago
|
Assignee: nobody → bugmail
Comment 5•7 years ago
|
||
I can reproduce. It's possible this is related to bug 1458320 which kinda-sorta broke IndexedDB. The IndexedDB breakage at least has broken the WebIDE remote debugging mechanism documented at https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Debugging_Firefox_for_Android_over_Wifi in my nightly profile, although I also feel like I heard things about WebIDE going away, so I'm a little concerned it may still be broken after addressing that. In any event, I'll clean up the profile and investigate a bit more.
Comment 6•7 years ago
|
||
We do this on purpose. Enabled everywhere but android in bug 1399038.
https://searchfox.org/mozilla-central/rev/8837610b6c999451435695e800f38d4acbc0a644/modules/libpref/init/all.js#5703
// Enable Storage API for all platforms except Android.
#if !defined(MOZ_WIDGET_ANDROID)
pref("dom.storageManager.enabled", true);
#else
pref("dom.storageManager.enabled", false);
#endif
Flags: needinfo?(bugmail)
Comment 7•7 years ago
|
||
While we should almost certainly have a bug for turning this on for Android/Mobile, in the interim the MDN docs should be updated to reflect that the API is not and never was enabled for Fennec.
Keywords: dev-doc-needed
Reporter | ||
Comment 8•7 years ago
|
||
Do I need to file a new bug report to turn this on for Android ?
Reporter | ||
Comment 9•7 years ago
|
||
(In reply to Andrew Sutherland [:asuth] from comment #7)
> While we should almost certainly have a bug for turning this on for
> Android/Mobile, in the interim the MDN docs should be updated to reflect
> that the API is not and never was enabled for Fennec.
Hello, I see that you are working on this bug.
How can I track the current status of this bug ?
Thanks
Comment 10•7 years ago
|
||
:snorp, I think historically we've been afraid of filling up mobile storage, which is presumably why the decision in bug 1399038 was made to not turn navigator.storage on for Android. Unless it was a prompting issue... Is leaving navigator.storage disabled still the right decision?
Flags: needinfo?(snorp)
(In reply to Andrew Sutherland [:asuth] from comment #10)
> :snorp, I think historically we've been afraid of filling up mobile storage,
> which is presumably why the decision in bug 1399038 was made to not turn
> navigator.storage on for Android. Unless it was a prompting issue... Is
> leaving navigator.storage disabled still the right decision?
We can just set a smaller quota if filling up storage is a concern.
If there is a prompting issue, myself or someone else on the team should be able to help out. If you use nsIPromptService it should Just Work.
Flags: needinfo?(snorp)
Updated•7 years ago
|
Flags: needinfo?(bugmail)
Reporter | ||
Comment 12•7 years ago
|
||
(In reply to Andrew Sutherland [:asuth] from comment #10)
> :snorp, I think historically we've been afraid of filling up mobile storage,
> which is presumably why the decision in bug 1399038 was made to not turn
> navigator.storage on for Android. Unless it was a prompting issue... Is
> leaving navigator.storage disabled still the right decision?
How is turning on navigator.storage related to filling up mobile storage?
As per https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Browser_storage_limits_and_eviction_criteria , Firefox already has eviction criteria in place. So, I reckon, filling up mobile storage shouldn't be a problem
Also, the navigator.storage API is used only for managing persistence permissions and estimating available storage. If I use service worker and cache API, how am I to know if I am nearing eviction limits?
Thanks
Comment 13•7 years ago
|
||
(In reply to formatkaka from comment #12)
> How is turning on navigator.storage related to filling up mobile storage?
By that I mean that navigator.storage.persist() causes the eviction mechanism to no longer automatically evict data for a site. And while Firefox desktop has UI under about:preferences, "Cookies and Site Data", "Manage Data..." which lets a user figure out where their storage is going and which origins are marked persistent, Fennec doesn't have similar UI that I can find which means that the eviction mechanism becomes particularly important. The only way the user can get rid of the excess data is by manually navigating to the site and bringing up the permissions for the page and removing the persistent permission or using clear private data to clear all their stored data, which is a pretty broad granularity.
That said, I realize your interest is in navigator.storage.estimate(). We could alter things so that persist() simply fails on mobile and allow estimate() to work.
> Also, the navigator.storage API is used only for managing persistence
> permissions and estimating available storage. If I use service worker and
> cache API, how am I to know if I am nearing eviction limits?
To clarify: There's no eviction limit. There's just the quota limit. When you hit your origin/group's quota limit, you can't write any more data. Eviction, per the page, happens based on recency of usage. It doesn't matter how little data you've used if the user hasn't accessed your site in a long time.
Comment 14•7 years ago
|
||
Dale, as triage owner, it'd be great if you could re-triage this. Here's the situation as I understand it:
- navigator.storage is disabled by pref for Fennec.
- Fennec does not have UI to surface per-origin data usage and allow clearing it, so it makes sense for navigator.storage.persist() to be forbidden (see comment 13).
- navigator.storage.estimate() doesn't make as much sense to hide because that potentially helps sites be better about self-moderation of data usage. However, it's quite possible our quota values are overly generous and might encourage counter-productive behavior like over-caching. At least on desktop, Nightly claims I can use 2 gigs of data for localhost because of this logic:
// To avoid one group evicting all the rest, limit the amount any one group
// can use to 20%. To prevent individual sites from using exorbitant amounts
// of storage where there is a lot of free space, cap the group limit to 2GB.
uint64_t x = std::min<uint64_t>(mTemporaryStorageLimit * .20, 2 GB);
- We currently enable navigator.storage as all-or-nothing based on the dom.storageManager.enabled pref.
It seems like there are a few possible paths, these are the ones that make the most sense to me:
1. Wait until we have UI in place in Fennec to manage origin data usage before doing anything.
2. Do enable the pref, but have navigator.storage.persist() always throw until we have the data usage UI. Also, maybe change the group limit thresholds on Fennec to avoid suggesting to sites that they can use 2 gigs of data?
All of these seem like product decisions, however.
Flags: needinfo?(bugmail) → needinfo?(dharvey)
Comment 15•7 years ago
|
||
> 1. Wait until we have UI in place in Fennec to manage origin data usage before doing anything.
Especially if exposing this is already on the cards it seem like the ideal solution, however yeh while I am triage owner I am not involved in the mobile team at the moment so I dont know if it is on the cards or can be put on them (I think Andreas was going to switch the triage owner to someone actively working on mobile) sorry I couldnt be more help
Flags: needinfo?(dharvey)
Comment 16•7 years ago
|
||
:snorp, please see comment 14 (and 13), I'm going by the module system here, but it seems like that might be outdated, please redirect as appropriate.
Flags: needinfo?(snorp)
(In reply to Andrew Sutherland [:asuth] from comment #14)
> It seems like there are a few possible paths, these are the ones that make
> the most sense to me:
> 1. Wait until we have UI in place in Fennec to manage origin data usage
> before doing anything.
This is very unlikely to ever happen.
> 2. Do enable the pref, but have navigator.storage.persist() always throw
> until we have the data usage UI. Also, maybe change the group limit
> thresholds on Fennec to avoid suggesting to sites that they can use 2 gigs
> of data?
This sounds reasonable.
>
> All of these seem like product decisions, however.
I agree. I choose you, Andreas Bovens!
Flags: needinfo?(snorp) → needinfo?(abovens)
Reporter | ||
Comment 19•7 years ago
|
||
(In reply to Andrew Sutherland [:asuth] from comment #14)
> Dale, as triage owner, it'd be great if you could re-triage this. Here's
> the situation as I understand it:
> - navigator.storage is disabled by pref for Fennec.
> - Fennec does not have UI to surface per-origin data usage and allow
> clearing it, so it makes sense for navigator.storage.persist() to be
> forbidden (see comment 13).
> - navigator.storage.estimate() doesn't make as much sense to hide because
> that potentially helps sites be better about self-moderation of data usage.
> However, it's quite possible our quota values are overly generous and might
> encourage counter-productive behavior like over-caching. At least on
> desktop, Nightly claims I can use 2 gigs of data for localhost because of
> this logic:
> // To avoid one group evicting all the rest, limit the amount any one group
> // can use to 20%. To prevent individual sites from using exorbitant
> amounts
> // of storage where there is a lot of free space, cap the group limit to
> 2GB.
> uint64_t x = std::min<uint64_t>(mTemporaryStorageLimit * .20, 2 GB);
> - We currently enable navigator.storage as all-or-nothing based on the
> dom.storageManager.enabled pref.
What is the value of mTemporaryStorageLimit ? Is it the value of storage space available on mobile device.
When you say group, does it mean a specific domain ?
Comment 20•7 years ago
|
||
(In reply to formatkaka from comment #19)
> What is the value of mTemporaryStorageLimit ? Is it the value of storage
> space available on mobile device.
>
> When you say group, does it mean a specific domain ?
mTemporaryStorageLimit is the global limit documented at https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Browser_storage_limits_and_eviction_criteria#Storage_limits which also covers the definition of group.
Comment 21•7 years ago
|
||
(In reply to Andrew Sutherland [:asuth] from comment #7)
> While we should almost certainly have a bug for turning this on for
> Android/Mobile, in the interim the MDN docs should be updated to reflect
> that the API is not and never was enabled for Fennec.
I've now filed bug 1469876 to track correcting MDN since I misunderstood how dev-doc-needed works. It gets a bug looked at once it's fixed/closed.
See Also: → 1469876
Summary: navigator.storage is undefined for firefox nightly (v 61.0 ) → Enable navigator.storage API on Firefox Android (Fennec), enabling navigator.storage() and navigator.persist()
Comment 22•7 years ago
|
||
Closing per https://bugzilla.mozilla.org/show_bug.cgi?id=1473195
Contact :susheel if you think this bug should be re-opened
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INACTIVE
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INACTIVE → ---
Comment 23•7 years ago
|
||
Non-GeckoView bug, see it's been reopened. is this still a priority?
Flags: needinfo?(sdaswani)
Updated•7 years ago
|
Assignee: bugmail → nobody
Comment 24•7 years ago
|
||
Putting it on P1 list, we will triage as we burn down.
Flags: needinfo?(sdaswani)
Comment 25•7 years ago
|
||
(In reply to :sdaswani only needinfo from comment #24)
> Putting it on P1 list, we will triage as we burn down.
Still want us to handle it?
Flags: needinfo?(sdaswani)
Comment 26•7 years ago
|
||
Sorry Marion - I am not sure. NI'ing Andreas to make a decision.
Flags: needinfo?(sdaswani) → needinfo?(abovens)
Comment 27•7 years ago
|
||
I suggested going for option 2, earlier, and that still seems like the best option forward (unless we decide to do nothing at all). Andrew, is fixing this a lot of work for your team? Or should it be handled by the Fennec team?
Snorp, is this something we should somehow implement or otherwise document in GeckoView as well?
Flags: needinfo?(snorp)
Flags: needinfo?(overholt)
Flags: needinfo?(abovens)
(In reply to Andreas Bovens [:abovens] from comment #27)
> I suggested going for option 2, earlier, and that still seems like the best
> option forward (unless we decide to do nothing at all). Andrew, is fixing
> this a lot of work for your team? Or should it be handled by the Fennec team?
>
> Snorp, is this something we should somehow implement or otherwise document
> in GeckoView as well?
For GV, I think we'd want to expose some kind of interface for querying and clearing the storage used on a per-site basis.
Flags: needinfo?(snorp)
Comment 29•7 years ago
|
||
As a different Andrew involved in these things, option 2 as proposed in comment 14 isn't that much work, it's just that the risk/reward ratio is bad for the change until https://wiki.mozilla.org/DOM/Workers-Storage/projects/WSIF is landed and happy and we have more telemetry, and/or until Fennec/GeckoView has the resources to help focus on the PWA aspects and ensure that Fennec/GV aren't filling up the user's disk, etc. We are planning to have better QuotaManager telemetry in the next quarter. And once WSIF is done, we will have more bandwidth/ability to deftly pivot on such issues.
(Not that the change is particularly risky. It's just that if we expose an API and it shifts the behavior of a mobile website to use more data and it turns out that interacts badly with the 2gig max limit and other sites or other apps on the device... that would be bad. It's easier to make the change to justify the change when we have more eyes on things, more data, and are targeting for specific PWA-style use-case support, like making sure gmail works reliably offline or some other specific rich PWA we can focus on as a driving use-case.)
Comment 30•7 years ago
|
||
(In reply to Andreas Bovens [:abovens] from comment #27)
> I suggested going for option 2, earlier, and that still seems like the best
> option forward (unless we decide to do nothing at all). Andrew, is fixing
> this a lot of work for your team? Or should it be handled by the Fennec team?
I am also involving in Storage API. As :asuth said, it's not too much work. I don't think that needs to take much time. Finding a suitable global limit for Fennec might take time, but if we don't need to do that, it should even take less time.
Flags: needinfo?(overholt)
Comment 32•5 years ago
|
||
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: REOPENED → RESOLVED
Closed: 7 years ago → 5 years ago
Resolution: --- → INCOMPLETE
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•