Skip to content

Fix several issues in webext storage docs#43924

Merged
rebloor merged 6 commits intomdn:mainfrom
Rob--W:webext-storage-docs-fixups
May 1, 2026
Merged

Fix several issues in webext storage docs#43924
rebloor merged 6 commits intomdn:mainfrom
Rob--W:webext-storage-docs-fixups

Conversation

@Rob--W
Copy link
Copy Markdown
Member

@Rob--W Rob--W commented Apr 24, 2026

Description

storage/onchanged:

  • Mention storage.StorageArea.onChanged in storage.onChanged.
  • Change "return" terminology to "listener" / "receive" in onChanged.
  • Add missing "session" to storage.onChanged's areaName parameter.
  • Include mention of storage.managed behavior that was already mentioned in the storage.StorageArea.onChanged docs.

storage/storagearea:

  • Clarify that StorageArea is an abstract type and explicitly mention the concrete APIs it applies to.

storage/onchanged:

  • Change "return" terminology to "listener" / "receive" in onChanged.
  • Fix very confusing description of managed storage.

storage/setaccesslevel:

storage/storagechange:

  • Mention the events this type relates to.

Motivation

Documentation was inaccurate, misleading or confusing.

Additional details

Related issues and pull requests

storage/onchanged:
- Mention storage.StorageArea.onChanged in storage.onChanged.
- Change "return" terminology to "listener" / "receive" in onChanged.
- Add missing "session" to storage.onChanged's areaName parameter.
- Include mention of `storage.managed` behavior that was already
  mentioned in the storage.StorageArea.onChanged docs.

storage/storagearea:
- Clarify that `StorageArea` is an abstract type and explicitly mention
  the concrete APIs it applies to.

storage/onchanged:
- Change "return" terminology to "listener" / "receive" in onChanged.
- Fix very confusing description of managed storage.

storage/setaccesslevel:
- Drop mention of it supporting session only. It expanded to all storage
  areas in Chrome 140 (https://issues.chromium.org/issues/40949182).

storage/storagechange:
- Mention the events this type relates to.
@Rob--W Rob--W requested a review from a team as a code owner April 24, 2026 10:17
@Rob--W Rob--W requested review from willdurand and removed request for a team April 24, 2026 10:17
@github-actions github-actions Bot added Content:WebExt WebExtensions docs size/s [PR only] 6-50 LoC changed labels Apr 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

@rebloor rebloor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rob--W some suggestions for your consideration

Comment thread files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md Outdated
Comment thread files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md Outdated
Comment thread files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md Outdated
Comment on lines +11 to +13
Unlike other storage areas, `storage.session` is only available to privileged (trusted) extension contexts. This `setAccessLevel` method is used to expose the session storage area to content scripts too.

Unlike other storage areas, `storage.session` is only available to privileged (trusted) extension contexts. This `setAccessLevel` method is used to expose the session storage area to content scripts too. By default, all other storage areas are exposed to all extension contexts, including content scripts.
By default, all other storage areas are exposed to all extension contexts, including content scripts. This `setAccessLevel` method can be used to restrict access of these storage areas in content scripts.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Unlike other storage areas, `storage.session` is only available to privileged (trusted) extension contexts. This `setAccessLevel` method is used to expose the session storage area to content scripts too.
Unlike other storage areas, `storage.session` is only available to privileged (trusted) extension contexts. This `setAccessLevel` method is used to expose the session storage area to content scripts too. By default, all other storage areas are exposed to all extension contexts, including content scripts.
By default, all other storage areas are exposed to all extension contexts, including content scripts. This `setAccessLevel` method can be used to restrict access of these storage areas in content scripts.
Use this method to:
- Expose the `session` storage area to content scripts. Unlike other storage areas, `storage.session` is only available to privileged (trusted) extension contexts.
- Restrict content scripts' access to `local`, `managed`, and `sync` storage areas. By default, these storage areas are exposed to all extension contexts, including content scripts.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added "by default" to your suggested description for session.

Suggested change
Unlike other storage areas, `storage.session` is only available to privileged (trusted) extension contexts. This `setAccessLevel` method is used to expose the session storage area to content scripts too.
Unlike other storage areas, `storage.session` is only available to privileged (trusted) extension contexts. This `setAccessLevel` method is used to expose the session storage area to content scripts too. By default, all other storage areas are exposed to all extension contexts, including content scripts.
By default, all other storage areas are exposed to all extension contexts, including content scripts. This `setAccessLevel` method can be used to restrict access of these storage areas in content scripts.
Use this method to:
- Expose the `session` storage area to content scripts. Unlike other storage areas, `storage.session` is only available to privileged (trusted) extension contexts by default.
- Restrict content scripts' access to `local`, `managed`, and `sync` storage areas. By default, these storage areas are exposed to all extension contexts, including content scripts.

Comment thread files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/index.md Outdated
Comment thread files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/index.md Outdated
Comment thread files/en-us/mozilla/add-ons/webextensions/api/storage/storagechange/index.md Outdated
…d/index.md

Co-authored-by: rebloor <git@sherpa.co.nz>
Copy link
Copy Markdown
Member Author

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thumbed up the remaining review comments. The one remaining question is what to do with "line 13". To duplicate it in the other doc, or to remove it altogether?

Comment thread files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md Outdated
rebloor and others added 2 commits April 30, 2026 11:26
Co-authored-by: rebloor <git@sherpa.co.nz>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: rebloor <git@sherpa.co.nz>
Copy link
Copy Markdown
Contributor

@rebloor rebloor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rob--W I removed line 13 because we don't use similar content in other event docs.

Fires when one or more items in any of the {{WebExtAPIRef('storage.StorageArea', 'storage areas'}} changes.
If you only need to listen for changes in one storage area, use {{WebExtAPIRef('storage.StorageArea.onChanged')}} instead.

Fired when {{WebExtAPIRef('storage.StorageArea.set','storageArea.set')}}, {{WebExtAPIRef('storage.StorageArea.remove','storageArea.remove')}}, or {{WebExtAPIRef('storage.StorageArea.clear','storageArea.clear')}} executes against any of the {{WebExtAPIRef('storage.StorageArea', 'storage areas'}}.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rebloor I did not see the edit you described in #43924 (review) . This is what you intended, right?

Suggested change
Fired when {{WebExtAPIRef('storage.StorageArea.set','storageArea.set')}}, {{WebExtAPIRef('storage.StorageArea.remove','storageArea.remove')}}, or {{WebExtAPIRef('storage.StorageArea.clear','storageArea.clear')}} executes against any of the {{WebExtAPIRef('storage.StorageArea', 'storage areas'}}.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rebloor rebloor merged commit 2857820 into mdn:main May 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebExt WebExtensions docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants