After closing devtools, the window.postMessage call in backend.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 issue This is an expected behavior, likely not triggered on initial setup due to a race condition
this only happens when devtools are closed (the logic that filters out self from the triggers for window.on('message') breaks down only in this case)
packages/shell-chrome/src/backend.js is the only file in shell-chrome where a window.postMessage is triggered as a fallback on a window.on('message') listener, so no other places have this issue
shell-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 there
What is the purpose of this pull request?
[x] Bug fix
[ ] New Feature
[ ] Documentation update
[ ] Other
Before submitting the PR, please make sure you do the following
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
).