Bug 114891

Summary: Battery API won't return updated battery status until client calls didChangeBatteryStatus
Product: WebKit Reporter: otcheung
Component: WebKit APIAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, gyuyoung.kim, kihong.kwon, rwlbuis
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

otcheung
Reported 2013-04-19 15:42:33 PDT
The battery status object in BatteryManager won't get updated until the client calls didChangeBatteryStatus in the controller. If we have a web page that only calls webkitBattery.charge() and there's no update from the client between the creation of addListener(BatteryManager) and the next didChangeBatteryStatus, the BatteryManager will always return the default value because m_batteryStatus is always null. We need to update the manager when we attach it to the controller, and update all existing managers when the controller receives it's first battery status object.
Attachments
Patch (4.08 KB, patch)
2013-04-19 15:57 PDT, otcheung
no flags
otcheung
Comment 1 2013-04-19 15:57:59 PDT
otcheung
Comment 2 2013-04-22 09:02:51 PDT
Hi Kihong, would you be free to take a look at the small fix I made to the battery module?
Kihong Kwon
Comment 3 2013-04-23 02:55:44 PDT
I couldn't see any problem with this and IMO, this is good point. :) But, as you may know, updateBatteryStatus is only for chromium. Therefore if you don't have a plan to use it, this patch is meaningless.
Rob Buis
Comment 4 2013-04-24 13:09:56 PDT
Comment on attachment 198918 [details] Patch LGTM.
otcheung
Comment 5 2013-04-24 13:10:53 PDT
thanks for your help Kihong!
WebKit Commit Bot
Comment 6 2013-04-24 13:37:34 PDT
Comment on attachment 198918 [details] Patch Clearing flags on attachment: 198918 Committed r149063: <http://trac.webkit.org/changeset/149063>
WebKit Commit Bot
Comment 7 2013-04-24 13:37:36 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.