w3c / webextensions

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

Inconsistency: storage onChanged #511

Open erosman opened 6 months ago

erosman commented 6 months ago

Inconsistency: storage onChanged

I have comes across an inconsistency in the return of the storage onChanged event. (I am not aware of the return from other browsers.)

Example:

// same for browser and chrome APIs
browser.storage.onChanged.addListener()
browser.storage.sync.onChanged.addListener()

Firefox

Chrome

See also:

hanguokai commented 6 months ago

This issue discusses the behavior of onChanged listener:

In addition, what is the behavior of storage.sync when it syncs with the cloud (remote values)?

tophf commented 6 months ago

what is the behavior of storage.sync when it syncs with the cloud (remote values)

AFAIK the API considers the local copy (cache) to be fully representative of the remote state.

Rob--W commented 6 months ago

Adding consensus labels - everyone is in favor of only firing storage.onChanged when there are changes in values. Firefox is the only one that sometimes fires onChanged despite there not being any changes. This issue is tracked at https://bugzilla.mozilla.org/show_bug.cgi?id=1833153

oliverdunk commented 5 months ago

The other discrepancy in the original issue was if the event should fire with all values in the storage area, or just the changed ones. Given the current behaviour in Chrome is to only include the changed values, I'm reluctant to look at changing that unless there are strong reasons to do so.