Skip to content

fix: main process crashes from WebUI host matching, worker AI bindings, extension background page media and serial port revocation - #53305

Merged
jkleinsc merged 1 commit into
mainfrom
fix/browser-null-derefs-from-renderer
Aug 31, 2026
Merged

jkleinsc merged 1 commit into
mainfrom
fix/browser-null-derefs-from-renderer

Conversation

@MarshallOfSound

Copy link
Copy Markdown
Member

Description of Change

Four small main-process crash fixes, each with a crash-case fixture (except the serial one, which needs hardware to exercise):

  • ElectronWebUIControllerFactory matched WebUI pages by host only, so navigating a window to e.g. http://accessibility/ was treated as a WebUI navigation and hit NOTREACHED in RenderFrameHostImpl::AllowBindings. It now also requires chrome:// (or devtools:// for the DevTools host).
  • With session.registerLocalAIHandler() set, a LanguageModel call from a Worker reached ProxyingAIManager with no RenderFrameHost and dereferenced it. Such requests are now reported as unavailable.
  • Extension background pages get api::WebContents as their delegate but never had a WebContentsPermissionHelper, so navigator.mediaDevices.* (and pointer/keyboard lock) from a background page dereferenced null. The helper is now created for every WebContents that api::WebContents adopts.
  • SerialChooserContext::RevokePortPermissionWebInitiated dereferenced port_info_.end() when SerialPort.forget() was called for a port the context no longer knew about (e.g. after the device was unplugged).

Checklist

Release Notes

Notes: Fixed main process crashes when navigating to http://accessibility/ or http://devtools/, when using the LanguageModel API from a Worker with a local AI handler registered, when an extension background page used navigator.mediaDevices, and when calling SerialPort.forget() for a disconnected device.

…s, extension background page media and serial port revocation

- Only treat chrome://accessibility and devtools://devtools (or chrome://)
  as WebUI URLs; matching on host alone made an ordinary navigation to
  http://accessibility/ create WebUI bindings for a non-WebUI process.
- Don't route LanguageModel requests that have no live document (workers)
  to the local AI handler; report them as unavailable instead of
  dereferencing a null frame.
- Create the WebContentsPermissionHelper for every WebContents that
  api::WebContents becomes the delegate of, including extension background
  pages, so media/pointer-lock permission checks have a helper to use.
- Return early from SerialChooserContext::RevokePortPermissionWebInitiated
  when the port is no longer known instead of dereferencing end().
@MarshallOfSound MarshallOfSound added semver/patch backwards-compatible bug fixes target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Aug 29, 2026
@electron-cation electron-cation Bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Aug 29, 2026
@jkleinsc
jkleinsc merged commit 0cfc258 into main Aug 31, 2026
111 checks passed
@release-clerk

release-clerk Bot commented Aug 31, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed main process crashes when navigating to http://accessibility/ or http://devtools/, when using the LanguageModel API from a Worker with a local AI handler registered, when an extension background page used navigator.mediaDevices, and when calling SerialPort.forget() for a disconnected device.

@jkleinsc
jkleinsc deleted the fix/browser-null-derefs-from-renderer branch August 31, 2026 15:30
@trop

trop Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "43-x-y" cleanly;
you will need to perform this backport manually.

@trop trop Bot removed the target/43-x-y PR should also be added to the "43-x-y" branch. label Aug 31, 2026
@trop

trop Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "44-x-y" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #53325

@trop

trop Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "43-x-y", please check out #53332

@trop

trop Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "44-x-y", please check out #53333

@trop trop Bot added in-flight/44-x-y merged/45-x-y PR was merged to the "45-x-y" branch. and removed in-flight/45-x-y labels Aug 31, 2026
MarshallOfSound added a commit that referenced this pull request Aug 31, 2026
…s, extension background page media and serial port revocation (#53332)

fix: main process crashes from WebUI host matching, worker AI bindings, extension background page media and serial port revocation (#53305)

- Only treat chrome://accessibility and devtools://devtools (or chrome://)
  as WebUI URLs; matching on host alone made an ordinary navigation to
  http://accessibility/ create WebUI bindings for a non-WebUI process.
- Don't route LanguageModel requests that have no live document (workers)
  to the local AI handler; report them as unavailable instead of
  dereferencing a null frame.
- Create the WebContentsPermissionHelper for every WebContents that
  api::WebContents becomes the delegate of, including extension background
  pages, so media/pointer-lock permission checks have a helper to use.
- Return early from SerialChooserContext::RevokePortPermissionWebInitiated
  when the port is no longer known instead of dereferencing end().

(cherry picked from commit 0cfc258)
@trop trop Bot added merged/43-x-y PR was merged to the "43-x-y" branch. and removed in-flight/43-x-y labels Aug 31, 2026
MarshallOfSound added a commit that referenced this pull request Aug 31, 2026
…s, extension background page media and serial port revocation (#53333)

fix: main process crashes from WebUI host matching, worker AI bindings, extension background page media and serial port revocation (#53305)

- Only treat chrome://accessibility and devtools://devtools (or chrome://)
  as WebUI URLs; matching on host alone made an ordinary navigation to
  http://accessibility/ create WebUI bindings for a non-WebUI process.
- Don't route LanguageModel requests that have no live document (workers)
  to the local AI handler; report them as unavailable instead of
  dereferencing a null frame.
- Create the WebContentsPermissionHelper for every WebContents that
  api::WebContents becomes the delegate of, including extension background
  pages, so media/pointer-lock permission checks have a helper to use.
- Return early from SerialChooserContext::RevokePortPermissionWebInitiated
  when the port is no longer known instead of dereferencing end().

(cherry picked from commit 0cfc258)
@trop trop Bot added merged/44-x-y PR was merged to the "44-x-y" branch. and removed in-flight/44-x-y labels Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants