docs: deprecate setting ProtocolResponse.session to null (#46131)

* docs: deprecate setting ProtocolResponse.session to null

* docs: mark null ProtocolResponse.session as deprecated in struct docs

* Update docs/breaking-changes.md

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>

---------

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
This commit is contained in:
Charles Kerr 2025-03-25 10:04:21 -05:00 committed by GitHub
parent 4f4e23a3b3
commit f7ba0d3b4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View file

@ -28,6 +28,8 @@
* `session` Session (optional) - The session used for requesting URL, by default
the HTTP request will reuse the current session. Setting `session` to `null`
would use a random independent session. This is only used for URL responses.
**Deprecated:** Using `null` to create a random independent session is
deprecated and will be removed soon.
* `uploadData` [ProtocolResponseUploadData](protocol-response-upload-data.md) (optional) - The data used as upload data. This is only
used for URL responses when `method` is `"POST"`.

View file

@ -46,6 +46,16 @@ When calling `Session.clearStorageData(options)`, the `options.quota` type
[removed](https://chromium-review.googlesource.com/c/chromium/src/+/6309405)
from upstream Chromium.
### Deprecated: `null` value for `session` property in `ProtocolResponse`
Previously, setting the ProtocolResponse.session property to `null`
Would create a random independent session. This is no longer supported.
Using single-purpose sessions here is discouraged due to overhead costs;
however, old code that needs to preserve this behavior can emulate it by
creating a random session with `session.fromPartition(some_random_string)`
and then using it in `ProtocolResponse.session`.
### Deprecated: `quota` property in `Session.clearStorageData(options)`
When calling `Session.clearStorageData(options)`, the `options.quota`