refactor: move extension APIs to session.extensions (#45597)

refactor: move extensions to session.extensions
This commit is contained in:
Sam Maddock 2025-02-21 18:36:51 -05:00 committed by GitHub
parent a63f6143ea
commit e3f61b465d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 508 additions and 205 deletions

View file

@ -1485,7 +1485,7 @@ will not work on non-persistent (in-memory) sessions.
**Note:** On macOS and Windows 10 this word will be removed from the OS custom dictionary as well
#### `ses.loadExtension(path[, options])`
#### `ses.loadExtension(path[, options])` _Deprecated_
* `path` string - Path to a directory containing an unpacked Chrome extension
* `options` Object (optional)
@ -1532,7 +1532,9 @@ is emitted.
**Note:** Loading extensions into in-memory (non-persistent) sessions is not
supported and will throw an error.
#### `ses.removeExtension(extensionId)`
**Deprecated:** Use the new `ses.extensions.loadExtension` API.
#### `ses.removeExtension(extensionId)` _Deprecated_
* `extensionId` string - ID of extension to remove
@ -1541,7 +1543,9 @@ Unloads an extension.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
#### `ses.getExtension(extensionId)`
**Deprecated:** Use the new `ses.extensions.removeExtension` API.
#### `ses.getExtension(extensionId)` _Deprecated_
* `extensionId` string - ID of extension to query
@ -1550,13 +1554,17 @@ Returns `Extension | null` - The loaded extension with the given ID.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
#### `ses.getAllExtensions()`
**Deprecated:** Use the new `ses.extensions.getExtension` API.
#### `ses.getAllExtensions()` _Deprecated_
Returns `Extension[]` - A list of all loaded extensions.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
**Deprecated:** Use the new `ses.extensions.getAllExtensions` API.
#### `ses.getStoragePath()`
Returns `string | null` - The absolute file system path where data for this
@ -1619,6 +1627,10 @@ session is persisted on disk. For in memory sessions this returns `null`.
A [`Cookies`](cookies.md) object for this session.
#### `ses.extensions` _Readonly_
A [`Extensions`](extensions-api.md) object for this session.
#### `ses.serviceWorkers` _Readonly_
A [`ServiceWorkers`](service-workers.md) object for this session.