-
Notifications
You must be signed in to change notification settings - Fork 15.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent crash on web-contents creation when error is thrown #28971
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VerteDinde
commented
May 3, 2021
VerteDinde
force-pushed
the
catch-event-emmitter-errors
branch
2 times, most recently
from
May 5, 2021 05:13
91f9dca
to
6637fd9
Compare
VerteDinde
changed the title
fix: prevent crash when exception occurs within the event emitter
fix: prevent crash on web-contents creation when error is thrown
May 5, 2021
zcbenz
approved these changes
May 5, 2021
Can you add test for this? Putting https://gist.github.com/nornagon/2b0373a300af0931c0c29b0e8dff8b73 under |
codebytere
approved these changes
May 5, 2021
@zcbenz Will do! Thanks for reviewing! 🙂 |
ckerr
approved these changes
May 5, 2021
nornagon
approved these changes
May 5, 2021
VerteDinde
force-pushed
the
catch-event-emmitter-errors
branch
from
May 5, 2021 20:31
6637fd9
to
e7a5d89
Compare
nornagon
reviewed
May 5, 2021
spec-main/fixtures/crash-cases/webview-contents-error-on-creation/index.js
Outdated
Show resolved
Hide resolved
VerteDinde
force-pushed
the
catch-event-emmitter-errors
branch
from
May 5, 2021 20:48
ba2ebea
to
98e5080
Compare
MarshallOfSound
requested changes
May 5, 2021
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
VerteDinde
force-pushed
the
catch-event-emmitter-errors
branch
2 times, most recently
from
May 6, 2021 19:29
a40f874
to
7c66202
Compare
VerteDinde
force-pushed
the
catch-event-emmitter-errors
branch
from
May 6, 2021 21:29
7c66202
to
bbfa943
Compare
MarshallOfSound
approved these changes
May 11, 2021
Release Notes Persisted
|
I have automatically backported this PR to "13-x-y", please check out #29106 |
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
Fixes #28749
Currently, if an unhandled error is thrown during web-contents creation on a new browser window within JavaScript's scope, the error is not being correctly bubbled up, causing a DCHECK and hard app crash. More specifically, here are the steps that could lead to a crash (thanks @MarshallOfSound for the breakdown!):
This PR adds Node's exception error handler to the
_init
method for web-contents creation, bubbling the error into a different scope and allowing us to handle it more appropriately, rather than hard crashing.Checklist
npm test
passesRelease Notes
Notes: Fix crash when an exception occurs within the event emitter.