From 07e16ed094ac905488dd7569052cd7ab6bd1f59b Mon Sep 17 00:00:00 2001 From: Bevis Tseng Date: Mon, 19 Oct 2015 18:44:25 +0800 Subject: [PATCH] Bug 859764 - Part 2: Define New WebIDL interfaces for MobileMessage Objects. r=echen r=smaug --- dom/webidl/DOMMobileMessageError.webidl | 2 +- dom/webidl/MmsMessage.webidl | 102 ++++++++++++++++++++++ dom/webidl/MobileMessageThread.webidl | 46 ++++++++++ dom/webidl/MozMmsEvent.webidl | 5 +- dom/webidl/MozMmsMessage.webidl | 15 ---- dom/webidl/MozMobileMessageManager.webidl | 19 ++-- dom/webidl/MozSmsEvent.webidl | 5 +- dom/webidl/SmsMessage.webidl | 89 +++++++++++++++++++ dom/webidl/moz.build | 4 +- 9 files changed, 253 insertions(+), 34 deletions(-) create mode 100644 dom/webidl/MmsMessage.webidl create mode 100644 dom/webidl/MobileMessageThread.webidl delete mode 100644 dom/webidl/MozMmsMessage.webidl create mode 100644 dom/webidl/SmsMessage.webidl diff --git a/dom/webidl/DOMMobileMessageError.webidl b/dom/webidl/DOMMobileMessageError.webidl index 6712db4e8da..16926df24ea 100644 --- a/dom/webidl/DOMMobileMessageError.webidl +++ b/dom/webidl/DOMMobileMessageError.webidl @@ -8,5 +8,5 @@ CheckAnyPermissions="sms", AvailableIn="CertifiedApps"] interface DOMMobileMessageError : DOMError { - readonly attribute (MozSmsMessage or MozMmsMessage) data; + readonly attribute (SmsMessage or MmsMessage) data; }; diff --git a/dom/webidl/MmsMessage.webidl b/dom/webidl/MmsMessage.webidl new file mode 100644 index 00000000000..b24efd07a8b --- /dev/null +++ b/dom/webidl/MmsMessage.webidl @@ -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 deliveryInfo; + + /** + * The sender's address. + */ + readonly attribute DOMString sender; + + /** + * The addreses of the receivers. + */ + [Cached, Pure] + readonly attribute sequence 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 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; +}; diff --git a/dom/webidl/MobileMessageThread.webidl b/dom/webidl/MobileMessageThread.webidl new file mode 100644 index 00000000000..d5bee1e5ce8 --- /dev/null +++ b/dom/webidl/MobileMessageThread.webidl @@ -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 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; +}; diff --git a/dom/webidl/MozMmsEvent.webidl b/dom/webidl/MozMmsEvent.webidl index 506f3d6d85d..f31aef67f5a 100644 --- a/dom/webidl/MozMmsEvent.webidl +++ b/dom/webidl/MozMmsEvent.webidl @@ -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; }; diff --git a/dom/webidl/MozMmsMessage.webidl b/dom/webidl/MozMmsMessage.webidl deleted file mode 100644 index f7f690c60f3..00000000000 --- a/dom/webidl/MozMmsMessage.webidl +++ /dev/null @@ -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). -}; diff --git a/dom/webidl/MozMobileMessageManager.webidl b/dom/webidl/MozMobileMessageManager.webidl index 2638b7f5b1b..cc9670caa74 100644 --- a/dom/webidl/MozMobileMessageManager.webidl +++ b/dom/webidl/MozMobileMessageManager.webidl @@ -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 getSmscAddress(optional unsigned long serviceId); diff --git a/dom/webidl/MozSmsEvent.webidl b/dom/webidl/MozSmsEvent.webidl index 00d109cef43..2a215220c78 100644 --- a/dom/webidl/MozSmsEvent.webidl +++ b/dom/webidl/MozSmsEvent.webidl @@ -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; }; diff --git a/dom/webidl/SmsMessage.webidl b/dom/webidl/SmsMessage.webidl new file mode 100644 index 00000000000..72265fc36d3 --- /dev/null +++ b/dom/webidl/SmsMessage.webidl @@ -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; +}; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 0f94ea267ac..8235742840e 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -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',