Bug 769571 - Unprefix Battery API. r=sicking sr=smaug

--HG--
rename : dom/battery/nsIDOMNavigatorBattery.idl => dom/battery/nsINavigatorBattery.idl
This commit is contained in:
Mounir Lamouri 2012-07-05 12:05:09 +02:00
parent c84d60f166
commit 76d382c04f
12 changed files with 27 additions and 34 deletions

View File

@ -98,7 +98,7 @@ NS_INTERFACE_MAP_BEGIN(Navigator)
NS_INTERFACE_MAP_ENTRY(nsIDOMClientInformation) NS_INTERFACE_MAP_ENTRY(nsIDOMClientInformation)
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorDeviceStorage) NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorDeviceStorage)
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorGeolocation) NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorGeolocation)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozNavigatorBattery) NS_INTERFACE_MAP_ENTRY(nsINavigatorBattery)
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorDesktopNotification) NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorDesktopNotification)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozNavigatorSms) NS_INTERFACE_MAP_ENTRY(nsIDOMMozNavigatorSms)
#ifdef MOZ_MEDIA_NAVIGATOR #ifdef MOZ_MEDIA_NAVIGATOR
@ -1002,11 +1002,11 @@ NS_IMETHODIMP Navigator::GetMozNotification(nsIDOMDesktopNotificationCenter** aR
} }
//***************************************************************************** //*****************************************************************************
// Navigator::nsIDOMNavigatorBattery // Navigator::nsINavigatorBattery
//***************************************************************************** //*****************************************************************************
NS_IMETHODIMP NS_IMETHODIMP
Navigator::GetMozBattery(nsIDOMMozBatteryManager** aBattery) Navigator::GetBattery(nsIDOMBatteryManager** aBattery)
{ {
if (!mBatteryManager) { if (!mBatteryManager) {
*aBattery = nsnull; *aBattery = nsnull;

View File

@ -12,7 +12,7 @@
#include "nsIDOMNavigatorDeviceStorage.h" #include "nsIDOMNavigatorDeviceStorage.h"
#include "nsIDOMNavigatorDesktopNotification.h" #include "nsIDOMNavigatorDesktopNotification.h"
#include "nsIDOMClientInformation.h" #include "nsIDOMClientInformation.h"
#include "nsIDOMNavigatorBattery.h" #include "nsINavigatorBattery.h"
#include "nsIDOMNavigatorSms.h" #include "nsIDOMNavigatorSms.h"
#include "nsIDOMNavigatorNetwork.h" #include "nsIDOMNavigatorNetwork.h"
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
@ -69,7 +69,7 @@ class Navigator : public nsIDOMNavigator
, public nsIDOMNavigatorDeviceStorage , public nsIDOMNavigatorDeviceStorage
, public nsIDOMNavigatorGeolocation , public nsIDOMNavigatorGeolocation
, public nsIDOMNavigatorDesktopNotification , public nsIDOMNavigatorDesktopNotification
, public nsIDOMMozNavigatorBattery , public nsINavigatorBattery
, public nsIDOMMozNavigatorSms , public nsIDOMMozNavigatorSms
#ifdef MOZ_MEDIA_NAVIGATOR #ifdef MOZ_MEDIA_NAVIGATOR
, public nsIDOMNavigatorUserMedia , public nsIDOMNavigatorUserMedia
@ -93,7 +93,7 @@ public:
NS_DECL_NSIDOMNAVIGATORDEVICESTORAGE NS_DECL_NSIDOMNAVIGATORDEVICESTORAGE
NS_DECL_NSIDOMNAVIGATORGEOLOCATION NS_DECL_NSIDOMNAVIGATORGEOLOCATION
NS_DECL_NSIDOMNAVIGATORDESKTOPNOTIFICATION NS_DECL_NSIDOMNAVIGATORDESKTOPNOTIFICATION
NS_DECL_NSIDOMMOZNAVIGATORBATTERY NS_DECL_NSINAVIGATORBATTERY
NS_DECL_NSIDOMMOZNAVIGATORSMS NS_DECL_NSIDOMMOZNAVIGATORSMS
#ifdef MOZ_MEDIA_NAVIGATOR #ifdef MOZ_MEDIA_NAVIGATOR
NS_DECL_NSIDOMNAVIGATORUSERMEDIA NS_DECL_NSIDOMNAVIGATORUSERMEDIA

View File

@ -1454,7 +1454,7 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(GeoPositionError, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(GeoPositionError, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS) DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(MozBatteryManager, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(BatteryManager, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS) DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(MozPowerManager, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(MozPowerManager, nsDOMGenericSH,
@ -2471,7 +2471,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMNavigatorDesktopNotification, DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMNavigatorDesktopNotification,
Navigator::HasDesktopNotificationSupport()) Navigator::HasDesktopNotificationSupport())
DOM_CLASSINFO_MAP_ENTRY(nsIDOMClientInformation) DOM_CLASSINFO_MAP_ENTRY(nsIDOMClientInformation)
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMMozNavigatorBattery, DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsINavigatorBattery,
battery::BatteryManager::HasSupport()) battery::BatteryManager::HasSupport())
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozNavigatorSms) DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozNavigatorSms)
#ifdef MOZ_MEDIA_NAVIGATOR #ifdef MOZ_MEDIA_NAVIGATOR
@ -4105,8 +4105,8 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMGeoPositionError) DOM_CLASSINFO_MAP_ENTRY(nsIDOMGeoPositionError)
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(MozBatteryManager, nsIDOMMozBatteryManager) DOM_CLASSINFO_MAP_BEGIN(BatteryManager, nsIDOMBatteryManager)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozBatteryManager) DOM_CLASSINFO_MAP_ENTRY(nsIDOMBatteryManager)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END

View File

@ -397,7 +397,7 @@ DOMCI_CLASS(GeoPosition)
DOMCI_CLASS(GeoPositionCoords) DOMCI_CLASS(GeoPositionCoords)
DOMCI_CLASS(GeoPositionError) DOMCI_CLASS(GeoPositionError)
DOMCI_CLASS(MozBatteryManager) DOMCI_CLASS(BatteryManager)
DOMCI_CLASS(MozPowerManager) DOMCI_CLASS(MozPowerManager)
DOMCI_CLASS(MozWakeLock) DOMCI_CLASS(MozWakeLock)

View File

@ -21,7 +21,7 @@
#define DISCHARGINGTIMECHANGE_EVENT_NAME NS_LITERAL_STRING("dischargingtimechange") #define DISCHARGINGTIMECHANGE_EVENT_NAME NS_LITERAL_STRING("dischargingtimechange")
#define CHARGINGTIMECHANGE_EVENT_NAME NS_LITERAL_STRING("chargingtimechange") #define CHARGINGTIMECHANGE_EVENT_NAME NS_LITERAL_STRING("chargingtimechange")
DOMCI_DATA(MozBatteryManager, mozilla::dom::battery::BatteryManager) DOMCI_DATA(BatteryManager, mozilla::dom::battery::BatteryManager)
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@ -46,8 +46,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(BatteryManager,
NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(BatteryManager) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(BatteryManager)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozBatteryManager) NS_INTERFACE_MAP_ENTRY(nsIDOMBatteryManager)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozBatteryManager) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(BatteryManager)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper) NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(BatteryManager, nsDOMEventTargetHelper) NS_IMPL_ADDREF_INHERITED(BatteryManager, nsDOMEventTargetHelper)

View File

@ -26,12 +26,12 @@ namespace dom {
namespace battery { namespace battery {
class BatteryManager : public nsDOMEventTargetHelper class BatteryManager : public nsDOMEventTargetHelper
, public nsIDOMMozBatteryManager , public nsIDOMBatteryManager
, public BatteryObserver , public BatteryObserver
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIDOMMOZBATTERYMANAGER NS_DECL_NSIDOMBATTERYMANAGER
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::) NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
BatteryManager(); BatteryManager();

View File

@ -33,7 +33,7 @@ LOCAL_INCLUDES = \
XPIDLSRCS = \ XPIDLSRCS = \
nsIDOMBatteryManager.idl \ nsIDOMBatteryManager.idl \
nsIDOMNavigatorBattery.idl \ nsINavigatorBattery.idl \
$(NULL) $(NULL)
TEST_DIRS += test TEST_DIRS += test

View File

@ -6,8 +6,8 @@
interface nsIDOMEventListener; interface nsIDOMEventListener;
[scriptable, builtinclass, uuid(41e88f87-42cb-4db1-8724-f5456a16c410)] [scriptable, builtinclass, uuid(03c6dd20-7efd-4640-b958-c0ce11b9aadf)]
interface nsIDOMMozBatteryManager : nsIDOMEventTarget interface nsIDOMBatteryManager : nsIDOMEventTarget
{ {
readonly attribute double level; readonly attribute double level;
readonly attribute boolean charging; readonly attribute boolean charging;

View File

@ -4,10 +4,10 @@
#include "nsISupports.idl" #include "nsISupports.idl"
interface nsIDOMMozBatteryManager; interface nsIDOMBatteryManager;
[scriptable, uuid(c295f049-be3d-4f83-9f7c-5c3e91d6ecb9)] [scriptable, uuid(4a78a8d5-5bbb-4a92-ad97-f19e853a7008)]
interface nsIDOMMozNavigatorBattery : nsISupports interface nsINavigatorBattery : nsISupports
{ {
readonly attribute nsIDOMMozBatteryManager mozBattery; readonly attribute nsIDOMBatteryManager battery;
}; };

View File

@ -3,7 +3,7 @@
MARIONETTE_TIMEOUT = 10000; MARIONETTE_TIMEOUT = 10000;
let battery = window.navigator.mozBattery; let battery = window.navigator.battery;
ok(battery); ok(battery);
/** /**

View File

@ -14,15 +14,9 @@
/** Test for Battery API **/ /** Test for Battery API **/
// Testing prefixing. ok('battery' in navigator, "navigator.battery should exist");
ok(!("NavigatorBattery" in window), "NavigatorBattery shouldn't be visible");
ok(("MozNavigatorBattery" in window), "MozNavigatorBattery should be visible");
ok(!("BatteryManager" in window), "BatteryManager shouldn't be visible");
ok(("MozBatteryManager" in window), "MozBatteryManager should be visible");
ok('mozBattery' in navigator, "navigator.mozBattery should exist"); var battery = navigator.battery;
var battery = navigator.mozBattery;
is(battery.level, 1.0, "Default battery level should be 1.0"); is(battery.level, 1.0, "Default battery level should be 1.0");
is(battery.charging, true, "Default charging value should be true"); is(battery.charging, true, "Default charging value should be true");
is(battery.dischargingTime, Infinity, "Default dischargingTime should be Inifinity"); is(battery.dischargingTime, Infinity, "Default dischargingTime should be Inifinity");

View File

@ -25,7 +25,7 @@ var interfaceNamesInGlobalScope =
"MozApplicationEvent", "MozApplicationEvent",
"HTMLByteRanges", "HTMLByteRanges",
"URL", "URL",
"MozBatteryManager", "BatteryManager",
"HTMLStyleElement", "HTMLStyleElement",
"PropertyNodeList", "PropertyNodeList",
"SVGPatternElement", "SVGPatternElement",
@ -324,7 +324,6 @@ var interfaceNamesInGlobalScope =
"Navigator", "Navigator",
"SVGPathSegCurvetoQuadraticSmoothAbs", "SVGPathSegCurvetoQuadraticSmoothAbs",
"HTMLButtonElement", "HTMLButtonElement",
"MozNavigatorBattery",
"WebGLProgram", "WebGLProgram",
"SVGPointList", "SVGPointList",
"SVGFEColorMatrixElement", "SVGFEColorMatrixElement",