Skip to content
Snippets Groups Projects
Closed Possible double-injection of the browser extension content script, resulting in "native integration is already running"
  • View options
  • Possible double-injection of the browser extension content script, resulting in "native integration is already running"

  • View options
  • Closed Issue created by Warren Gifford

    Created by: marekweb

    Sometimes when the browser extension is running, a console message says "Native integration is already running". However, this is misleading because this happens even in cases where there is no native integration running at all.

    This message is produced when the content script detects the extension marker in the page, which indicates that an integration has already been injected into the page (which could be either an instance of the browser extension script, or a native integration). The source of the message is in contentPAge.main.ts

    The intent of the check is to see if a native integration is already present on the page, so that the browser extension can avoid doing duplicate work. It also handles the case where the browser's content script is injected twice (which would be unintended), but in that case, the root problem is the double injection, and also, in that case the reference to "native integration" is misleading.

    Suggested next steps:

    • Change the error message to be less misleading (for the benefit of future debugging). For example: "Browser extension content script aborting; a code host integration (browser extension or native integration) has already been injected."
    • Investigate the reason why the browser extension might be double-injecting the content script. A hypothesis is that we are incorrectly assuming that the "complete" event fired by a tab is only fired once, but maybe it's fired multiple times. (Why do we run executeScript manually instead of injecting via the manifest? Because this is for injecting into optional permissions sites, hence why we check if the site is among the optional permissions before injecting)

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first