Bug 701517 - Moz-prefix Battery API interfaces. rs+sr=smaug

This commit is contained in:
Mounir Lamouri 2011-11-19 11:43:57 +01:00
Родитель cbc023ee10
Коммит e5ab052440
9 изменённых файлов: 26 добавлений и 20 удалений

Просмотреть файл

@ -113,7 +113,7 @@ NS_INTERFACE_MAP_BEGIN(Navigator)
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigator) NS_INTERFACE_MAP_ENTRY(nsIDOMNavigator)
NS_INTERFACE_MAP_ENTRY(nsIDOMClientInformation) NS_INTERFACE_MAP_ENTRY(nsIDOMClientInformation)
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorGeolocation) NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorGeolocation)
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorBattery) NS_INTERFACE_MAP_ENTRY(nsIDOMMozNavigatorBattery)
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorDesktopNotification) NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorDesktopNotification)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Navigator) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Navigator)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
@ -746,7 +746,7 @@ NS_IMETHODIMP Navigator::GetMozNotification(nsIDOMDesktopNotificationCenter** aR
//***************************************************************************** //*****************************************************************************
NS_IMETHODIMP NS_IMETHODIMP
Navigator::GetMozBattery(nsIDOMBatteryManager** aBattery) Navigator::GetMozBattery(nsIDOMMozBatteryManager** aBattery)
{ {
if (!mBatteryManager) { if (!mBatteryManager) {
*aBattery = nsnull; *aBattery = nsnull;

Просмотреть файл

@ -71,7 +71,7 @@ class Navigator : public nsIDOMNavigator,
public nsIDOMClientInformation, public nsIDOMClientInformation,
public nsIDOMNavigatorGeolocation, public nsIDOMNavigatorGeolocation,
public nsIDOMNavigatorDesktopNotification, public nsIDOMNavigatorDesktopNotification,
public nsIDOMNavigatorBattery public nsIDOMMozNavigatorBattery
{ {
public: public:
Navigator(nsIDocShell *aDocShell); Navigator(nsIDocShell *aDocShell);
@ -82,7 +82,7 @@ public:
NS_DECL_NSIDOMCLIENTINFORMATION NS_DECL_NSIDOMCLIENTINFORMATION
NS_DECL_NSIDOMNAVIGATORGEOLOCATION NS_DECL_NSIDOMNAVIGATORGEOLOCATION
NS_DECL_NSIDOMNAVIGATORDESKTOPNOTIFICATION NS_DECL_NSIDOMNAVIGATORDESKTOPNOTIFICATION
NS_DECL_NSIDOMNAVIGATORBATTERY NS_DECL_NSIDOMMOZNAVIGATORBATTERY
static void Init(); static void Init();

Просмотреть файл

@ -1385,7 +1385,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(BatteryManager, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(MozBatteryManager, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS) DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsDOMGenericSH,
@ -2287,7 +2287,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(nsIDOMNavigatorBattery, DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMMozNavigatorBattery,
battery::BatteryManager::HasSupport()) battery::BatteryManager::HasSupport())
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END
@ -3866,8 +3866,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(BatteryManager, nsIDOMBatteryManager) DOM_CLASSINFO_MAP_BEGIN(MozBatteryManager, nsIDOMMozBatteryManager)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMBatteryManager) DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozBatteryManager)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END

Просмотреть файл

@ -426,7 +426,7 @@ DOMCI_CLASS(GeoPositionCoords)
DOMCI_CLASS(GeoPositionAddress) DOMCI_CLASS(GeoPositionAddress)
DOMCI_CLASS(GeoPositionError) DOMCI_CLASS(GeoPositionError)
DOMCI_CLASS(BatteryManager) DOMCI_CLASS(MozBatteryManager)
// @font-face in CSS // @font-face in CSS
DOMCI_CLASS(CSSFontFaceRule) DOMCI_CLASS(CSSFontFaceRule)

Просмотреть файл

@ -52,7 +52,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(BatteryManager, mozilla::dom::battery::BatteryManager) DOMCI_DATA(MozBatteryManager, mozilla::dom::battery::BatteryManager)
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@ -77,8 +77,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(nsIDOMBatteryManager) NS_INTERFACE_MAP_ENTRY(nsIDOMMozBatteryManager)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(BatteryManager) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozBatteryManager)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache) NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
NS_IMPL_ADDREF_INHERITED(BatteryManager, nsDOMEventTargetWrapperCache) NS_IMPL_ADDREF_INHERITED(BatteryManager, nsDOMEventTargetWrapperCache)

Просмотреть файл

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

Просмотреть файл

@ -38,8 +38,8 @@
interface nsIDOMEventListener; interface nsIDOMEventListener;
[scriptable, function, uuid(6dcb803b-e968-4c02-88f5-049a3f2a2efb)] [scriptable, function, uuid(98b6237b-9654-43de-97e0-acf4b091b4e7)]
interface nsIDOMBatteryManager : nsIDOMEventTarget interface nsIDOMMozBatteryManager : nsIDOMEventTarget
{ {
readonly attribute double level; readonly attribute double level;
readonly attribute boolean charging; readonly attribute boolean charging;

Просмотреть файл

@ -36,10 +36,10 @@
#include "nsISupports.idl" #include "nsISupports.idl"
interface nsIDOMBatteryManager; interface nsIDOMMozBatteryManager;
[scriptable, uuid(a19eedd7-6c26-4676-bd34-7ca74ca5f565)] [scriptable, uuid(c295f049-be3d-4f83-9f7c-5c3e91d6ecb9)]
interface nsIDOMNavigatorBattery : nsISupports interface nsIDOMMozNavigatorBattery : nsISupports
{ {
readonly attribute nsIDOMBatteryManager mozBattery; readonly attribute nsIDOMMozBatteryManager mozBattery;
}; };

Просмотреть файл

@ -14,6 +14,12 @@
/** Test for Battery API **/ /** Test for Battery API **/
// Testing prefixing.
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"); ok('mozBattery' in navigator, "navigator.mozBattery should exist");
var battery = navigator.mozBattery; var battery = navigator.mozBattery;