Closed Bug 1657043 Opened 6 months ago Closed 5 months ago

Use new WinAPI to implement wakelock on Windows


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




81 Branch
Tracking Status
firefox81 --- fixed


(Reporter: alwu, Assigned: alwu, NeedInfo)


(Blocks 1 open bug)



(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.


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.


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
part1 : only use wakelock listener in chrome process. r=jmathies
part2 : rename listener to legacy listener. r=jmathies
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.