Bug 1061481 - Patch 1/3: Cleanup WebIDL files, r=bz
authorBen Tian <btian@mozilla.com>
Thu, 11 Sep 2014 10:03:40 +0800
changeset 204831 efee139d45db48e944c35d070741a3801821ae92
parent 204830 49b0cd033d65f0b573d88e431375506395d73cc2
child 204832 02f7498edae38d98f80ffd32c5e32cb5f0d7faf0
push id27467
push usercbook@mozilla.com
push dateThu, 11 Sep 2014 13:33:13 +0000
treeherdermozilla-central@98ea98c8191a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1061481
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1061481 - Patch 1/3: Cleanup WebIDL files, r=bz
dom/webidl/BluetoothAdapter2.webidl
dom/webidl/BluetoothDevice2.webidl
dom/webidl/BluetoothManager2.webidl
dom/webidl/BluetoothPairingEvent.webidl
--- a/dom/webidl/BluetoothAdapter2.webidl
+++ b/dom/webidl/BluetoothAdapter2.webidl
@@ -27,73 +27,54 @@ dictionary MediaPlayStatus
   // current track length (ms)
   long long   duration = -1;
   // playing time (ms)
   long long   position = -1;
   // one of 'STOPPED'/'PLAYING'/'PAUSED'/'FWD_SEEK'/'REV_SEEK'/'ERROR'
   DOMString   playStatus = "";
 };
 
-enum BluetoothAdapterState
-{
-  "disabled",
-  "disabling",
-  "enabled",
-  "enabling"
-};
-
-enum BluetoothAdapterAttribute
-{
-  "unknown",
-  "state",
-  "address",
-  "name",
-  "discoverable",
-  "discovering"
-};
-
 [CheckPermissions="bluetooth"]
 interface BluetoothAdapter : EventTarget {
   readonly attribute BluetoothAdapterState  state;
   readonly attribute DOMString              address;
   readonly attribute DOMString              name;
   readonly attribute boolean                discoverable;
   readonly attribute boolean                discovering;
 
   [AvailableIn=CertifiedApps]
   readonly attribute BluetoothPairingListener pairingReqs;
 
+  // Fired when attribute(s) of BluetoothAdapter changed
+           attribute EventHandler   onattributechanged;
+
+  // Fired when a remote device gets paired with the adapter
+           attribute EventHandler   ondevicepaired;
+
+  // Fired when a remote device gets unpaired from the adapter
+           attribute EventHandler   ondeviceunpaired;
+
   // Fired when a2dp connection status changed
            attribute EventHandler   ona2dpstatuschanged;
 
   // Fired when handsfree connection status changed
            attribute EventHandler   onhfpstatuschanged;
 
   // Fired when sco connection status changed
            attribute EventHandler   onscostatuschanged;
 
   // Fired when remote devices query current media play status
            attribute EventHandler   onrequestmediaplaystatus;
 
-  // Fired when attributes of BluetoothAdapter changed
-           attribute EventHandler   onattributechanged;
-
-  // Fired when a remote device gets paired with the adapter.
-           attribute EventHandler   ondevicepaired;
-
-  // Fired when a remote device gets unpaired from the adapter.
-           attribute EventHandler   ondeviceunpaired;
-
   /**
    * Enable/Disable a local bluetooth adapter by asynchronus methods and return
    * its result through a Promise.
    *
    * Several onattributechanged events would be triggered during processing the
-   * request, and the last one would indicate adapter.state becomes
-   * enabled/disabled.
+   * request, and the last one indicates adapter.state becomes enabled/disabled.
    */
   [NewObject, Throws]
   Promise<void> enable();
   [NewObject, Throws]
   Promise<void> disable();
 
   [NewObject, Throws]
   Promise<void> setName(DOMString aName);
@@ -172,8 +153,27 @@ interface BluetoothAdapter : EventTarget
   DOMRequest toggleCalls();
 
   // AVRCP 1.3 methods
   [NewObject,Throws]
   DOMRequest sendMediaMetaData(optional MediaMetaData mediaMetaData);
   [NewObject,Throws]
   DOMRequest sendMediaPlayStatus(optional MediaPlayStatus mediaPlayStatus);
 };
+
+enum BluetoothAdapterState
+{
+  "disabled",
+  "disabling",
+  "enabled",
+  "enabling"
+};
+
+enum BluetoothAdapterAttribute
+{
+  "unknown",
+  "state",
+  "address",
+  "name",
+  "discoverable",
+  "discovering"
+};
+
--- a/dom/webidl/BluetoothDevice2.webidl
+++ b/dom/webidl/BluetoothDevice2.webidl
@@ -1,44 +1,45 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* 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/. */
 
-/*
- * Set of attributes that might be changed and reported by attributechanged
- * event.
- * Address is not included since it should not be changed once BluetoothDevice
- * is created.
- */
-enum BluetoothDeviceAttribute
-{
-  "unknown",
-  "cod",
-  "name",
-  "paired",
-  "uuids"
-};
-
 [CheckPermissions="bluetooth"]
 interface BluetoothDevice : EventTarget
 {
   readonly attribute DOMString              address;
   readonly attribute BluetoothClassOfDevice cod;
   readonly attribute DOMString              name;
   readonly attribute boolean                paired;
 
   [Cached, Pure]
   readonly attribute sequence<DOMString>    uuids;
 
+  // Fired when attribute(s) of BluetoothDevice changed
            attribute EventHandler           onattributechanged;
 
   /**
    * Fetch the up-to-date UUID list of each bluetooth service that the device
    * provides and refresh the cache value of attribute uuids if it is updated.
    *
    * If the operation succeeds, the promise will be resolved with up-to-date
    * UUID list which is identical to attribute uuids.
    */
   [NewObject, Throws]
   Promise<sequence<DOMString>>              fetchUuids();
 };
+
+/*
+ * Possible device attributes that attributechanged event reports.
+ * Note "address" is excluded since it never changes once BluetoothDevice
+ * is created.
+ */
+enum BluetoothDeviceAttribute
+{
+  "unknown",
+  "cod",
+  "name",
+  "paired",
+  "uuids"
+};
+
--- a/dom/webidl/BluetoothManager2.webidl
+++ b/dom/webidl/BluetoothManager2.webidl
@@ -3,18 +3,23 @@
  * 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/. */
 
 [CheckPermissions="bluetooth"]
 interface BluetoothManager: EventTarget
 {
   readonly attribute BluetoothAdapter? defaultAdapter;
 
+  // Fired when attribute(s) of BluetoothManager changed
            attribute EventHandler onattributechanged;
+
+  // Fired when a new adapter is plugged in
            attribute EventHandler onadapteradded;
+
+  // Fired when an existing adapter is unplugged
            attribute EventHandler onadapterremoved;
 
   sequence<BluetoothAdapter> getAdapters();
 };
 
 enum BluetoothManagerAttribute
 {
   "unknown",
--- a/dom/webidl/BluetoothPairingEvent.webidl
+++ b/dom/webidl/BluetoothPairingEvent.webidl
@@ -4,17 +4,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 [CheckPermissions="bluetooth",
  Constructor(DOMString type,
              optional BluetoothPairingEventInit eventInitDict)]
 interface BluetoothPairingEvent : Event
 {
-  readonly attribute BluetoothDevice?        device;
-  readonly attribute BluetoothPairingHandle? handle;
+  readonly attribute BluetoothDevice        device;
+  readonly attribute BluetoothPairingHandle handle;
 };
 
 dictionary BluetoothPairingEventInit : EventInit
 {
-  BluetoothDevice? device = null;
-  BluetoothPairingHandle? handle = null;
+  required BluetoothDevice        device;
+  required BluetoothPairingHandle handle;
 };