Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: StorageArea.getAllKeys() #601

Open
polywock opened this issue Apr 25, 2024 · 6 comments
Open

Proposal: StorageArea.getAllKeys() #601

polywock opened this issue Apr 25, 2024 · 6 comments
Labels
implemented: chrome Implemented in Chrome supportive: firefox Supportive from Firefox supportive: safari Supportive from Safari

Comments

@polywock
Copy link

polywock commented Apr 25, 2024

Taken from #505, as an alternative proposal suggested by @tophf and @Rob--W. It's significantly different from my original proposal, so I'm creating a separate proposal for it.

Background

I regularly need to use storage keys that involve dynamic elements like flag:[tabId]. The only way to get all keys starting with the prefix flag: is using StorageArea.get() to get all the storage items and then to filter.

This isn't efficient. The storage areas support 10MB of data and even more with the unlimitedStorage permission. That's potentially a huge amount of storage data that needs to be serialized and sent over. There's also a special concern when using the Sync storage area.

Proposal

A method to get all keys without the corresponding values.

browser.storage.local.getAllKeys(): Promise<string[]> 

Resources

https://developer.mozilla.org/en-US/docs/Web/API/IDBIndex/getAllKeys

@github-actions github-actions bot added needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time labels Apr 25, 2024
@xeenon xeenon added supportive: safari Supportive from Safari and removed needs-triage: safari Safari needs to assess this issue for the first time labels Apr 25, 2024
@Rob--W Rob--W added supportive: firefox Supportive from Firefox and removed needs-triage: firefox Firefox needs to assess this issue for the first time labels Apr 25, 2024
@oliverdunk oliverdunk added supportive: chrome Supportive from Chrome and removed needs-triage: chrome Chrome needs to assess this issue for the first time labels May 9, 2024
@oliverdunk
Copy link
Member

@polywock I plan to implement this in Chromium as part of some work I am doing on the storage API. I’ve started a proposal PR using the template - would you like to work together on finishing that, or are you happy for me to open it? Thanks!

@polywock
Copy link
Author

@oliverdunk I appreciate the offer to be involved. But, I'll probably slow down the process.

Please go ahead without me. Thank you!

@oliverdunk
Copy link
Member

I have opened a proposal for this in #649.

@polywock
Copy link
Author

polywock commented Jul 4, 2024

Pull request has been approved and merged. 🚀

@polywock polywock closed this as completed Jul 4, 2024
@Rob--W
Copy link
Member

Rob--W commented Jul 30, 2024

Re-opening this ticket because we usually keep tickets open until there is nothing left to be done. In this case, we can use this ticket to signal the cross-browser implementation status of the feature (as issue labels here).

I have opened https://bugzilla.mozilla.org/show_bug.cgi?id=1910669 to track the implementation in Firefox.

@Rob--W Rob--W reopened this Jul 30, 2024
@oliverdunk
Copy link
Member

I've just landed the CL for this in Chromium (link). It will be available in Canary later today and more generally Chrome 130 as that rolls out across channels (schedule).

@oliverdunk oliverdunk added implemented: chrome Implemented in Chrome and removed supportive: chrome Supportive from Chrome labels Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
implemented: chrome Implemented in Chrome supportive: firefox Supportive from Firefox supportive: safari Supportive from Safari
Projects
None yet
Development

No branches or pull requests

4 participants