fix: chrome crashing on closing dev tools (fix #2103) #2148
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
Fixes #2103
When closing devtools, an infinite loop is triggered by the line:
https://github.com/vuejs/devtools/blob/963ff7fe1470aa5b2a93a8a8afadc57fa3c38676/packages/shell-chrome/src/backend.js#L47
After closing devtools, the
window.postMessage
call inbackend.js
triggers the event listener in the same file, and as the reaction to a message is to postMessage back, an infinite loop is triggered this way.Additional context
To the best of my knowledge:
this should not happen, and is likely a Chromium issueThis is an expected behavior, likely not triggered on initial setup due to a race conditionwindow.on('message')
breaks down only in this case)packages/shell-chrome/src/backend.js
is the only file inshell-chrome
where awindow.postMessage
is triggered as a fallback on awindow.on('message')
listener, so no other places have this issueshell-firefox
uses the same (duplicated) code, so this change may be warranted there - at worse it will do nothing, and will prevent any situation where, due to changes in event order, this bug would manifest thereWhat is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).