diff --git a/files/en-us/mozilla/add-ons/webextensions/api/storage/session/index.md b/files/en-us/mozilla/add-ons/webextensions/api/storage/session/index.md index 92505617cedd43d..8fbce723cda6764 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/storage/session/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/storage/session/index.md @@ -14,6 +14,11 @@ The amount of data that an extension can store in the session storage area is li When the browser stops, all session storage is cleared. When the extension is uninstalled, its associated session storage is cleared. +## Properties + +- {{WebExtAPIRef("storage.session.QUOTA_BYTES")}} + - : The maximum amount of data (in bytes) that can be stored in session storage. + ## Methods The `session` object implements the methods defined on the {{WebExtAPIRef("storage.StorageArea")}} type: diff --git a/files/en-us/mozilla/add-ons/webextensions/api/storage/session/quota_bytes/index.md b/files/en-us/mozilla/add-ons/webextensions/api/storage/session/quota_bytes/index.md new file mode 100644 index 000000000000000..887e681075c2149 --- /dev/null +++ b/files/en-us/mozilla/add-ons/webextensions/api/storage/session/quota_bytes/index.md @@ -0,0 +1,18 @@ +--- +title: storage.session.QUOTA_BYTES +slug: Mozilla/Add-ons/WebExtensions/API/storage/session/QUOTA_BYTES +page-type: webextension-api-property +browser-compat: webextensions.api.storage.session.QUOTA_BYTES +--- + +{{AddonSidebar}} + +The maximum amount of data (in bytes) that can be stored in session storage. Use {{WebExtAPIRef("storage.StorageArea.getBytesInUse()", "storage.session.getBytesInUse()")}} to determine the amount of stored data. + +Its value is `10485760`. + +{{WebExtExamples("h2")}} + +## Browser compatibility + +{{Compat}} diff --git a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/clear/index.md b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/clear/index.md index e35838a095a90e1..318f9fd094bf461 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/clear/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/clear/index.md @@ -17,7 +17,7 @@ This is an asynchronous function that returns a [`Promise`](/en-US/docs/Web/Java let clearing = browser.storage..clear() ``` -`` is one of the writable storage types — {{WebExtAPIRef("storage.local")}}, {{WebExtAPIRef("storage.session")}}, or {{WebExtAPIRef("storage.sync")}} +Where `` is one of the writable storage types — {{WebExtAPIRef("storage.local")}}, {{WebExtAPIRef("storage.session")}}, or {{WebExtAPIRef("storage.sync")}} ### Parameters diff --git a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/get/index.md b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/get/index.md index 09b13f08fd54494..fc15cc8ca26d1be 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/get/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/get/index.md @@ -19,7 +19,7 @@ let results = browser.storage..get( ) ``` -`` will be one of the writable storage types — {{WebExtAPIRef("storage.sync", "sync")}}, {{WebExtAPIRef("storage.local", "local")}}, or {{WebExtAPIRef("storage.managed", "managed")}}. +Where `` is one of the storage types — {{WebExtAPIRef("storage.sync", "sync")}}, {{WebExtAPIRef("storage.local", "local")}}, {{WebExtAPIRef("storage.session", "session")}}, or {{WebExtAPIRef("storage.managed", "managed")}}. ### Parameters diff --git a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/getbytesinuse/index.md b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/getbytesinuse/index.md index cca33b6415c53e6..4e3fb2ef26cc0ee 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/getbytesinuse/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/getbytesinuse/index.md @@ -7,13 +7,17 @@ browser-compat: webextensions.api.storage.StorageArea.getBytesInUse {{AddonSidebar}} -Gets the amount of storage space, in bytes, used one or more items being stored in the storage area. +Gets the amount of storage space, in bytes, used by one or more items stored in the storage area. -This function only exists in browser.storage.sync -It does not exist in browser.storage.local -See +> [!NOTE] +> In Firefox this method: +> +> - is supported in {{WebExtAPIRef("storage.sync")}}. +> - is supported in {{WebExtAPIRef("storage.session")}} from Firefox 131. +> - isn't supported in {{WebExtAPIRef("storage.local")}}, see [Firefox bug 1385832](https://bugzil.la/1385832). +> - isn't provided in {{WebExtAPIRef("storage.managed")}}. -This is an asynchronous function that returns a [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). +This is an asynchronous method that returns a [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). ## Syntax @@ -23,16 +27,18 @@ let gettingSpace = browser.storage..getBytesInUse( ) ``` -`` can only be {{WebExtAPIRef("storage.sync")}}, not {{WebExtAPIRef("storage.local")}} because of [this bug](https://bugzil.la/1385832). +Where `` is one of the storage types — {{WebExtAPIRef("storage.sync", "sync")}}, {{WebExtAPIRef("storage.local", "local")}}, {{WebExtAPIRef("storage.session", "session")}}, or {{WebExtAPIRef("storage.managed", "managed")}}. + +In Firefox, `` can't be {{WebExtAPIRef("storage.local")}}, because of [bug 1385832](https://bugzil.la/1385832). ### Parameters - `keys` - - : A key (string) or keys (an array of strings) to identify the item(s) whose storage space you want to retrieve. If an empty array is passed in, 0 will be returned. If you pass `null` or `undefined` here, the function will return the space used by the entire storage area. + - : A key (string) or keys (an array of strings) to identify the items whose storage space you want to retrieve. If an empty array is passed in, 0 is returned. If you pass `null` or `undefined`, the function returns the space used by the entire storage area. ### Return value -A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that will be fulfilled with an integer, `bytesUsed`, representing the storage space used by the objects that were specified in `keys`. If the operation failed, the promise will be rejected with an error message. +A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that is fulfilled with an integer, `bytesUsed`, representing the storage space used by the objects specified in `keys`. If the operation fails, the promise is rejected with an error message. ## Browser compatibility diff --git a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/remove/index.md b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/remove/index.md index e2dd4646b184b84..d8c90605dc744c0 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/remove/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/remove/index.md @@ -19,7 +19,7 @@ let removingItem = browser.storage..remove( ) ``` -`` is one of the writable storage types — {{WebExtAPIRef("storage.local")}}, {{WebExtAPIRef("storage.session")}}, or {{WebExtAPIRef("storage.sync")}}. +Where `` is one of the writable storage types — {{WebExtAPIRef("storage.local")}}, {{WebExtAPIRef("storage.session")}}, or {{WebExtAPIRef("storage.sync")}}. ### Parameters diff --git a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/set/index.md b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/set/index.md index 110f6057719ebc9..31f3297586ad16f 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/set/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/set/index.md @@ -23,7 +23,7 @@ let settingItem = browser.storage..set( ) ``` -`` is one of the writable storage types — {{WebExtAPIRef("storage.local")}}, {{WebExtAPIRef("storage.session")}}, or {{WebExtAPIRef("storage.sync")}}. +Where `` is one of the writable storage types — {{WebExtAPIRef("storage.local")}}, {{WebExtAPIRef("storage.session")}}, or {{WebExtAPIRef("storage.sync")}}. ### Parameters diff --git a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/setaccesslevel/index.md b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/setaccesslevel/index.md index 55e2c4df9bb133e..1d16686ed2cb757 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/setaccesslevel/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/setaccesslevel/index.md @@ -23,7 +23,7 @@ await browser.storage..setAccessLevel( ) ``` -`` can be the {{WebExtAPIRef("storage.session")}} storage type. +Where `` is the {{WebExtAPIRef("storage.session")}} storage type. ### Parameters diff --git a/files/en-us/mozilla/firefox/releases/131/index.md b/files/en-us/mozilla/firefox/releases/131/index.md index 349b7da3369c223..11b22fc0f00e3cd 100644 --- a/files/en-us/mozilla/firefox/releases/131/index.md +++ b/files/en-us/mozilla/firefox/releases/131/index.md @@ -52,8 +52,10 @@ This article provides information about the changes in Firefox 131 that affect d ## Changes for add-on developers -- {{WebExtAPIRef("tabs.onUpdated")}} is now triggered when `openerTabId` is changed through `tabs.update()`. ([Firefox bug 1409262](https://bugzil.la/1409262)). -- {{WebExtAPIRef("tabs.update")}} now accepts `openerTabId` set to `-1` to clear `openerTabId`. ([Firefox bug 1409262](https://bugzil.la/1409262)). +- The 10 MB quota for data stored by the {{WebExtAPIRef("storage.session")}} API is now enforced in Firefox Nightly 131. Previously, Firefox didn't implement this quota. This enforcement rolls out to release versions of Firefox from version 134 ([Firefox bug 1915688](https://bugzil.la/1915688)). This enables extensions that rely on the previous behavior to correct any issues. ([Firefox bug 1908925](https://bugzil.la/1908925)) +- {{WebExtAPIRef("storage.session")}} now supports the {{WebExtAPIRef("storage.StorageArea.getBytesInUse()")}} API and the {{WebExtAPIRef("storage.session.QUOTA_BYTES")}} property. ([Firefox bug 1908925](https://bugzil.la/1908925)) +- {{WebExtAPIRef("tabs.onUpdated")}} is now triggered when `openerTabId` is changed through `tabs.update()` ([Firefox bug 1409262](https://bugzil.la/1409262)). +- {{WebExtAPIRef("tabs.update")}} now accepts `openerTabId` set to `-1` to clear `openerTabId` ([Firefox bug 1409262](https://bugzil.la/1409262)). ## Experimental web features