Closed Bug 769571 Opened 8 years ago Closed 8 years ago

Unprefix battery and vibrator APIs

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla16
Tracking Status
firefox16 - ---

People

(Reporter: sicking, Assigned: mounir)

References

Details

(Keywords: dev-doc-complete)

Attachments

(2 files, 2 obsolete files)

No description provided.
Blocks: 678694, 679966
Attached patch Part 1 - Unprefix Battery API (obsolete) — Splinter Review
Assignee: nobody → mounir
Status: NEW → ASSIGNED
Attachment #638124 - Flags: superreview?(bugs)
Attachment #638124 - Flags: review?(jonas)
Attachment #638125 - Flags: superreview?(bugs)
Attachment #638125 - Flags: review?(justin.lebar+bug)
This wasn't mentioned in comment 0 but those two APIs are being unprefixed because they are now at CR state and no major change should now happen.
Attachment #638124 - Flags: review?(jonas) → review+
Comment on attachment 638125 [details] [diff] [review]
Part 2 - Unprefix WebVibrator

r=me, but let's coordinate landing with the Gaia folks so we don't break them too hard.
Attachment #638125 - Flags: review?(justin.lebar+bug) → review+
Comment on attachment 638124 [details] [diff] [review]
Part 1 - Unprefix Battery API

You should remove NavigatorBattery and merge it to Navigator.
Per the spec NavigatorBattery is [NoInterfaceObject]
Attachment #638124 - Flags: superreview?(bugs) → superreview-
Attachment #638125 - Flags: superreview?(bugs) → superreview+
Attached patch Unprefix Battery API (obsolete) — Splinter Review
This is changing the behavior of |navigator.battery| when the pref is disabled.
I haven't write test for that because I am not sure whether we will return |null| as I did or if we should return the default values (like if the device was plugged and fully charged). I would tend for the later because that would prevent failures in websites checking if the object is present by doing |'battery' in navigator|.

I will open a follow-up for that.
Attachment #638124 - Attachment is obsolete: true
Attachment #639011 - Flags: superreview?(bugs)
Comment on attachment 639011 [details] [diff] [review]
Unprefix Battery API

I don't think we should do this.

I missed DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMMozNavigatorBattery,
                                        battery::BatteryManager::HasSupport()) 
earlier, but I think we should rename nsIDOMMozNavigatorBattery to
nsINavigatorBattery so that it doesn't show up in the global scope, yet it
is possible to disable it.
Attachment #639011 - Flags: superreview?(bugs) → superreview-
Attachment #639011 - Attachment is obsolete: true
Attachment #639112 - Flags: superreview?(bugs)
Comment on attachment 639112 [details] [diff] [review]
Unprefix Battery API


> {
>+  if (!battery::BatteryManager::HasSupport()) {
>+    if (mBatteryManager) {
>+      mBatteryManager->Shutdown();
>+      mBatteryManager = nsnull;
>+    }
>+
>+    *aBattery = nsnull;
>+    return NS_OK;
>+  }
>+
Don't make this change.
Attachment #639112 - Flags: superreview?(bugs) → superreview+
Flags: in-testsuite+
Keywords: dev-doc-needed
Target Milestone: --- → mozilla16
Attachment #638125 - Flags: checkin+
Attachment #639112 - Flags: checkin+
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.