Last Comment Bug 769571 - Unprefix battery and vibrator APIs
: Unprefix battery and vibrator APIs
Status: RESOLVED FIXED
: dev-doc-complete
Product: Core
Classification: Components
Component: DOM (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla16
Assigned To: Mounir Lamouri (:mounir)
:
Mentors:
Depends on:
Blocks: 678694 679966
  Show dependency treegraph
 
Reported: 2012-06-29 01:52 PDT by Jonas Sicking (:sicking) PTO Until July 5th
Modified: 2012-12-19 08:28 PST (History)
11 users (show)
mounir: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
-


Attachments
Part 1 - Unprefix Battery API (12.98 KB, patch)
2012-06-30 10:44 PDT, Mounir Lamouri (:mounir)
jonas: review+
bugs: superreview-
Details | Diff | Review
Part 2 - Unprefix WebVibrator (6.15 KB, patch)
2012-06-30 10:49 PDT, Mounir Lamouri (:mounir)
justin.lebar+bug: review+
bugs: superreview+
mounir: checkin+
Details | Diff | Review
Unprefix Battery API (17.05 KB, patch)
2012-07-04 02:40 PDT, Mounir Lamouri (:mounir)
bugs: superreview-
Details | Diff | Review
Unprefix Battery API (15.11 KB, patch)
2012-07-04 08:39 PDT, Mounir Lamouri (:mounir)
bugs: superreview+
mounir: checkin+
Details | Diff | Review

Description Jonas Sicking (:sicking) PTO Until July 5th 2012-06-29 01:52:11 PDT

    
Comment 1 Mounir Lamouri (:mounir) 2012-06-30 10:44:17 PDT
Created attachment 638124 [details] [diff] [review]
Part 1 - Unprefix Battery API
Comment 2 Mounir Lamouri (:mounir) 2012-06-30 10:49:18 PDT
Created attachment 638125 [details] [diff] [review]
Part 2 - Unprefix WebVibrator
Comment 3 Mounir Lamouri (:mounir) 2012-06-30 10:50:32 PDT
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.
Comment 4 Justin Lebar (not reading bugmail) 2012-07-02 03:42:32 PDT
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.
Comment 5 Vivien Nicolas (:vingtetun) (:21) - (NOT reading bugmails, needinfo? please) 2012-07-02 03:52:25 PDT
Thanks for keeping us up to date! We will land https://github.com/mozilla-b2g/gaia/pull/2107 once this has landed.
Comment 6 Olli Pettay [:smaug] (high review load, please consider other reviewers) 2012-07-04 02:01:28 PDT
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]
Comment 7 Mounir Lamouri (:mounir) 2012-07-04 02:40:36 PDT
Created attachment 639011 [details] [diff] [review]
Unprefix Battery API

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.
Comment 8 Olli Pettay [:smaug] (high review load, please consider other reviewers) 2012-07-04 03:34:35 PDT
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.
Comment 9 Mounir Lamouri (:mounir) 2012-07-04 08:39:36 PDT
Created attachment 639112 [details] [diff] [review]
Unprefix Battery API
Comment 10 Olli Pettay [:smaug] (high review load, please consider other reviewers) 2012-07-04 08:46:46 PDT
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.

Note You need to log in before you can comment on or make changes to this bug.