Skip to content

[Bug]: Disabling backgroundThrottling not working with hide() on Windows #31016

@aluo-lmi

Description

@aluo-lmi

Preflight Checklist

Electron Version

14.0.0

What operating system are you using?

Windows

Operating System Version

Windows 10 build 19041.1165

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

On Windows, setting backgroundThrottling: false on a BrowserWindow should cause throttling of things like requestAnimationFrame to not happen when the window is occluded, minimized, or hidden.

Actual Behavior

On Windows, setting backgroundThrottling: false on a BrowserWindow causes throttling of things like requestAnimationFrame to not happen when the window is occluded or minimized but not hidden. On MacOS (v11.5.2 Intel x64) disabling backgroundThrottling causes requestAnimatingFrames to continue to work for all 3 cases -- occluded, minmized, and hidden. This is the reason I think this might be a bug on Windows.

Testcase Gist URL

https://gist.github.com/aluo-lmi/e8be4e6f23f5eca831fad332a810f99f

Additional Information

Steps for repro on gist:

  1. Start gist in electron (fiddle), open dev console and pop it out -> observe the tick being logged twice per second as callbacks to requestAnimationFrame calls
  2. Occlude the window, minimize the window, or click Hide for 5s -> observe the tick stops being logged in all 3 cases
  3. Click Toggle background throttling button
  4. Occlude or minimize the window -> observe the tick does not stop being logged
  5. Click Hide for 5s -> On Windows, observe the tick stops being logged during the 5s the window is hidden, indicating the requestAnimationFrame callbacks are being blocked. On Mac, observe the tick continue to be logged indicating they are not.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions