From 0ca1c2ac03b0b2fe68dbeb2ff2a112ab4caf6238 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 20 Dec 2013 11:33:37 +0100 Subject: [PATCH] Backout bug 942104 (changesets 4e5746a65a5e:62e32a84a9fb) for missing review. --- content/base/src/nsGkAtomList.h | 1 - .../test/test_all_synthetic_events.html | 4 --- dom/bluetooth/BluetoothAdapter.cpp | 14 ---------- dom/bluetooth/BluetoothAdapter.h | 1 - dom/bluetooth/BluetoothCommon.h | 5 ---- .../gonk/BluetoothServiceBluedroid.cpp | 27 +++++++++---------- .../bluez/linux/BluetoothDBusService.cpp | 14 ---------- dom/bluetooth/interfaces/moz.build | 1 - ...DOMBluetoothDiscoveryStateChangedEvent.idl | 22 --------------- .../mochitest/general/test_interfaces.html | 1 - dom/webidl/BluetoothAdapter.webidl | 1 - ...BluetoothDiscoveryStateChangedEvent.webidl | 16 ----------- dom/webidl/moz.build | 1 - js/xpconnect/src/event_impl_gen.conf.in | 1 - 14 files changed, 12 insertions(+), 97 deletions(-) delete mode 100644 dom/bluetooth/interfaces/nsIDOMBluetoothDiscoveryStateChangedEvent.idl delete mode 100644 dom/webidl/BluetoothDiscoveryStateChangedEvent.webidl diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 1a6c12a17c90..5c234686e12d 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -684,7 +684,6 @@ GK_ATOM(ondisabled, "ondisabled") GK_ATOM(ondischargingtimechange, "ondischargingtimechange") GK_ATOM(ondisconnected, "ondisconnected") GK_ATOM(ondisconnecting, "ondisconnecting") -GK_ATOM(ondiscoverystatechanged, "ondiscoverystatechanged") GK_ATOM(ondownloading, "ondownloading") GK_ATOM(onDOMActivate, "onDOMActivate") GK_ATOM(onDOMAttrModified, "onDOMAttrModified") diff --git a/content/events/test/test_all_synthetic_events.html b/content/events/test/test_all_synthetic_events.html index 940509a612ad..fbef23faf409 100644 --- a/content/events/test/test_all_synthetic_events.html +++ b/content/events/test/test_all_synthetic_events.html @@ -48,10 +48,6 @@ 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 0b3ec6c2755f..98b3440d59b4 100644 --- a/dom/bluetooth/BluetoothAdapter.cpp +++ b/dom/bluetooth/BluetoothAdapter.cpp @@ -9,7 +9,6 @@ #include "nsCxPusher.h" #include "nsDOMClassInfo.h" #include "nsIDOMBluetoothDeviceEvent.h" -#include "nsIDOMBluetoothDiscoveryStateChangedEvent.h" #include "nsIDOMBluetoothStatusChangedEvent.h" #include "nsTArrayHelpers.h" #include "DOMRequest.h" @@ -321,19 +320,6 @@ BluetoothAdapter::Notify(const BluetoothSignal& aData) MOZ_ASSERT(arr.Length() == 1); SetPropertyByValue(arr[0]); - } else if (aData.name().EqualsLiteral(DISCOVERY_STATE_CHANGED_ID)) { - MOZ_ASSERT(v.type() == BluetoothValue::Tbool); - bool isDiscovering = v.get_bool(); - - nsCOMPtr event; - NS_NewDOMBluetoothDiscoveryStateChangedEvent( - getter_AddRefs(event), this, nullptr, nullptr); - - nsCOMPtr e = - do_QueryInterface(event); - e->InitBluetoothDiscoveryStateChangedEvent(aData.name(), false, false, - isDiscovering); - DispatchTrustedEvent(event); } else if (aData.name().EqualsLiteral(PAIRED_STATUS_CHANGED_ID) || aData.name().EqualsLiteral(HFP_STATUS_CHANGED_ID) || aData.name().EqualsLiteral(SCO_STATUS_CHANGED_ID) || diff --git a/dom/bluetooth/BluetoothAdapter.h b/dom/bluetooth/BluetoothAdapter.h index 52b1b3af17dd..e2838f30e4c5 100644 --- a/dom/bluetooth/BluetoothAdapter.h +++ b/dom/bluetooth/BluetoothAdapter.h @@ -147,7 +147,6 @@ public: SendMediaPlayStatus(const MediaPlayStatus& aMediaPlayStatus, ErrorResult& aRv); IMPL_EVENT_HANDLER(devicefound); - IMPL_EVENT_HANDLER(discoverystatechanged); IMPL_EVENT_HANDLER(a2dpstatuschanged); IMPL_EVENT_HANDLER(hfpstatuschanged); IMPL_EVENT_HANDLER(pairedstatuschanged); diff --git a/dom/bluetooth/BluetoothCommon.h b/dom/bluetooth/BluetoothCommon.h index 772b7204e119..84a7361f0259 100644 --- a/dom/bluetooth/BluetoothCommon.h +++ b/dom/bluetooth/BluetoothCommon.h @@ -89,11 +89,6 @@ extern bool gBluetoothDebugFlag; */ #define PAIRED_STATUS_CHANGED_ID "pairedstatuschanged" - /** - * This event would be fired when discovery procedure starts or stops. - */ -#define DISCOVERY_STATE_CHANGED_ID "discoverystatechanged" - /** * When receiving a query about current play status from remote device, we'll * dispatch an event. diff --git a/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.cpp b/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.cpp index 3bdd70cdcef7..b35e937c9dfb 100644 --- a/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.cpp @@ -49,6 +49,7 @@ static InfallibleTArray sAdapterBondedAddressArray; static InfallibleTArray sRemoteDevicesPack; static nsTArray > sControllerArray; static nsTArray > sBondingRunnableArray; +static nsTArray > sChangeDiscoveryRunnableArray; static nsTArray > sGetDeviceRunnableArray; static nsTArray > sSetPropertyRunnableArray; static nsTArray > sUnbondingRunnableArray; @@ -495,16 +496,12 @@ DiscoveryStateChangedCallback(bt_discovery_state_t aState) { MOZ_ASSERT(!NS_IsMainThread()); - bool isDiscovering = (aState == BT_DISCOVERY_STARTED); + if (!sChangeDiscoveryRunnableArray.IsEmpty()) { + BluetoothValue values(true); + DispatchBluetoothReply(sChangeDiscoveryRunnableArray[0], + values, EmptyString()); - BluetoothSignal signal(NS_LITERAL_STRING(DISCOVERY_STATE_CHANGED_ID), - NS_LITERAL_STRING(KEY_ADAPTER), - isDiscovering); - - nsRefPtr - t = new DistributeBluetoothSignalTask(signal); - if (NS_FAILED(NS_DispatchToMainThread(t))) { - BT_WARNING("Failed to dispatch to main thread!"); + sChangeDiscoveryRunnableArray.RemoveElementAt(0); } } @@ -921,17 +918,17 @@ BluetoothServiceBluedroid::StartDiscoveryInternal( if (!IsReady()) { NS_NAMED_LITERAL_STRING(errorStr, "Bluetooth service is not ready yet!"); DispatchBluetoothReply(aRunnable, BluetoothValue(), errorStr); + return NS_OK; } - int ret = sBtInterface->start_discovery(); if (ret != BT_STATUS_SUCCESS) { ReplyStatusError(aRunnable, ret, NS_LITERAL_STRING("StartDiscovery")); - return NS_ERROR_FAILURE; + + return NS_OK; } - DispatchBluetoothReply(aRunnable, true, EmptyString()); - + sChangeDiscoveryRunnableArray.AppendElement(aRunnable); return NS_OK; } @@ -950,10 +947,10 @@ BluetoothServiceBluedroid::StopDiscoveryInternal( int ret = sBtInterface->cancel_discovery(); if (ret != BT_STATUS_SUCCESS) { ReplyStatusError(aRunnable, ret, NS_LITERAL_STRING("StopDiscovery")); - return NS_ERROR_FAILURE; + return NS_OK; } - DispatchBluetoothReply(aRunnable, true, EmptyString()); + sChangeDiscoveryRunnableArray.AppendElement(aRunnable); return NS_OK; } diff --git a/dom/bluetooth/bluez/linux/BluetoothDBusService.cpp b/dom/bluetooth/bluez/linux/BluetoothDBusService.cpp index f1cbd7a1f337..b69a0a1095e8 100644 --- a/dom/bluetooth/bluez/linux/BluetoothDBusService.cpp +++ b/dom/bluetooth/bluez/linux/BluetoothDBusService.cpp @@ -1512,20 +1512,6 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData) errorStr, sAdapterProperties, ArrayLength(sAdapterProperties)); - - BluetoothNamedValue& property = v.get_ArrayOfBluetoothNamedValue()[0]; - if (property.name().EqualsLiteral("Discovering")) { - bool isDiscovering = property.value(); - BluetoothSignal signal(NS_LITERAL_STRING(DISCOVERY_STATE_CHANGED_ID), - NS_LITERAL_STRING(KEY_ADAPTER), - isDiscovering); - - nsRefPtr - t = new DistributeBluetoothSignalTask(signal); - if (NS_FAILED(NS_DispatchToMainThread(t))) { - BT_WARNING("Failed to dispatch to main thread!"); - } - } } else if (dbus_message_is_signal(aMsg, DBUS_DEVICE_IFACE, "PropertyChanged")) { ParsePropertyChange(aMsg, diff --git a/dom/bluetooth/interfaces/moz.build b/dom/bluetooth/interfaces/moz.build index 350249428822..7d301fd59af5 100644 --- a/dom/bluetooth/interfaces/moz.build +++ b/dom/bluetooth/interfaces/moz.build @@ -8,7 +8,6 @@ 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 deleted file mode 100644 index ae72d84d2692..000000000000 --- a/dom/bluetooth/interfaces/nsIDOMBluetoothDiscoveryStateChangedEvent.idl +++ /dev/null @@ -1,22 +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 "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 16ae7de6305d..918c141e789d 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -134,7 +134,6 @@ 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/BluetoothAdapter.webidl b/dom/webidl/BluetoothAdapter.webidl index d9e1af7805a5..1be77505fe20 100644 --- a/dom/webidl/BluetoothAdapter.webidl +++ b/dom/webidl/BluetoothAdapter.webidl @@ -49,7 +49,6 @@ interface BluetoothAdapter : EventTarget { readonly attribute any uuids; attribute EventHandler ondevicefound; - attribute EventHandler ondiscoverystatechanged; // Fired when pairing process is completed attribute EventHandler onpairedstatuschanged; diff --git a/dom/webidl/BluetoothDiscoveryStateChangedEvent.webidl b/dom/webidl/BluetoothDiscoveryStateChangedEvent.webidl deleted file mode 100644 index 096c3a1a85ef..000000000000 --- a/dom/webidl/BluetoothDiscoveryStateChangedEvent.webidl +++ /dev/null @@ -1,16 +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/. - */ - -[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 b138782f60f2..c1edf4f603ec 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -503,7 +503,6 @@ 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 d277286d6107..cc93ee6a5880 100644 --- a/js/xpconnect/src/event_impl_gen.conf.in +++ b/js/xpconnect/src/event_impl_gen.conf.in @@ -30,7 +30,6 @@ simple_events = [ #ifdef MOZ_B2G_BT 'BluetoothDeviceEvent', 'BluetoothStatusChangedEvent', - 'BluetoothDiscoveryStateChangedEvent', #endif #ifdef MOZ_B2G_RIL 'CFStateChangeEvent',