Skip to content
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: chrome crashing on closing dev tools (fix #2103) #2148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tiagoroldao
Copy link

@tiagoroldao tiagoroldao commented Mar 21, 2024

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 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?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chrome effectively freezes when closing its dev tools and Vue Devtools is installed
1 participant