Closed Bug 1657043 Opened 6 months ago Closed 5 months ago

Use new WinAPI to implement wakelock on Windows

Categories

(Core :: Audio/Video, task, P3)

Unspecified
Windows
task

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: alwu, Assigned: alwu, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

This bug is a follow-up for bug1584319 where the reporter still encouter an issue where firefox can't prevent computer from sleeping correctly.

I guess using new API [1] to replace the current one we use [2] would probably help.

[1] https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-powersetrequest
[2] https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate

Attachment #9167812 - Attachment description: Bug 1657043 - part3 : implement a new wakelock listener with newer API. → Bug 1657043 - part3 : implement a new wakelock listener with new API.

Here is the final version of Firefox with fix [1], feel free to try it to see if it works for you.

[1] https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/cAOWiSVBTFWtx9kKkO9iBA/runs/0/artifacts/public/build/install/sea/target.installer.exe

Flags: needinfo?(xotyl)

Nailed it at last! Congrats on the concerted effort. Looking forward to the fix in the general release. This case (hopefully) is closed.

Flags: needinfo?(xotyl)
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/030d09ee2344
part1 : only use wakelock listener in chrome process. r=jmathies
https://hg.mozilla.org/integration/autoland/rev/0ade1752db2e
part2 : rename listener to legacy listener. r=jmathies
https://hg.mozilla.org/integration/autoland/rev/fb4bcbf62691
part3 : implement a new wakelock listener with new API. r=jmathies
Blocks: wakelock

There may be a new bug here. I have a pinned tab for Gmail. Someone messaged me on Hangouts, which played a sound on that Gmail tab, at around 6 P.M.. I locked my computer and went to bed around 10:30 P.M. without receiving any more messages in Hangouts. I woke up this morning to find that my computer had not gone to sleep last night. I checked powercfg and discovered that FF had a request to prevent sleep. After some internet searches, I was led here. I checked powercfg again, and Firefox was still holding a wake-lock. I closed that Gmail tab and checked powercfg a third time, and Firefox had released the wake-lock.

I'm not sure where the disconnect broke down. Maybe it's Gmail's fault, e.g. once it starts playing a sound it doesn't release whatever flag/lock it holds that tells Firefox that it's done playing audio for now. But, either way, this is a disappointing experience.

FF: 82.0.3
Windows: Pro 10.0.19041

Hi, could you file a new bug for your issue and paste what you saw in powercfg to the new bug? (and NI me on that bug)
It would be great to use a different bug to track new issue, instead of mixing all issues in the same bug.
Thank you so much.

Flags: needinfo?(RedditsCoooookieCrisp)
You need to log in before you can comment on or make changes to this bug.