Bug 958782 - 1/3: B2G SMS - Move MozMobileMessage to WebIDL. XPIDL & WebIDL changes. f=Ms2ger,r=khuey
☠☠ backed out by 8979b19469c1 ☠ ☠
authorVicamo Yang <vyang@mozilla.com>
Mon, 23 Jun 2014 20:55:55 +0800
changeset 190186 033708b53979aebce204af0a77bd85a3e9e36f12
parent 190106 4d523628672437d4613fef2c972c703c656f7508
child 190187 15a281081b971ecd72584f70dc58f56c89018b36
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerskhuey
bugs958782
milestone33.0a1
Bug 958782 - 1/3: B2G SMS - Move MozMobileMessage to WebIDL. XPIDL & WebIDL changes. f=Ms2ger,r=khuey
dom/bindings/Bindings.conf
dom/mobilemessage/interfaces/moz.build
dom/mobilemessage/interfaces/nsIDOMMobileMessageManager.idl
dom/webidl/MobileMessageManager.webidl
dom/webidl/MozMmsMessage.webidl
dom/webidl/MozMobileMessageManager.webidl
dom/webidl/Navigator.webidl
dom/webidl/moz.build
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -837,16 +837,20 @@ DOMInterfaces = {
     'nativeType': 'mozilla::dom::MobileConnectionArray',
     'resultNotAddRefed': [ 'item' ]
 },
 
 'MozMobileConnectionInfo': {
     'nativeType': 'mozilla::dom::MobileConnectionInfo',
 },
 
+'MozMobileMessageManager': {
+    'nativeType': 'mozilla::dom::MobileMessageManager',
+},
+
 'MozMobileNetworkInfo': {
     'nativeType': 'mozilla::dom::MobileNetworkInfo',
 },
 
 'MozNamedAttrMap': {
     'nativeType': 'nsDOMAttributeMap',
 },
 
@@ -1955,21 +1959,23 @@ addExternalIface('imgINotificationObserv
 addExternalIface('imgIRequest', nativeType='imgIRequest', notflattened=True)
 addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
 addExternalIface('MozBoxObject', nativeType='nsIBoxObject')
 addExternalIface('MozControllers', nativeType='nsIControllers')
 addExternalIface('MozFrameLoader', nativeType='nsIFrameLoader', notflattened=True)
 addExternalIface('MozFrameRequestCallback', nativeType='nsIFrameRequestCallback',
                  notflattened=True)
 addExternalIface('MozIccInfo', headerFile='nsIDOMIccInfo.h')
-addExternalIface('MozMobileMessageManager', headerFile='nsIDOMMobileMessageManager.h')
+addExternalIface('MozMmsMessage')
 addExternalIface('MozObserver', nativeType='nsIObserver', notflattened=True)
 addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource',
                  notflattened=True)
 addExternalIface('MozRDFResource', nativeType='nsIRDFResource', notflattened=True)
+addExternalIface('MozSmsFilter', headerFile='nsIDOMSmsFilter.h')
+addExternalIface('MozSmsMessage')
 addExternalIface('MozTreeBoxObject', nativeType='nsITreeBoxObject',
                  notflattened=True)
 addExternalIface('MozTreeColumn', nativeType='nsITreeColumn',
                  headerFile='nsITreeColumns.h')
 addExternalIface('MozVoicemailStatus')
 addExternalIface('MozWakeLockListener', headerFile='nsIDOMWakeLockListener.h')
 addExternalIface('MozXULTemplateBuilder', nativeType='nsIXULTemplateBuilder')
 addExternalIface('nsIBrowserDOMWindow', nativeType='nsIBrowserDOMWindow',
--- a/dom/mobilemessage/interfaces/moz.build
+++ b/dom/mobilemessage/interfaces/moz.build
@@ -1,16 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 XPIDL_SOURCES += [
-    'nsIDOMMobileMessageManager.idl',
     'nsIDOMMozMmsMessage.idl',
     'nsIDOMMozMobileMessageThread.idl',
     'nsIDOMMozSmsMessage.idl',
     'nsIDOMSmsFilter.idl',
     'nsIDOMSmsSegmentInfo.idl',
     'nsIMmsService.idl',
     'nsIMobileMessageCallback.idl',
     'nsIMobileMessageCursorCallback.idl',
deleted file mode 100644
--- a/dom/mobilemessage/interfaces/nsIDOMMobileMessageManager.idl
+++ /dev/null
@@ -1,81 +0,0 @@
-/* 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 "nsIDOMEventTarget.idl"
-
-interface nsIDOMEventListener;
-interface nsIDOMMozSmsFilter;
-interface nsIDOMMozSmsSegmentInfo;
-interface nsIDOMDOMCursor;
-interface nsIDOMDOMRequest;
-interface nsIDOMBlob;
-
-[scriptable, builtinclass, uuid(8ec8247d-3f5f-41af-9c72-9dc857e3be81)]
-interface nsIDOMMozMobileMessageManager : nsIDOMEventTarget
-{
-  nsIDOMDOMRequest getSegmentInfoForText(in DOMString text);
-
-
-  /**
-   * Function to send SMS.
-   *
-   * @param number
-   *        Either a DOMString (only one number) or an array of numbers.
-   * @param message
-   *        The text message to be sent.
-   * @param sendParameters
-   *        An SmsSendParameters object.
-   * @param return
-   *        A DOMRequest object indicating the sending result if one number
-   *        has been passed; an array of DOMRequest objects otherwise.
-   */
-  [implicit_jscontext, optional_argc]
-  jsval send(in jsval number, in DOMString message,
-             [optional] in jsval sendParameters);
-
-  /**
-   * Function to send MMS.
-   *
-   * @param parameters
-   *        An MmsParameters object.
-   * @param sendParameters
-   *        An MmsSendParameters object.
-   * @param return
-   *        A DOMRequest object indicating the sending result.
-   */
-  [implicit_jscontext, optional_argc]
-  nsIDOMDOMRequest sendMMS(in jsval parameters,
-                           [optional] in jsval sendParameters);
-
-  [binaryname(GetMessageMoz)]
-  nsIDOMDOMRequest getMessage(in long id);
-
-  // The parameter can be either a message id or a nsIDOMMoz{Mms,Sms}Message.
-  [implicit_jscontext]
-  nsIDOMDOMRequest delete(in jsval param);
-
-  // Iterates through nsIDOMMoz{Mms,Sms}Message.
-  nsIDOMDOMCursor getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse);
-
-  nsIDOMDOMRequest markMessageRead(in long id, in boolean value,
-                                   [optional] in boolean aSendReadReport);
-
-  // Iterates through nsIDOMMozMobileMessageThread.
-  nsIDOMDOMCursor getThreads();
-
-  nsIDOMDOMRequest retrieveMMS(in long id);
-
-  [optional_argc]
-  nsIDOMDOMRequest getSmscAddress([optional] in unsigned long serviceId);
-
-  [implicit_jscontext] attribute jsval onreceived;
-  [implicit_jscontext] attribute jsval onretrieving;
-  [implicit_jscontext] attribute jsval onsending;
-  [implicit_jscontext] attribute jsval onsent;
-  [implicit_jscontext] attribute jsval onfailed;
-  [implicit_jscontext] attribute jsval ondeliverysuccess;
-  [implicit_jscontext] attribute jsval ondeliveryerror;
-  [implicit_jscontext] attribute jsval onreadsuccess;
-  [implicit_jscontext] attribute jsval onreaderror;
-};
--- a/dom/webidl/MozMmsMessage.webidl
+++ b/dom/webidl/MozMmsMessage.webidl
@@ -1,24 +1,15 @@
 /* -*- 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/.
  */
 
-// If this is changed, change the MmsMessage.h structure as well.
-dictionary MmsAttachment {
-  DOMString? id = null;
-  DOMString? location = null;
-  Blob? content = null;
-};
-
 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).
 };
-
-// If we start using MmsParameters here, remove it from DummyBinding.
rename from dom/webidl/MobileMessageManager.webidl
rename to dom/webidl/MozMobileMessageManager.webidl
--- a/dom/webidl/MobileMessageManager.webidl
+++ b/dom/webidl/MozMobileMessageManager.webidl
@@ -1,24 +1,123 @@
 /* -*- 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/.
  */
 
+interface MozMmsMessage;
+interface MozSmsFilter;
+interface MozSmsMessage;
+
+dictionary MmsAttachment {
+  DOMString? id = null;
+  DOMString? location = null;
+  Blob? content = null;
+};
+
 dictionary MmsParameters {
   sequence<DOMString> receivers;
   DOMString? subject = null;
   DOMString? smil = null;
   sequence<MmsAttachment> attachments;
 };
 
-// If we start using MmsParameters here, remove it from DummyBinding.
-
 dictionary SmsSendParameters {
   unsigned long serviceId; // The ID of the RIL service which needs to be
                            // specified under the multi-sim scenario.
 };
 
 dictionary MmsSendParameters {
   unsigned long serviceId; // The ID of the RIL service which needs to be
                            // specified under the multi-sim scenario.
 };
+
+[Pref="dom.sms.enabled"]
+interface MozMobileMessageManager : EventTarget
+{
+  [Throws]
+  DOMRequest getSegmentInfoForText(DOMString text);
+
+  /**
+   * Send SMS.
+   *
+   * @param number
+   *        Either a DOMString (only one number) or an array of numbers.
+   * @param text
+   *        The text message to be sent.
+   * @param sendParameters
+   *        A SmsSendParameters object.
+   *
+   * @return
+   *        A DOMRequest object indicating the sending result if one number
+   *        has been passed; an array of DOMRequest objects otherwise.
+   */
+  [Throws]
+  DOMRequest send(DOMString number,
+                  DOMString text,
+                  optional SmsSendParameters sendParameters);
+  [Throws]
+  sequence<DOMRequest> send(sequence<DOMString> numbers,
+                            DOMString text,
+                            optional SmsSendParameters sendParameters);
+
+  /**
+   * Send MMS.
+   *
+   * @param parameters
+   *        A MmsParameters object.
+   * @param sendParameters
+   *        A MmsSendParameters object.
+   *
+   * @return
+   *        A DOMRequest object indicating the sending result.
+   */
+  [Throws]
+  DOMRequest sendMMS(optional MmsParameters parameters,
+                     optional MmsSendParameters sendParameters);
+
+  [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.
+  [Throws]
+  DOMRequest delete(long id);
+  [Throws]
+  DOMRequest delete(MozSmsMessage message);
+  [Throws]
+  DOMRequest delete(MozMmsMessage message);
+  [Throws]
+  DOMRequest delete(sequence<(long or MozSmsMessage or MozMmsMessage)> params);
+
+  // Iterates through Moz{Mms,Sms}Message.
+  [Throws]
+  DOMCursor getMessages(optional MozSmsFilter? filter = null,
+                        optional boolean reverse = false);
+
+  [Throws]
+  DOMRequest markMessageRead(long id,
+                             boolean read,
+                             optional boolean sendReadReport = false);
+
+  // Iterates through nsIDOMMozMobileMessageThread.
+  [Throws]
+  DOMCursor getThreads();
+
+  [Throws]
+  DOMRequest retrieveMMS(long id);
+  [Throws]
+  DOMRequest retrieveMMS(MozMmsMessage message);
+
+  [Throws]
+  DOMRequest getSmscAddress(optional unsigned long serviceId);
+
+  attribute EventHandler onreceived;
+  attribute EventHandler onretrieving;
+  attribute EventHandler onsending;
+  attribute EventHandler onsent;
+  attribute EventHandler onfailed;
+  attribute EventHandler ondeliverysuccess;
+  attribute EventHandler ondeliveryerror;
+  attribute EventHandler onreadsuccess;
+  attribute EventHandler onreaderror;
+};
--- a/dom/webidl/Navigator.webidl
+++ b/dom/webidl/Navigator.webidl
@@ -240,18 +240,16 @@ partial interface Navigator {
 };
 
 // nsIDOMClientInformation
 partial interface Navigator {
   [Throws]
   boolean mozIsLocallyAvailable(DOMString uri, boolean whenOffline);
 };
 
-// nsIDOMMozNavigatorMobileMessage
-interface MozMobileMessageManager;
 partial interface Navigator {
   [Func="Navigator::HasMobileMessageSupport"]
   readonly attribute MozMobileMessageManager? mozMobileMessage;
 };
 
 // NetworkInformation
 partial interface Navigator {
   [Throws, Pref="dom.netinfo.enabled"]
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -245,21 +245,21 @@ WEBIDL_FILES = [
     'MediaStreamTrack.webidl',
     'MediaTrackConstraintSet.webidl',
     'MessageChannel.webidl',
     'MessageEvent.webidl',
     'MessagePort.webidl',
     'MessagePortList.webidl',
     'MimeType.webidl',
     'MimeTypeArray.webidl',
-    'MobileMessageManager.webidl',
     'MouseEvent.webidl',
     'MouseScrollEvent.webidl',
     'MozActivity.webidl',
     'MozMmsMessage.webidl',
+    'MozMobileMessageManager.webidl',
     'MozNamedAttrMap.webidl',
     'MozPowerManager.webidl',
     'MozTimeManager.webidl',
     'MozWakeLock.webidl',
     'MutableFile.webidl',
     'MutationEvent.webidl',
     'MutationObserver.webidl',
     'NativeOSFileInternals.webidl',