Skip to content

[BUG] Automatic userscript updates might never fire based on user behavior #2838

Description

@chrlsglm

Actual Behavior

Automatic userscript updates check every hour that you meet these 3 conditions & if you do it starts the update:

  1. Your update interval is less than the last time the scripts updated. It resets that time whenever you update ANY script. E.g. clicking to update a single script in the options page.
  2. The user is in a locked state or they haven't made any input for 15 seconds using https://developer.chrome.com/docs/extensions/reference/api/idle#method-queryState
  3. That you don't have any windows open in fullscreen using https://developer.chrome.com/docs/extensions/reference/api/windows#method-getAll

It appears the fullscreen condition was added a long time ago to deal with updates interrupting fullscreen content e.g. Netflix #606

The problem is that on Mac (and likely other operating systems that support multiple virtual desktops) it's possible to always have a browser window open in fullscreen. https://support.apple.com/guide/mac-help/work-in-multiple-spaces-mh14112/mac For example, having a virtual desktop that is just a fullscreen browser that has your email client. I've surveyed several coworkers who never have received script updates (despite having updates enabled) and they use their mac in this way.

Expected Behavior

The fullscreen check should also be checking if the fullscreen browser is also focused. This maintains the intent of avoiding interruptions while providing the opportunity for updates for people who have fullscreen browsers on other desktops. I did a quick check of it with this:

const sleep = ms => new Promise(r => setTimeout(r, ms));

for (let i = 0; i < 10; i++) {
  chrome.windows.getAll({}, wins =>
    console.log(wins.filter(w => w.state === 'fullscreen').map(w => JSON.stringify({ id: w.id, state: w.state, focused: w.focused })))
  );
  await sleep(1000);
}

As a user it's a bit surprising that it's possible that you'll never get your scripts updated even if you have that feature enabled. Even with this change to the fullscreen check in it's possible that some users will still never get an update if they e.g. use their browser heavily throughout the day (and thus getting blocked by the activity check). Personally, I'd expect there to be a limit so that if you went e.g. PERIOD + 2*PERIOD without an update it'll just force the update to happen. Perhaps with an option to turn this off for users who highly value no interruptions and don't care for checking for script updates?

Steps to reproduce the issue

  1. Set the update frequency to every 6 hours.
  2. Open a browser window in fullscreen on mac so it goes to a virtual desktop.
  3. Move back to your main desktop.
  4. Remotely update one of your scripts.
  5. Keep your computer running and you'll see that the script is never updated.
  6. Take the browser window out of fullscreen. Wait and you'll see the update eventually come through.

Screenshots or Screencasts

N/A

Environment (please complete the following information)

  • Browser and Version: Chrome Version 150.0.7871.115 (Official Build) (arm64)
  • Tampermonkey version: 5.5.0
  • Operating System and Version: Mac Version 26.5.2 (25F84)

Script

N/A

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions