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

Conflicting Information regarding storage onChanged #31203

Closed
erosman opened this issue Dec 21, 2023 · 2 comments · Fixed by #31227
Closed

Conflicting Information regarding storage onChanged #31203

erosman opened this issue Dec 21, 2023 · 2 comments · Fixed by #31227
Assignees
Labels
Content:WebExt WebExtensions docs p2 Minor issue with low priority, can be fixed later.

Comments

@erosman
Copy link
Contributor

erosman commented Dec 21, 2023

MDN URL

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/onChanged

What specific section or headline is this issue about?

changes

What information was incorrect, unhelpful, or incomplete?

Due to extension bug reports, I had to test the output of onChanged and I found out that there are conflicting information on MDN which led to the issue.

storage.onChanged

object. Object describing the change. This object contains properties for all the keys in the storage area included in the storageArea.set call, even if key values are unchanged.

storage.StorageArea.onChanged

object. Object describing the change. This contains one property for each key that changed. The name of the property is the name of the key that changed, and its value is a storage.StorageChange object describing the change to that item.

First one says: "all the keys in the storage area, even if key values are unchanged"
Second one says: "one property for each key that changed."

After further testing both APIs storage.onChanged & storage.sync.onChanged:

  • Firefox onChanged returns all the keys in the storage area, even if all values are unchanged
  • Chrome onChanged returns only the changed values (event doesn't fire when there is no change)

What did you expect to see?

no conflicting information

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

See also:

@erosman erosman added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Dec 21, 2023
@github-actions github-actions bot added the Content:WebExt WebExtensions docs label Dec 21, 2023
@rebloor
Copy link
Contributor

rebloor commented Dec 22, 2023

@erosman from your testing, did you determine whether the statement that "When this event is triggered by storageArea.set, it's possible to receive a callback when there is no change to the underlying data." is still correct? Do you get a call back with an empty object if there are no changes?

@erosman
Copy link
Contributor Author

erosman commented Dec 22, 2023

@rebloor After further testing, I had to correct & update the test results.

The issue can now be summarised as:

  • Confusing text for the 2 APIs
  • Inconsistency between Chrome & Firefox implementations

@rebloor rebloor added p2 Minor issue with low priority, can be fixed later. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebExt WebExtensions docs p2 Minor issue with low priority, can be fixed later.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants