Skip to content

Seems like page-visibility option on BrowserWindow is broken #3225

Closed

Description

@nathansobo

In Electron 0.34.0, it doesn't seem like my page-visibility setting is being honored. I'm using it here to ensure test windows continue running tests even if they're in the background. It was working, but now it doesn't seem to be.

Activity

  1. zcbenz commented on Oct 27, 2015

    @zcbenz
    Contributor

    It seems that from Chrome 45 setting page-visibility doesn't prevent performance throttling any more, can you try using the --disable-renderer-backgrounding command line switch?

    app.commandLine.appendSwitch("disable-renderer-backgrounding");

    Refs #2822.

  2. added
    blocked/need-info ❌
    on Oct 27, 2015
  3. nathansobo commented on Nov 1, 2015

    @nathansobo
    Author

    Is this something that can be done for just a test window or is it application-wide?

  4. zcbenz commented on Nov 2, 2015

    @zcbenz
    Contributor

    This flag is application-wide, you can append it before creating the test window so normal users won't be affected, but the windows created after that will still be affected though.

    From the source code the only way to prevent only one window being put into background is to keep playing audio in the page.

  5. nathansobo commented on Nov 6, 2015

    @nathansobo
    Author

    One more question... is it possible to only append a flag for a single window's render process?

  6. zcbenz commented on Nov 7, 2015

    @zcbenz
    Contributor

    Yeah it is possible for renderer process, but --disable-renderer-backgrounding is read in the main process.

    Playing audio is not a so bad option though, it can be done by creating an empty audio on the fly.

  7. nathansobo commented on Nov 7, 2015

    @nathansobo
    Author

    ⚡ Tried the audio hack. Seems to work. Thanks a ton for that idea!

  8. nathansobo commented on Nov 8, 2015

    @nathansobo
    Author

    I'm still getting timeout failures on CI where animation frames aren't firing. Am I doing the sound thing wrong? I thought it was preventing throttling locally but maybe I was mistaken: https://github.com/atom/atom/pull/9485/files

  9. zcbenz commented on Nov 9, 2015

    @zcbenz
    Contributor

    It seems that Chrome had a bug that it doesn't update the background information immediately when audio starts/stops, and it got fixed very recently, I think we are hitting this bug. The --disable-renderer-backgrounding switch seems to be our only option.

  10. nathansobo commented on Nov 10, 2015

    @nathansobo
    Author

    I'm actually seeing that it's working locally. Running audio as I did in the above PR causes tests to complete in the background locally. I am seeing 20 second animation frames on CI regardless of the throtlling settings, either with the flag or the audio hack. For now I just increased the timeout, but it would be nice to know why these frames are taking so long.

  11. nathansobo commented on Nov 20, 2015

    @nathansobo
    Author

    @zcbenz Can you reference me to the relevant location in the Chromium source so I can open an issue on the Chromium bug tracker. After talking to some developers at the Chrome Dev Summit it seems like this is something they care about correcting.

  12. zenorocha commented on Dec 12, 2015

    @zenorocha

    Thanks for sharing your solution @zcbenz!

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

    blocked/need-info ❌

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions