Bug 859764 - Part 2: Define New WebIDL interfaces for MobileMessage Objects. r=echen r=smaug

This commit is contained in:
Bevis Tseng 2015-10-19 18:44:25 +08:00
parent 6f582e0c65
commit 07e16ed094
9 changed files with 253 additions and 34 deletions

View File

@ -8,5 +8,5 @@
CheckAnyPermissions="sms",
AvailableIn="CertifiedApps"]
interface DOMMobileMessageError : DOMError {
readonly attribute (MozSmsMessage or MozMmsMessage) data;
readonly attribute (SmsMessage or MmsMessage) data;
};

View File

@ -0,0 +1,102 @@
/* -*- Mode: IDL; 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/.
*/
dictionary MmsDeliveryInfo {
DOMString? receiver = null;
DOMString? deliveryStatus = null;
DOMTimeStamp deliveryTimestamp = 0; // 0 if not available (e.g.,
// |delivery| = "received" or not yet delivered).
DOMString? readStatus = null;
DOMTimeStamp readTimestamp = 0; // 0 if not available (e.g.,
// |delivery| = "received" or not yet read).
};
[Pref="dom.sms.enabled",
CheckAnyPermissions="sms",
AvailableIn="CertifiedApps"]
interface MmsMessage {
/**
* |type| is always "mms".
*/
readonly attribute DOMString type;
/**
* The id of the message record in the database.
*/
readonly attribute long id;
/**
* The Thread id this message belonging to.
*/
readonly attribute unsigned long long threadId;
/**
* Integrated Circuit Card Identifier.
*
* Will be null if ICC is not available.
*/
readonly attribute DOMString iccId;
/**
* Should be "not-downloaded", "received", "sending", "sent" or "error".
*/
readonly attribute DOMString delivery;
[Cached, Pure]
readonly attribute sequence<MmsDeliveryInfo> deliveryInfo;
/**
* The sender's address.
*/
readonly attribute DOMString sender;
/**
* The addreses of the receivers.
*/
[Cached, Pure]
readonly attribute sequence<DOMString> receivers;
/**
* Device timestamp when message is either sent or received.
*/
readonly attribute DOMTimeStamp timestamp;
/**
* The timestamp from MMSC when |delivery| is |received|.
*/
readonly attribute DOMTimeStamp sentTimestamp;
/**
* The read status of this message.
*/
readonly attribute boolean read;
/**
* The subject of this message.
*/
readonly attribute DOMString subject;
/**
* The SMIL document of this message.
*/
readonly attribute DOMString smil;
/**
* The attachments of this message.
*/
[Cached, Pure]
readonly attribute sequence<MmsAttachment> attachments;
/**
* Expiry date for an MMS to be retrieved.
*/
readonly attribute DOMTimeStamp expiryDate;
/**
* The flag to indicate that a read report is requested by the sender or not.
*/
readonly attribute boolean readReportRequested;
};

View File

@ -0,0 +1,46 @@
/* -*- Mode: IDL; 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/.
*/
[Pref="dom.sms.enabled",
CheckAnyPermissions="sms",
AvailableIn="CertifiedApps"]
interface MobileMessageThread {
/**
* Unique identity of the thread.
*/
readonly attribute unsigned long long id;
/**
* Last (MMS) message subject.
*/
readonly attribute DOMString lastMessageSubject;
/**
* Message body of the last message in the thread.
*/
readonly attribute DOMString body;
/**
* Total unread messages in the thread.
*/
readonly attribute unsigned long long unreadCount;
/**
* Participant addresses of the thread.
*/
[Cached, Pure]
readonly attribute sequence<DOMString> participants;
/**
* Timestamp of the last message in the thread.
*/
readonly attribute DOMTimeStamp timestamp;
/**
* Message type of the last message in the thread.
*/
readonly attribute DOMString lastMessageType;
};

View File

@ -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 MozMmsMessage;
[Pref="dom.sms.enabled",
CheckAnyPermissions="sms",
@ -11,10 +10,10 @@ interface MozMmsMessage;
Constructor(DOMString type, optional MozMmsEventInit eventInitDict)]
interface MozMmsEvent : Event
{
readonly attribute MozMmsMessage? message;
readonly attribute MmsMessage? message;
};
dictionary MozMmsEventInit : EventInit
{
MozMmsMessage? message = null;
MmsMessage? message = null;
};

View File

@ -1,15 +0,0 @@
/* -*- Mode: IDL; 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/.
*/
dictionary MmsDeliveryInfo {
DOMString? receiver = null;
DOMString? deliveryStatus = null;
DOMTimeStamp deliveryTimestamp = 0; // 0 if not available (e.g.,
// |delivery| = "received" or not yet delivered).
DOMString? readStatus = null;
DOMTimeStamp readTimestamp = 0; // 0 if not available (e.g.,
// |delivery| = "received" or not yet read).
};

View File

@ -4,9 +4,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
interface MozMmsMessage;
interface MozSmsMessage;
dictionary SmsSegmentInfo {
/**
* The number of total segments for the input string. The value is always
@ -163,18 +160,18 @@ interface MozMobileMessageManager : EventTarget
[Throws]
DOMRequest getMessage(long id);
// The parameter can be either a message id, or a Moz{Mms,Sms}Message, or an
// array of Moz{Mms,Sms}Message objects.
// The parameter can be either a message id, or a {Mms,Sms}Message, or an
// array of {Mms,Sms}Message objects.
[Throws]
DOMRequest delete(long id);
[Throws]
DOMRequest delete(MozSmsMessage message);
DOMRequest delete(SmsMessage message);
[Throws]
DOMRequest delete(MozMmsMessage message);
DOMRequest delete(MmsMessage message);
[Throws]
DOMRequest delete(sequence<(long or MozSmsMessage or MozMmsMessage)> params);
DOMRequest delete(sequence<(long or SmsMessage or MmsMessage)> params);
// Iterates through Moz{Mms,Sms}Message.
// Iterates through {Mms,Sms}Message.
[Throws]
DOMCursor getMessages(optional MobileMessageFilter filter,
optional boolean reverse = false);
@ -184,14 +181,14 @@ interface MozMobileMessageManager : EventTarget
boolean read,
optional boolean sendReadReport = false);
// Iterates through nsIDOMMozMobileMessageThread.
// Iterates through MobileMessageThread.
[Throws]
DOMCursor getThreads();
[Throws]
DOMRequest retrieveMMS(long id);
[Throws]
DOMRequest retrieveMMS(MozMmsMessage message);
DOMRequest retrieveMMS(MmsMessage message);
[Throws]
Promise<SmscAddress> getSmscAddress(optional unsigned long serviceId);

View File

@ -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 MozSmsMessage;
[Pref="dom.sms.enabled",
CheckAnyPermissions="sms",
@ -11,10 +10,10 @@ interface MozSmsMessage;
Constructor(DOMString type, optional MozSmsEventInit eventInitDict)]
interface MozSmsEvent : Event
{
readonly attribute MozSmsMessage? message;
readonly attribute SmsMessage? message;
};
dictionary MozSmsEventInit : EventInit
{
MozSmsMessage? message = null;
SmsMessage? message = null;
};

View File

@ -0,0 +1,89 @@
/* -*- Mode: IDL; 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/.
*/
[Pref="dom.sms.enabled",
CheckAnyPermissions="sms",
AvailableIn="CertifiedApps"]
interface SmsMessage {
/**
* |type| is always "sms".
*/
readonly attribute DOMString type;
/**
* The id of the message record in the database.
*/
readonly attribute long id;
/**
* The Thread id this message belonging to.
*/
readonly attribute unsigned long long threadId;
/**
* Integrated Circuit Card Identifier.
*
* Will be null if ICC is not available.
*/
readonly attribute DOMString iccId;
/**
* Should be "received", "sending", "sent" or "error".
*/
readonly attribute DOMString delivery;
/**
* Possible delivery status values for above delivery states are:
*
* "received": "success"
* "sending" : "pending", or "not-applicable" if the message was sent without
* status report requisition.
* "sent" : "pending", "success", "error", or "not-applicable"
* if the message was sent without status report requisition.
* "error" : "error"
*/
readonly attribute DOMString deliveryStatus;
/**
* The sender's address.
*/
readonly attribute DOMString sender;
/**
* The receiver's address.
*/
readonly attribute DOMString receiver;
/**
* Text body of the message.
*/
readonly attribute DOMString body;
/**
* Should be "normal", "class-0", "class-1", "class-2" or "class-3".
*/
readonly attribute DOMString messageClass;
/**
* Device timestamp when message is either sent or received.
*/
readonly attribute DOMTimeStamp timestamp;
/**
* The timestamp from SMSC when |delivery| is |received|.
*/
readonly attribute DOMTimeStamp sentTimestamp;
/**
* The delivery timestamp when |deliveryStatus| is updated to |success|.
*/
readonly attribute DOMTimeStamp deliveryTimestamp;
/**
* The read status of this message.
*/
readonly attribute boolean read;
};

View File

@ -309,6 +309,8 @@ WEBIDL_FILES = [
'MimeType.webidl',
'MimeTypeArray.webidl',
'MMICall.webidl',
'MmsMessage.webidl',
'MobileMessageThread.webidl',
'MouseEvent.webidl',
'MouseScrollEvent.webidl',
'MozActivity.webidl',
@ -317,7 +319,6 @@ WEBIDL_FILES = [
'MozIcc.webidl',
'MozIccInfo.webidl',
'MozIccManager.webidl',
'MozMmsMessage.webidl',
'MozMobileCellInfo.webidl',
'MozMobileConnection.webidl',
'MozMobileConnectionArray.webidl',
@ -414,6 +415,7 @@ WEBIDL_FILES = [
'SharedWorker.webidl',
'SharedWorkerGlobalScope.webidl',
'SimpleGestureEvent.webidl',
'SmsMessage.webidl',
'SocketCommon.webidl',
'SourceBuffer.webidl',
'SourceBufferList.webidl',