#54587: docs: document denying a display media request and fix a webview spec
Description of Change
Two small fixes, one commit each.
Calling the ses.setDisplayMediaRequestHandler callback with null denies the request, and getDisplayMedia() in the page rejects with an AbortError. The docs typed the argument as a plain object, so electron.d.ts rejected callback(null) under strict. This types streams as Object | null and says what null does. The getSources samples in session.md and desktop-capturer.md also never answered the request when getSources rejects, for example when the user cancels the PipeWire picker on Linux, which left getDisplayMedia() pending. Both now call callback(null).
The <webview>.printToPDF() spec for badly typed parameters loaded another webview with the same id on every pass of its loop, so from the second pass on the call was rejected with "webview.printToPDF is not a function" and only the first of the ten parameters reached the type check. It now loads the webview once and requires the rejection to name the parameter. With the headerTemplate check removed, the old spec still passes and the new one fails.
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
- tests are changed or added
- relevant API documentation, tutorials, and examples are updated and follow the documentation style guide
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, past tense, and no longer than 80 characters.
Release Notes
Notes: Fixed the setDisplayMediaRequestHandler callback type to accept null.
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron