Bug 709585 - Part 3/6, Plug mozPower into navigator object. r=sicking
☠☠ backed out by c89909dee64f ☠ ☠
authorKan-Ru Chen <kanru@kanru.info>
Mon, 30 Jan 2012 17:02:46 -0600
changeset 86992 648e5e5b9dd38fa9aad01d72a6cbfb7218f2485f
parent 86991 828713f896011476485e4326f3806757b9ede9f0
child 86993 656500fc5e791f1f4a68935e038671b9f946862b
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs709585
milestone12.0a1
Bug 709585 - Part 3/6, Plug mozPower into navigator object. r=sicking
b2g/installer/package-manifest.in
dom/base/Navigator.cpp
dom/interfaces/base/domstubs.idl
dom/interfaces/base/nsIDOMNavigator.idl
dom/power/test/Makefile.in
dom/power/test/test_power_basics.html
layout/build/Makefile.in
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -157,16 +157,17 @@
 @BINPATH@/components/dom_events.xpt
 @BINPATH@/components/dom_geolocation.xpt
 @BINPATH@/components/dom_network.xpt
 @BINPATH@/components/dom_notification.xpt
 @BINPATH@/components/dom_html.xpt
 @BINPATH@/components/dom_indexeddb.xpt
 @BINPATH@/components/dom_offline.xpt
 @BINPATH@/components/dom_json.xpt
+@BINPATH@/components/dom_power.xpt
 @BINPATH@/components/dom_range.xpt
 @BINPATH@/components/dom_sidebar.xpt
 @BINPATH@/components/dom_sms.xpt
 @BINPATH@/components/dom_storage.xpt
 @BINPATH@/components/dom_stylesheets.xpt
 @BINPATH@/components/dom_threads.xpt
 @BINPATH@/components/dom_traversal.xpt
 @BINPATH@/components/dom_views.xpt
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -934,16 +934,24 @@ Navigator::GetMozBattery(nsIDOMMozBatter
     mBatteryManager->Init(win, scx);
   }
 
   NS_ADDREF(*aBattery = mBatteryManager);
 
   return NS_OK;
 }
 
+NS_IMETHODIMP
+Navigator::GetMozPower(nsIDOMMozPowerManager** aPower)
+{
+  *aPower = nsnull;
+
+  return NS_OK;
+}
+
 //*****************************************************************************
 //    Navigator::nsIDOMNavigatorSms
 //*****************************************************************************
 
 bool
 Navigator::IsSmsAllowed() const
 {
   static const bool defaultSmsPermission = false;
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -124,8 +124,11 @@ interface nsIDOMRange;
 // Crypto
 interface nsIDOMCRMFObject;
 interface nsIDOMCrypto;
 interface nsIDOMPkcs11;
 
 // Used font face (for inspector)
 interface nsIDOMFontFace;
 interface nsIDOMFontFaceList;
+
+// Power
+interface nsIDOMMozPowerManager;
--- a/dom/interfaces/base/nsIDOMNavigator.idl
+++ b/dom/interfaces/base/nsIDOMNavigator.idl
@@ -34,36 +34,37 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "domstubs.idl"
 
-[scriptable, uuid(a1ee08c1-0299-4908-a6ba-7cBc8da6531f)]
+[scriptable, uuid(b1f4b1fa-49c2-4375-9ce8-bf97ecf6b428)]
 interface nsIDOMNavigator : nsISupports
 {
-  readonly attribute DOMString           appCodeName;
-  readonly attribute DOMString           appName;
-  readonly attribute DOMString           appVersion;
-  readonly attribute DOMString           language;
-  readonly attribute nsIDOMMimeTypeArray mimeTypes;
-  readonly attribute DOMString           platform;
-  readonly attribute DOMString           oscpu;
-  readonly attribute DOMString           vendor;
-  readonly attribute DOMString           vendorSub;
-  readonly attribute DOMString           product;
-  readonly attribute DOMString           productSub;
-  readonly attribute nsIDOMPluginArray   plugins;
-  readonly attribute DOMString           userAgent;
-  readonly attribute boolean             cookieEnabled;
-  readonly attribute boolean             onLine;
-  readonly attribute DOMString           buildID;
-  readonly attribute DOMString           doNotTrack;
+  readonly attribute DOMString             appCodeName;
+  readonly attribute DOMString             appName;
+  readonly attribute DOMString             appVersion;
+  readonly attribute DOMString             language;
+  readonly attribute nsIDOMMimeTypeArray   mimeTypes;
+  readonly attribute DOMString             platform;
+  readonly attribute DOMString             oscpu;
+  readonly attribute DOMString             vendor;
+  readonly attribute DOMString             vendorSub;
+  readonly attribute DOMString             product;
+  readonly attribute DOMString             productSub;
+  readonly attribute nsIDOMPluginArray     plugins;
+  readonly attribute DOMString             userAgent;
+  readonly attribute boolean               cookieEnabled;
+  readonly attribute boolean               onLine;
+  readonly attribute DOMString             buildID;
+  readonly attribute DOMString             doNotTrack;
+  readonly attribute nsIDOMMozPowerManager mozPower;
 
   boolean                   javaEnabled();
 
   /**
    * Pulse the device's vibrator, if it has one.  If the device does not have a
    * vibrator, this function does nothing.  If the window is hidden, this
    * function does nothing.
    *
--- a/dom/power/test/Makefile.in
+++ b/dom/power/test/Makefile.in
@@ -44,15 +44,16 @@ relativesrcdir   = dom/power/test
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES = \
+  test_power_basics.html \
   $(NULL)
 
-#libs:: $(_TEST_FILES)
-# 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+libs:: $(_TEST_FILES)
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
 
 #libs:: $(_CHROME_TEST_FILES)
 #	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/dom/power/test/test_power_basics.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for Power API</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Power API **/
+
+ok('mozPower' in navigator, "navigator.mozPower should exist");
+
+</script>
+</pre>
+</body>
+</html>
--- a/layout/build/Makefile.in
+++ b/layout/build/Makefile.in
@@ -88,16 +88,17 @@ SHARED_LIBRARY_LIBS = \
 	$(DEPTH)/content/xslt/src/xml/$(LIB_PREFIX)txxml_s.$(LIB_SUFFIX) \
 	$(DEPTH)/content/xslt/src/xpath/$(LIB_PREFIX)txxpath_s.$(LIB_SUFFIX) \
 	$(DEPTH)/content/xslt/src/xslt/$(LIB_PREFIX)txxslt_s.$(LIB_SUFFIX) \
 	$(DEPTH)/content/xbl/src/$(LIB_PREFIX)gkconxbl_s.$(LIB_SUFFIX) \
 	$(DEPTH)/content/xul/document/src/$(LIB_PREFIX)gkconxuldoc_s.$(LIB_SUFFIX) \
 	$(DEPTH)/view/src/$(LIB_PREFIX)gkview_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/base/$(LIB_PREFIX)jsdombase_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/battery/$(LIB_PREFIX)dom_battery_s.$(LIB_SUFFIX) \
+	$(DEPTH)/dom/power/$(LIB_PREFIX)dom_power_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/network/src/$(LIB_PREFIX)dom_network_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/sms/src/$(LIB_PREFIX)dom_sms_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/events/$(LIB_PREFIX)jsdomevents_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/json/$(LIB_PREFIX)json_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/jsurl/$(LIB_PREFIX)jsurl_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/storage/$(LIB_PREFIX)jsdomstorage_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/offline/$(LIB_PREFIX)jsdomoffline_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/geolocation/$(LIB_PREFIX)jsdomgeolocation_s.$(LIB_SUFFIX) \