Skip to content

fix: crash when setWindowOpenHandler callback throws - #34523

Merged
jkleinsc merged 2 commits into
mainfrom
fix-handler-throw
Jun 14, 2022
Merged

fix: crash when setWindowOpenHandler callback throws#34523
jkleinsc merged 2 commits into
mainfrom
fix-handler-throw

Conversation

@codebytere

Copy link
Copy Markdown
Member

Description of Change

Closes #34508.

Fixes an error where setWindowOpenHandler() would crash if the callback threw an error. Fix this issue by wrapping the call in a try/catch and handling appropriately if an error is thrown.

Checklist

Release Notes

Notes: Fixed an error where setWindowOpenHandler() would crash if the callback threw an error

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/18-x-y labels Jun 13, 2022
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Jun 13, 2022
@codebytere codebytere changed the title fix: crash when setWindowOpenHandler throws fix: crash when setWindowOpenHandler callback throws Jun 13, 2022
Comment thread lib/browser/api/web-contents.ts Outdated
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Jun 14, 2022
@jkleinsc
jkleinsc merged commit bed38e0 into main Jun 14, 2022
@jkleinsc
jkleinsc deleted the fix-handler-throw branch June 14, 2022 16:22
@release-clerk

release-clerk Bot commented Jun 14, 2022

Copy link
Copy Markdown

Release Notes Persisted

Fixed an error where setWindowOpenHandler() would crash if the callback threw an error

@trop

trop Bot commented Jun 14, 2022

Copy link
Copy Markdown
Contributor

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

@trop

trop Bot commented Jun 14, 2022

Copy link
Copy Markdown
Contributor

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

@trop

trop Bot commented Jun 14, 2022

Copy link
Copy Markdown
Contributor

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

@trop

trop Bot commented Jun 19, 2022

Copy link
Copy Markdown
Contributor

@miniak has manually backported this PR to "18-x-y", please check out #34627

zcbenz pushed a commit that referenced this pull request Jun 20, 2022
fix: crash when `setWindowOpenHandler` callback throws (#34523)

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
@trop

trop Bot commented Jun 28, 2022

Copy link
Copy Markdown
Contributor

@miniak has manually backported this PR to "17-x-y", please check out #34772

VerteDinde pushed a commit that referenced this pull request Jun 29, 2022
fix: crash when `setWindowOpenHandler` callback throws (#34523)
khalwa pushed a commit to solarwindscloud/electron that referenced this pull request Feb 22, 2023
* fix: crash when setWindowOpenHandler throws

* refactor: throw as process uncaughtException event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Unhandled exception in webcontents.setWindowOpenHandler crashes application

5 participants