Bug 864484 - Part 3: Move MozCellBroadcastMessage to webidl implementation. r=vyang, r=smaug

--HG--
rename : dom/cellbroadcast/interfaces/nsIDOMMozCellBroadcastMessage.idl => dom/webidl/MozCellBroadcastMessage.webidl
extra : rebase_source : 1fe6072c1db53fc4751e9a931adadb31a246f247
This commit is contained in:
Bevis Tseng 2014-08-15 13:13:05 +08:00
Родитель a1bc9a83e6
Коммит c6b421df2c
16 изменённых файлов: 373 добавлений и 154 удалений

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

@ -702,6 +702,15 @@ DOMInterfaces = {
'nativeType': 'mozilla::dom::CellBroadcast',
},
'MozCellBroadcastEtwsInfo': {
'nativeType': 'mozilla::dom::CellBroadcastEtwsInfo',
'headerFile': 'CellBroadcastMessage.h'
},
'MozCellBroadcastMessage': {
'nativeType': 'mozilla::dom::CellBroadcastMessage',
},
'MozIcc': {
'nativeType': 'mozilla::dom::Icc',
},

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

@ -3,15 +3,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "CellBroadcast.h"
#include "mozilla/dom/CellBroadcast.h"
#include "mozilla/dom/CellBroadcastMessage.h"
#include "mozilla/dom/MozCellBroadcastBinding.h"
#include "mozilla/dom/MozCellBroadcastEvent.h"
#include "nsIDOMMozCellBroadcastMessage.h"
#include "nsServiceManagerUtils.h"
#define NS_CELLBROADCASTSERVICE_CONTRACTID "@mozilla.org/cellbroadcast/gonkservice;1"
using namespace mozilla::dom;
using mozilla::ErrorResult;
/**
* CellBroadcast::Listener Implementation.
@ -104,12 +105,36 @@ CellBroadcast::WrapObject(JSContext* aCx)
// Forwarded nsICellBroadcastListener methods
NS_IMETHODIMP
CellBroadcast::NotifyMessageReceived(nsIDOMMozCellBroadcastMessage* aMessage)
{
CellBroadcast::NotifyMessageReceived(uint32_t aServiceId,
const nsAString& aGsmGeographicalScope,
uint16_t aMessageCode,
uint16_t aMessageId,
const nsAString& aLanguage,
const nsAString& aBody,
const nsAString& aMessageClass,
DOMTimeStamp aTimestamp,
uint32_t aCdmaServiceCategory,
bool aHasEtwsInfo,
const nsAString& aEtwsWarningType,
bool aEtwsEmergencyUserAlert,
bool aEtwsPopup) {
MozCellBroadcastEventInit init;
init.mBubbles = true;
init.mCancelable = false;
init.mMessage = aMessage;
init.mMessage = new CellBroadcastMessage(GetOwner(),
aServiceId,
aGsmGeographicalScope,
aMessageCode,
aMessageId,
aLanguage,
aBody,
aMessageClass,
aTimestamp,
aCdmaServiceCategory,
aHasEtwsInfo,
aEtwsWarningType,
aEtwsEmergencyUserAlert,
aEtwsPopup);
nsRefPtr<MozCellBroadcastEvent> event =
MozCellBroadcastEvent::Constructor(this, NS_LITERAL_STRING("received"), init);

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

@ -0,0 +1,135 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "CellBroadcastMessage.h"
#include "mozilla/dom/MozCellBroadcastMessageBinding.h"
#include "nsPIDOMWindow.h"
#define CONVERT_STRING_TO_NULLABLE_ENUM(_string, _enumType, _enum) \
{ \
_enum.SetNull(); \
\
uint32_t i = 0; \
for (const EnumEntry* entry = _enumType##Values::strings; \
entry->value; \
++entry, ++i) { \
if (_string.EqualsASCII(entry->value)) { \
_enum.SetValue(static_cast<_enumType>(i)); \
} \
} \
}
namespace mozilla {
namespace dom {
/**
* CellBroadcastMessage Implementation.
*/
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CellBroadcastMessage, mWindow, mEtwsInfo)
NS_IMPL_CYCLE_COLLECTING_ADDREF(CellBroadcastMessage)
NS_IMPL_CYCLE_COLLECTING_RELEASE(CellBroadcastMessage)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CellBroadcastMessage)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
CellBroadcastMessage::CellBroadcastMessage(nsPIDOMWindow* aWindow,
uint32_t aServiceId,
const nsAString& aGsmGeographicalScope,
uint16_t aMessageCode,
uint16_t aMessageId,
const nsAString& aLanguage,
const nsAString& aBody,
const nsAString& aMessageClass,
uint64_t aTimestamp,
uint32_t aCdmaServiceCategory,
bool aHasEtwsInfo,
const nsAString& aEtwsWarningType,
bool aEtwsEmergencyUserAlert,
bool aEtwsPopup)
: mWindow(aWindow)
, mServiceId(aServiceId)
, mMessageCode(aMessageCode)
, mMessageId(aMessageId)
, mLanguage(aLanguage)
, mBody(aBody)
, mTimestamp(aTimestamp)
, mEtwsInfo(aHasEtwsInfo ? new CellBroadcastEtwsInfo(aWindow,
aEtwsWarningType,
aEtwsEmergencyUserAlert,
aEtwsPopup)
: nullptr)
{
CONVERT_STRING_TO_NULLABLE_ENUM(aGsmGeographicalScope,
CellBroadcastGsmGeographicalScope,
mGsmGeographicalScope)
CONVERT_STRING_TO_NULLABLE_ENUM(aMessageClass,
CellBroadcastMessageClass,
mMessageClass)
// CdmaServiceCategory represents a 16bit unsigned value.
if (aCdmaServiceCategory > 0xFFFFU) {
mCdmaServiceCategory.SetNull();
} else {
mCdmaServiceCategory.SetValue(static_cast<uint16_t>(aCdmaServiceCategory));
}
SetIsDOMBinding();
}
JSObject*
CellBroadcastMessage::WrapObject(JSContext* aCx)
{
return MozCellBroadcastMessageBinding::Wrap(aCx, this);
}
already_AddRefed<CellBroadcastEtwsInfo>
CellBroadcastMessage::GetEtws() const
{
nsRefPtr<CellBroadcastEtwsInfo> etwsInfo = mEtwsInfo;
return etwsInfo.forget();
}
/**
* CellBroadcastEtwsInfo Implementation.
*/
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CellBroadcastEtwsInfo, mWindow)
NS_IMPL_CYCLE_COLLECTING_ADDREF(CellBroadcastEtwsInfo)
NS_IMPL_CYCLE_COLLECTING_RELEASE(CellBroadcastEtwsInfo)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CellBroadcastEtwsInfo)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
CellBroadcastEtwsInfo::CellBroadcastEtwsInfo(nsPIDOMWindow* aWindow,
const nsAString& aWarningType,
bool aEmergencyUserAlert,
bool aPopup)
: mWindow(aWindow)
, mEmergencyUserAlert(aEmergencyUserAlert)
, mPopup(aPopup)
{
CONVERT_STRING_TO_NULLABLE_ENUM(aWarningType,
CellBroadcastEtwsWarningType,
mWarningType)
SetIsDOMBinding();
}
JSObject*
CellBroadcastEtwsInfo::WrapObject(JSContext* aCx)
{
return MozCellBroadcastEtwsInfoBinding::Wrap(aCx, this);
}
} // namespace dom
} // namespace mozilla

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

@ -0,0 +1,136 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_cellbroadcast_CellBroadcastMessage_h
#define mozilla_dom_cellbroadcast_CellBroadcastMessage_h
#include "mozilla/dom/MozCellBroadcastMessageBinding.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsWrapperCache.h"
class nsPIDOMWindow;
namespace mozilla {
namespace dom {
class CellBroadcastEtwsInfo;
class CellBroadcastMessage MOZ_FINAL : public nsISupports
, public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CellBroadcastMessage)
CellBroadcastMessage(nsPIDOMWindow* aWindow,
uint32_t aServiceId,
const nsAString& aGsmGeographicalScope,
uint16_t aMessageCode,
uint16_t aMessageId,
const nsAString& aLanguage,
const nsAString& aBody,
const nsAString& aMessageClass,
uint64_t aTimestamp,
uint32_t aCdmaServiceCategory,
bool aHasEtwsInfo,
const nsAString& aEtwsWarningType,
bool aEtwsEmergencyUserAlert,
bool aEtwsPopup);
nsPIDOMWindow*
GetParentObject() const { return mWindow; }
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
// WebIDL interface
uint32_t ServiceId() const { return mServiceId; }
const Nullable<CellBroadcastGsmGeographicalScope>&
GetGsmGeographicalScope() { return mGsmGeographicalScope; }
uint16_t MessageCode() const { return mMessageCode; }
uint16_t MessageId() const { return mMessageId; }
void GetLanguage(nsString& aLanguage) const { aLanguage = mLanguage; }
void GetBody(nsString& aBody) const { aBody = mBody; }
const Nullable<CellBroadcastMessageClass>&
GetMessageClass() { return mMessageClass; }
uint64_t Timestamp() const { return mTimestamp; }
// Mark this as resultNotAddRefed to return raw pointers
already_AddRefed<CellBroadcastEtwsInfo> GetEtws() const;
const Nullable<uint16_t>& GetCdmaServiceCategory() { return mCdmaServiceCategory; };
private:
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
~CellBroadcastMessage() {};
// Don't try to use the default constructor.
CellBroadcastMessage();
nsCOMPtr<nsPIDOMWindow> mWindow;
uint32_t mServiceId;
Nullable<CellBroadcastGsmGeographicalScope> mGsmGeographicalScope;
uint16_t mMessageCode;
uint16_t mMessageId;
nsString mLanguage;
nsString mBody;
Nullable<CellBroadcastMessageClass> mMessageClass;
uint64_t mTimestamp;
Nullable<uint16_t> mCdmaServiceCategory;
nsRefPtr<CellBroadcastEtwsInfo> mEtwsInfo;
};
class CellBroadcastEtwsInfo MOZ_FINAL : public nsISupports
, public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CellBroadcastEtwsInfo)
CellBroadcastEtwsInfo(nsPIDOMWindow* aWindow,
const nsAString& aWarningType,
bool aEmergencyUserAlert,
bool aPopup);
nsPIDOMWindow*
GetParentObject() const { return mWindow; }
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
// WebIDL interface
const Nullable<CellBroadcastEtwsWarningType>&
GetWarningType() { return mWarningType; }
bool EmergencyUserAlert() const { return mEmergencyUserAlert; }
bool Popup() const { return mPopup; }
private:
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
~CellBroadcastEtwsInfo() {};
// Don't try to use the default constructor.
CellBroadcastEtwsInfo();
nsCOMPtr<nsPIDOMWindow> mWindow;
Nullable<CellBroadcastEtwsWarningType> mWarningType;
bool mEmergencyUserAlert;
bool mPopup;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_cellbroadcast_CellBroadcastMessage_h

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

@ -32,85 +32,6 @@ function debug(s) {
dump("CellBroadcastService: " + s);
}
function CellBroadcastMessage(aServiceId,
aGsmGeographicalScope,
aMessageCode,
aMessageId,
aLanguage,
aBody,
aMessageClass,
aTimestamp,
aCdmaServiceCategory,
aHasEtwsInfo,
aEtwsWarningType,
aEtwsEmergencyUserAlert,
aEtwsPopup) {
this.serviceId = aServiceId;
this.gsmGeographicalScope = aGsmGeographicalScope;
this.messageCode = aMessageCode;
this.messageId = aMessageId;
this.language = aLanguage;
this.body = aBody;
this.messageClass = aMessageClass;
this.timestamp = aTimestamp;
this.cdmaServiceCategory = aCdmaServiceCategory;
if (aHasEtwsInfo) {
this.etws = new CellBroadcastEtwsInfo(aEtwsWarningType,
aEtwsEmergencyUserAlert,
aEtwsPopup);
}
}
CellBroadcastMessage.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozCellBroadcastMessage]),
classID: CELLBROADCASTMESSAGE_CID,
classInfo: XPCOMUtils.generateCI({
classID: CELLBROADCASTMESSAGE_CID,
classDescription: "CellBroadcastMessage",
flags: Ci.nsIClassInfo.DOM_OBJECT,
interfaces: [Ci.nsIDOMMozCellBroadcastMessage]
}),
// nsIDOMMozCellBroadcastMessage
serviceId: -1,
gsmGeographicalScope: null,
messageCode: null,
messageId: null,
language: null,
body: null,
messageClass: null,
timestamp: null,
etws: null,
cdmaServiceCategory: null
};
function CellBroadcastEtwsInfo(aEtwsWarningType,
aEtwsEmergencyUserAlert,
aEtwsPopup) {
this.warningType = aEtwsWarningType;
this.emergencyUserAlert = aEtwsEmergencyUserAlert;
this.popup = aEtwsPopup;
}
CellBroadcastEtwsInfo.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozCellBroadcastEtwsInfo]),
classID: CELLBROADCASTETWSINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: CELLBROADCASTETWSINFO_CID,
classDescription: "CellBroadcastEtwsInfo",
flags: Ci.nsIClassInfo.DOM_OBJECT,
interfaces: [Ci.nsIDOMMozCellBroadcastEtwsInfo]
}),
// nsIDOMMozCellBroadcastEtwsInfo
warningType: null,
emergencyUserAlert: null,
popup: null
};
function CellBroadcastService() {
this._listeners = [];
@ -179,26 +100,21 @@ CellBroadcastService.prototype = {
aEtwsWarningType,
aEtwsEmergencyUserAlert,
aEtwsPopup) {
let message = new CellBroadcastMessage(aServiceId,
aGsmGeographicalScope,
aMessageCode,
aMessageId,
aLanguage,
aBody,
aMessageClass,
aTimestamp,
aCdmaServiceCategory,
aHasEtwsInfo,
aEtwsWarningType,
aEtwsEmergencyUserAlert,
aEtwsPopup);
for (let listener of this._listeners) {
try {
// TODO:
// Deflate 'message' object to multiple parameters by redefining
// nsICellBroadcastListener for IPC implementation.
listener.notifyMessageReceived(message);
listener.notifyMessageReceived(aServiceId,
aGsmGeographicalScope,
aMessageCode,
aMessageId,
aLanguage,
aBody,
aMessageClass,
aTimestamp,
aCdmaServiceCategory,
aHasEtwsInfo,
aEtwsWarningType,
aEtwsEmergencyUserAlert,
aEtwsPopup);
} catch (e) {
debug("listener threw an exception: " + e);
}

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

@ -6,7 +6,6 @@
XPIDL_SOURCES += [
'nsICellBroadcastService.idl',
'nsIDOMMozCellBroadcastMessage.idl',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:

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

@ -2,20 +2,28 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
#include "nsISupports.idl"
interface nsIDOMMozCellBroadcastMessage;
[scriptable, uuid(e70bb4cc-2297-11e4-aecd-9f8fb3d2b646)]
[scriptable, uuid(fd1f9efa-3d6c-11e4-a7be-e3b99e7f903b)]
interface nsICellBroadcastListener : nsISupports
{
/**
* Called when a Cell Broadcast message has been received by the network.
*
* @param message
* The received Cell Broadcast Message.
*/
void notifyMessageReceived(in nsIDOMMozCellBroadcastMessage message);
void notifyMessageReceived(in unsigned long aServiceId,
in DOMString aGsmGeographicalScope,
in unsigned short aMessageCode,
in unsigned short aMessageId,
in DOMString aLanguage,
in DOMString aBody,
in DOMString aMessageClass,
in DOMTimeStamp aTimestamp,
in unsigned long aCdmaServiceCategory,
in boolean aHasEtwsInfo,
in DOMString aEtwsWarningType,
in boolean aEtwsEmergencyUserAlert,
in boolean aEtwsPopup);
};
/**

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

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
#include "nsICellBroadcastService.idl"
[scriptable, uuid(f72ced60-21f9-11e4-8896-6fdff2f5c909)]

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

@ -8,10 +8,12 @@ DIRS += ['interfaces']
EXPORTS.mozilla.dom += [
'CellBroadcast.h',
'CellBroadcastMessage.h',
]
SOURCES += [
'CellBroadcast.cpp',
'CellBroadcastMessage.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:

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

@ -23,7 +23,9 @@ function testReceiving_ETWS_MessageAttributes() {
ok(aMessage.etws.emergencyUserAlert != null,
"aMessage.etws.emergencyUserAlert");
ok(aMessage.etws.popup != null, "aMessage.etws.popup");
ok(aMessage.cdmaServiceCategory != null, "aMessage.cdmaServiceCategory");
// cdmaServiceCategory shall always be unavailable in GMS/UMTS CB message.
ok(aMessage.cdmaServiceCategory == null, "aMessage.cdmaServiceCategory");
};
// Here we use a simple ETWS message for test.

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

@ -22,7 +22,9 @@ function testReceiving_GSM_MessageAttributes() {
ok(aMessage.etws.emergencyUserAlert != null, "aMessage.etws.emergencyUserAlert");
ok(aMessage.etws.popup != null, "aMessage.etws.popup");
}
ok(aMessage.cdmaServiceCategory != null, "aMessage.cdmaServiceCategory");
// cdmaServiceCategory shall always be unavailable in GMS/UMTS CB message.
ok(aMessage.cdmaServiceCategory == null, "aMessage.cdmaServiceCategory");
};
// Here we use a simple GSM message for test.
@ -296,20 +298,6 @@ function testReceiving_GSM_Multipart() {
return promise;
}
function testReceiving_GSM_ServiceCategory() {
log("Test receiving GSM Cell Broadcast - Service Category");
let verifyCBMessage = (aMessage) => {
// Bug 910091
// "Service Category" is not defined in GSM. We should always get '0' here.
is(aMessage.cdmaServiceCategory, 0, "aMessage.cdmaServiceCategory");
};
let pdu = buildHexStr(0, CB_MESSAGE_SIZE_GSM * 2);
return sendMultipleRawCbsToEmulatorAndWait([pdu])
.then((aMessage) => verifyCBMessage(aMessage));
}
function testReceiving_GSM_PaddingCharacters() {
log("Test receiving GSM Cell Broadcast - Padding Characters <CR>");
@ -369,6 +357,5 @@ startTestCommon(function testCaseMain() {
.then(() => testReceiving_GSM_EmergencyUserAlert())
.then(() => testReceiving_GSM_Popup())
.then(() => testReceiving_GSM_Multipart())
.then(() => testReceiving_GSM_ServiceCategory())
.then(() => testReceiving_GSM_PaddingCharacters());
});

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

@ -20,7 +20,9 @@ function testReceiving_UMTS_MessageAttributes() {
ok(aMessage.etws.emergencyUserAlert != null, "aMessage.etws.emergencyUserAlert");
ok(aMessage.etws.popup != null, "aMessage.etws.popup");
}
ok(aMessage.cdmaServiceCategory != null, "aMessage.cdmaServiceCategory");
// cdmaServiceCategory shall always be unavailable in GMS/UMTS CB message.
ok(aMessage.cdmaServiceCategory == null, "aMessage.cdmaServiceCategory");
};
// Here we use a single UMTS message for test.

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

@ -676,6 +676,10 @@ var interfaceNamesInGlobalScope =
{name: "MozCellBroadcast", b2g: true, pref: "dom.cellbroadcast.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozCellBroadcastEvent", b2g: true, pref: "dom.cellbroadcast.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozCellBroadcastEtwsInfo", b2g: true, pref: "dom.cellbroadcast.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozCellBroadcastMessage", b2g: true, pref: "dom.cellbroadcast.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozClirModeEvent", b2g: true, pref: "dom.mobileconnection.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!

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

@ -3,7 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
interface MozCellBroadcastMessage;
[Constructor(DOMString type, optional MozCellBroadcastEventInit eventInitDict), Pref="dom.cellbroadcast.enabled"]
interface MozCellBroadcastEvent : Event

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

@ -1,18 +1,18 @@
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=40: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
#include "nsISupports.idl"
enum CellBroadcastGsmGeographicalScope {"cell-immediate", "plmn",
"location-area", "cell"};
enum CellBroadcastMessageClass {"normal", "class-0", "class-1", "class-2",
"class-3", "user-1", "user-2"};
enum CellBroadcastEtwsWarningType {"earthquake", "tsunami",
"earthquake-tsunami", "test", "other"};
interface nsIDOMMozCellBroadcastEtwsInfo;
/**
* MozCellBroadcastMessage encapsulates Cell Broadcast short message service
* (CBS) messages.
*/
[scriptable, uuid(dc729df4-f1d8-11e3-b00d-d3332542c557)]
interface nsIDOMMozCellBroadcastMessage : nsISupports
[Pref="dom.cellbroadcast.enabled"]
interface MozCellBroadcastMessage
{
/**
* The Service Id in the device where the message is received from.
@ -25,7 +25,7 @@ interface nsIDOMMozCellBroadcastMessage : nsISupports
*
* Possible values are: "cell-immediate", "plmn", "location-area" and "cell".
*/
readonly attribute DOMString gsmGeographicalScope;
readonly attribute CellBroadcastGsmGeographicalScope? gsmGeographicalScope;
/**
* The Message Code differentiates between messages from the same source and
@ -43,18 +43,18 @@ interface nsIDOMMozCellBroadcastMessage : nsISupports
/**
* ISO-639-1 language code for this message. Null if unspecified.
*/
readonly attribute DOMString language;
readonly attribute DOMString? language;
/**
* Text message carried by the message.
*/
readonly attribute DOMString body;
readonly attribute DOMString? body;
/**
* Possible values are "normal", "class-0", "class-1", "class-2", "class-3",
* "user-1", and "user-2".
*/
readonly attribute DOMString messageClass;
readonly attribute CellBroadcastMessageClass? messageClass;
/**
* System time stamp at receival.
@ -64,26 +64,22 @@ interface nsIDOMMozCellBroadcastMessage : nsISupports
/**
* Additional ETWS-specific info.
*/
readonly attribute nsIDOMMozCellBroadcastEtwsInfo etws;
readonly attribute MozCellBroadcastEtwsInfo? etws;
/**
* Service Category.
*/
readonly attribute long cdmaServiceCategory;
readonly attribute unsigned short? cdmaServiceCategory;
};
/**
* ETWS (Earthquake and Tsunami Warning service) Primary Notification message
* specific information.
*/
[scriptable, uuid(af009d9a-f5e8-4573-a6ee-a85118465bed)]
interface nsIDOMMozCellBroadcastEtwsInfo : nsISupports
[Pref="dom.cellbroadcast.enabled"]
interface MozCellBroadcastEtwsInfo
{
/**
* Warning type. Possible values are "earthquake", "tsunami",
* "earthquake-tsunami", "test" and "other".
*/
readonly attribute ACString warningType;
readonly attribute CellBroadcastEtwsWarningType? warningType;
/**
* Emergency user alert indication. It is used to command mobile terminals to
@ -98,4 +94,3 @@ interface nsIDOMMozCellBroadcastEtwsInfo : nsISupports
*/
readonly attribute boolean popup;
};

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

@ -264,6 +264,7 @@ WEBIDL_FILES = [
'MouseEvent.webidl',
'MouseScrollEvent.webidl',
'MozActivity.webidl',
'MozCellBroadcastMessage.webidl',
'MozMmsMessage.webidl',
'MozMobileCellInfo.webidl',
'MozMobileConnection.webidl',