From e25ca0c35bf7a8158f4b6ca7b892038fe96557f8 Mon Sep 17 00:00:00 2001 From: Eric Chou Date: Sat, 30 Nov 2013 20:20:17 +0800 Subject: [PATCH] Bug 942104 - Add nsIDOMBluetoothDiscoveryStateChangedEvent, r=gyeh --- .../test/test_all_synthetic_events.html | 4 ++++ dom/bluetooth/BluetoothAdapter.cpp | 1 + dom/bluetooth/interfaces/moz.build | 1 + ...DOMBluetoothDiscoveryStateChangedEvent.idl | 22 +++++++++++++++++++ .../mochitest/general/test_interfaces.html | 1 + ...BluetoothDiscoveryStateChangedEvent.webidl | 16 ++++++++++++++ dom/webidl/moz.build | 1 + js/xpconnect/src/event_impl_gen.conf.in | 1 + 8 files changed, 47 insertions(+) create mode 100644 dom/bluetooth/interfaces/nsIDOMBluetoothDiscoveryStateChangedEvent.idl create mode 100644 dom/webidl/BluetoothDiscoveryStateChangedEvent.webidl diff --git a/content/events/test/test_all_synthetic_events.html b/content/events/test/test_all_synthetic_events.html index fbef23faf40..940509a612a 100644 --- a/content/events/test/test_all_synthetic_events.html +++ b/content/events/test/test_all_synthetic_events.html @@ -48,6 +48,10 @@ const kEventConstructors = { return new BluetoothDeviceEvent(aName, aProps); }, }, + BluetoothDiscoveryStateChangedEvent: { create: function (aName, aProps) { + return new BluetoothDiscoveryStateChangedEvent(aName, aProps); + }, + }, BluetoothStatusChangedEvent: { create: function (aName, aProps) { return new BluetoothStatusChangedEvent(aName, aProps); }, diff --git a/dom/bluetooth/BluetoothAdapter.cpp b/dom/bluetooth/BluetoothAdapter.cpp index 98b3440d59b..007fa142e3f 100644 --- a/dom/bluetooth/BluetoothAdapter.cpp +++ b/dom/bluetooth/BluetoothAdapter.cpp @@ -9,6 +9,7 @@ #include "nsCxPusher.h" #include "nsDOMClassInfo.h" #include "nsIDOMBluetoothDeviceEvent.h" +#include "nsIDOMBluetoothDiscoveryStateChangedEvent.h" #include "nsIDOMBluetoothStatusChangedEvent.h" #include "nsTArrayHelpers.h" #include "DOMRequest.h" diff --git a/dom/bluetooth/interfaces/moz.build b/dom/bluetooth/interfaces/moz.build index 7d301fd59af..35024942882 100644 --- a/dom/bluetooth/interfaces/moz.build +++ b/dom/bluetooth/interfaces/moz.build @@ -8,6 +8,7 @@ if CONFIG['MOZ_B2G_BT']: XPIDL_SOURCES += [ 'nsIDOMBluetoothDevice.idl', 'nsIDOMBluetoothDeviceEvent.idl', + 'nsIDOMBluetoothDiscoveryStateChangedEvent.idl', 'nsIDOMBluetoothStatusChangedEvent.idl', ] XPIDL_MODULE = 'dom_bluetooth' diff --git a/dom/bluetooth/interfaces/nsIDOMBluetoothDiscoveryStateChangedEvent.idl b/dom/bluetooth/interfaces/nsIDOMBluetoothDiscoveryStateChangedEvent.idl new file mode 100644 index 00000000000..ae72d84d269 --- /dev/null +++ b/dom/bluetooth/interfaces/nsIDOMBluetoothDiscoveryStateChangedEvent.idl @@ -0,0 +1,22 @@ +/* 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 "nsIDOMEvent.idl" + +[scriptable, builtinclass, uuid(9de639cb-71c4-4144-8462-09763ec87c20)] +interface nsIDOMBluetoothDiscoveryStateChangedEvent : nsIDOMEvent +{ + readonly attribute boolean discovering; + + [noscript] + void initBluetoothDiscoveryStateChangedEvent(in DOMString aType, + in boolean aCanBubble, + in boolean aCancelable, + in boolean aDiscovering); +}; + +dictionary BluetoothDiscoveryStateChangedEventInit : EventInit +{ + bool discovering; +}; diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index 918c141e789..16ae7de6305 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -134,6 +134,7 @@ var interfaceNamesInGlobalScope = {name: "BluetoothAdapter", b2g: true}, {name: "BluetoothDevice", b2g: true}, {name: "BluetoothDeviceEvent", b2g: true}, + {name: "BluetoothDiscoveryStateChangedEvent", b2g: true}, {name: "BluetoothManager", b2g: true}, {name: "BluetoothStatusChangedEvent", b2g: true}, {name: "BoxObject", xbl: true}, diff --git a/dom/webidl/BluetoothDiscoveryStateChangedEvent.webidl b/dom/webidl/BluetoothDiscoveryStateChangedEvent.webidl new file mode 100644 index 00000000000..096c3a1a85e --- /dev/null +++ b/dom/webidl/BluetoothDiscoveryStateChangedEvent.webidl @@ -0,0 +1,16 @@ +/* -*- 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/. + */ + +[Constructor(DOMString type, optional BluetoothDiscoveryStateChangedEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"] +interface BluetoothDiscoveryStateChangedEvent : Event +{ + readonly attribute boolean discovering; +}; + +dictionary BluetoothDiscoveryStateChangedEventInit : EventInit +{ + boolean discovering = false; +}; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index c1edf4f603e..b138782f60f 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -503,6 +503,7 @@ if CONFIG['MOZ_B2G_BT']: 'BluetoothAdapter.webidl', 'BluetoothDevice.webidl', 'BluetoothDeviceEvent.webidl', + 'BluetoothDiscoveryStateChangedEvent.webidl', 'BluetoothManager.webidl', 'BluetoothStatusChangedEvent.webidl', ] diff --git a/js/xpconnect/src/event_impl_gen.conf.in b/js/xpconnect/src/event_impl_gen.conf.in index cc93ee6a588..d277286d610 100644 --- a/js/xpconnect/src/event_impl_gen.conf.in +++ b/js/xpconnect/src/event_impl_gen.conf.in @@ -30,6 +30,7 @@ simple_events = [ #ifdef MOZ_B2G_BT 'BluetoothDeviceEvent', 'BluetoothStatusChangedEvent', + 'BluetoothDiscoveryStateChangedEvent', #endif #ifdef MOZ_B2G_RIL 'CFStateChangeEvent',