w3c / webextensions

Charter and administrivia for the WebExtensions Community Group (WECG)
Other
578 stars 50 forks source link

Enhance `browser.storage.local` to allow storing binary data directly #533

Open scripthunter7 opened 5 months ago

scripthunter7 commented 5 months ago

I am reaching out to propose an enhancement to the browser.storage.local functionality. As it stands, this storage currently only supports values that are serializable to JSON.

However, in some scenarios, the ability to store binary data directly can greatly enhance efficiency and performance.

To address this, I recommend integrating support for binary data formats such as Uint8Array, ArrayBuffer, or Blob without the need for JSON serialization. Certainly, maintaining backward compatibility is crucial, since a lot of existing code relies on the current storage.local API.

gorhill commented 5 months ago

Another approach to solve this would be to keep browser.storage.local as is while making one or both of the following APIs work reliably in incognito/private mode (related issue #534).

Extensions can already save data while in incognito/private mode through browser.local.storage so I don't see how it helps to prevent them to do so reliably through the above API.

Personally just being able to reliably use the CacheStorage API regardless of incognito/private mode would be welcome.