Home / Function/ dynamicallyInjectContentScripts() — react Function Reference

dynamicallyInjectContentScripts() — react Function Reference

Architecture documentation for the dynamicallyInjectContentScripts() function in dynamicallyInjectContentScripts.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  1132bec2_7773_7e24_f92c_e9c3a307c121["dynamicallyInjectContentScripts()"]
  fe7f3f36_186a_b5fa_46a3_1c8b67d7534d["dynamicallyInjectContentScripts.js"]
  1132bec2_7773_7e24_f92c_e9c3a307c121 -->|defined in| fe7f3f36_186a_b5fa_46a3_1c8b67d7534d
  style 1132bec2_7773_7e24_f92c_e9c3a307c121 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-extensions/src/background/dynamicallyInjectContentScripts.js lines 45–60

async function dynamicallyInjectContentScripts() {
  try {
    // Using this, instead of filtering registered scrips with `chrome.scripting.getRegisteredScripts`
    // because of https://bugs.chromium.org/p/chromium/issues/detail?id=1393762
    // This fixes registering proxy content script in incognito mode
    await chrome.scripting.unregisterContentScripts();

    // Note: the "world" option in registerContentScripts is only available in Chrome v102+
    // It's critical since it allows us to directly run scripts on the "main" world on the page
    // "document_start" allows it to run before the page's scripts
    // so the hook can be detected by react reconciler
    await chrome.scripting.registerContentScripts(contentScriptsToInject);
  } catch (error) {
    console.error(error);
  }
}

Domain

Subdomains

Frequently Asked Questions

What does dynamicallyInjectContentScripts() do?
dynamicallyInjectContentScripts() is a function in the react codebase, defined in packages/react-devtools-extensions/src/background/dynamicallyInjectContentScripts.js.
Where is dynamicallyInjectContentScripts() defined?
dynamicallyInjectContentScripts() is defined in packages/react-devtools-extensions/src/background/dynamicallyInjectContentScripts.js at line 45.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free