Skip to content

[DevTools Bug]: sayHelloToBackendManager continuously and pointlessly polls on every page #27992

Open

Description

@sneakers-the-rat

Website or app

(all sites)

Repro steps

From any page:

const printMessage = (event) => {console.log(event)};
window.addEventListener('message', printMessage);

Since there isn't a place to actually describe the bug, i'll put it here:
sayHelloToBackendManager is set to poll here until backendInitialized is true: https://github.com/facebook/react/blob/b3003047101b4c7a643788a8faf576f7e370fb45/packages/react-devtools-extensions/src/contentScripts/proxy.js#L17-L23

The polling message has a source react-devtools-content-script: https://github.com/facebook/react/blob/b3003047101b4c7a643788a8faf576f7e370fb45/packages/react-devtools-extensions/src/contentScripts/proxy.js#L41

The switch to set backendInitialized = true checks for the message source react-devtools-bridge: https://github.com/facebook/react/blob/b3003047101b4c7a643788a8faf576f7e370fb45/packages/react-devtools-extensions/src/contentScripts/proxy.js#L65-L66

the react-devtools-bridge sourced message is sent from the backend by whatever invokes this: https://github.com/facebook/react/blob/b3003047101b4c7a643788a8faf576f7e370fb45/packages/react-devtools-extensions/src/contentScripts/backendManager.js#L127

but the handleMessageFromPage function returns if the event.source isn't the window object of the page. Presumably the backend does not have the same window object as the page, or else using postMessage() would be pointless: https://github.com/facebook/react/blob/b3003047101b4c7a643788a8faf576f7e370fb45/packages/react-devtools-extensions/src/contentScripts/proxy.js#L59

The 'react-devtools-bridge' message never flips backendInitialized = true, so the polling never terminates.

This is causing the bitwarden ppl to get a decent amount of heat, and it's actually devtools causing the problem - bitwarden/clients#7575

How often does this bug happen?

Every time

DevTools package (automated)

No response

DevTools version (automated)

No response

Error message (automated)

No response

Error call stack (automated)

No response

Error component stack (automated)

No response

GitHub query string (automated)

No response

Activity

  1. added
    Status: Unconfirmed
    on Jan 18, 2024
  2. Nathan-Roberts123 commented on Jan 25, 2024

    @Nathan-Roberts123

    I don't think that the problem bitwarden/clients#7575 should be fix here in the react source code, because the problem is in the bitwarden source code.

  3. sneakers-the-rat commented on Jan 25, 2024

    @sneakers-the-rat
    Author

    the bug in bitwarden revealed a bug in devtools. they are both bugs.

  4. ctrble commented on Apr 2, 2024

    @ctrble

    I think this is related to #28323. The site I'm testing on is private and I can't share a repro (sorry!), but this issue describes our situation exactly. It's not a React site and the only extension I have running is the React dev tools. When I disable the extension the message and memory leak both go away.

    I'm on a Mac running Chrome Version 123.0.6312.87 (Official Build) (arm64).

    Screen Shot 2024-04-02 at 11 26 11 AM
  5. aescobaricc commented on Apr 13, 2024

    @aescobaricc

    if you are using chrome

    • go to:
      chrome://extensions/

    • pick
      React Developer Tools

    • set option:
      Site access
      Allow this extension to read and change all your data on websites you visit: On Click

    Screenshot 2024-04-12 at 20 49 33

  6. SoCuul commented on Mar 19, 2025

    @SoCuul

    This is still happening on every site, sending constant messages on every single page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: Developer ToolsStatus: UnconfirmedType: Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions