Visitar URL original
[BUG] MV3 userscript injection fails in active Vivaldi window after session restoration · Issue #2711 · violentmonkey/violentmonkey · GitHub
Skip to content

[BUG] MV3 userscript injection fails in active Vivaldi window after session restoration #2711

Open

Description

@basel-shishani

Environment

  • Violentmonkey 2.49.0 (MV3)
  • Vivaldi (Chromium 152)
  • Debian 13, GNOME

Steps to reproduce
Prerequisite: An enabled userscript matching https://chatgpt.com/*, with Violentmonkey's default injection settings.
Test 1 — Single window

  1. Open Vivaldi with chatgpt.com and an active matching userscript.
  2. Exit Vivaldi using File → Exit.
  3. Relaunch with Startup with: Last Session.
  4. The script is crossed out with the warning: "Violentmonkey was restarted. Please reload the tab to run userscripts."
  5. Hard reload does not fix it.
  6. Open ChatGPT in a new tab — the script runs normally.

Test 2 — Two windows

  1. Keep the original window (script inactive) and a new window (script active).
  2. With either window focused, select File → Exit.
  3. Relaunch with both windows restored.
  4. The window active when exiting now has the script inactive; the other window has it active.
  5. Repeat with the opposite window active at exit — the inactive state switches accordingly.
  6. Waiting 10–15 seconds does not change the outcome.

Additional observations

  • Restoring a non-matching website (e.g. Google), then navigating to ChatGPT in the same tab works.
  • DevTools captured TypeError: Cannot read properties of undefined (reading 'addListener') in Violentmonkey's injected.js.
  • The extension service worker was running normally when inspected.

Expected behaviour
Matching userscripts should run in all restored windows, including the initially active one.

Possible cause (AI-generated hypothesis)
A race condition involving MV3 extension messaging during Vivaldi's foreground-window restoration. However, the evidence doesn't yet identify whether Vivaldi or Violentmonkey is responsible.

Activity

  1. tophf commented on Oct 20, 2026

    @tophf
    Member

    Since Chrome seems to work correctly I guess it's a Vivaldi-specific bug?

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions