зеркало из https://github.com/mozilla/gecko-dev.git
Bug 988111 - Unregister Bluetooth signal handler when BT objects were disconnected from owner window. r=echou, f=shuang
This commit is contained in:
Родитель
356f132f9d
Коммит
ff14390381
|
@ -173,7 +173,6 @@ BluetoothAdapter::BluetoothAdapter(nsPIDOMWindow* aWindow,
|
|||
MOZ_ASSERT(aWindow);
|
||||
MOZ_ASSERT(IsDOMBinding());
|
||||
|
||||
BindToOwner(aWindow);
|
||||
const InfallibleTArray<BluetoothNamedValue>& values =
|
||||
aValue.get_ArrayOfBluetoothNamedValue();
|
||||
for (uint32_t i = 0; i < values.Length(); ++i) {
|
||||
|
@ -194,6 +193,16 @@ BluetoothAdapter::~BluetoothAdapter()
|
|||
bs->UnregisterBluetoothSignalHandler(NS_LITERAL_STRING(KEY_ADAPTER), this);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::DisconnectFromOwner()
|
||||
{
|
||||
nsDOMEventTargetHelper::DisconnectFromOwner();
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
NS_ENSURE_TRUE_VOID(bs);
|
||||
bs->UnregisterBluetoothSignalHandler(NS_LITERAL_STRING(KEY_ADAPTER), this);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::Unroot()
|
||||
{
|
||||
|
|
|
@ -46,6 +46,8 @@ public:
|
|||
void Unroot();
|
||||
virtual void SetPropertyByValue(const BluetoothNamedValue& aValue) MOZ_OVERRIDE;
|
||||
|
||||
virtual void DisconnectFromOwner() MOZ_OVERRIDE;
|
||||
|
||||
void GetAddress(nsString& aAddress) const
|
||||
{
|
||||
aAddress = mAddress;
|
||||
|
|
|
@ -57,7 +57,6 @@ BluetoothDevice::BluetoothDevice(nsPIDOMWindow* aWindow,
|
|||
MOZ_ASSERT(aWindow);
|
||||
MOZ_ASSERT(IsDOMBinding());
|
||||
|
||||
BindToOwner(aWindow);
|
||||
const InfallibleTArray<BluetoothNamedValue>& values =
|
||||
aValue.get_ArrayOfBluetoothNamedValue();
|
||||
for (uint32_t i = 0; i < values.Length(); ++i) {
|
||||
|
@ -78,6 +77,16 @@ BluetoothDevice::~BluetoothDevice()
|
|||
Unroot();
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDevice::DisconnectFromOwner()
|
||||
{
|
||||
nsDOMEventTargetHelper::DisconnectFromOwner();
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
NS_ENSURE_TRUE_VOID(bs);
|
||||
bs->UnregisterBluetoothSignalHandler(mAddress, this);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDevice::Root()
|
||||
{
|
||||
|
|
|
@ -87,6 +87,8 @@ public:
|
|||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
virtual void DisconnectFromOwner() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
BluetoothDevice(nsPIDOMWindow* aOwner, const nsAString& aAdapterPath,
|
||||
const BluetoothValue& aValue);
|
||||
|
|
|
@ -105,7 +105,6 @@ BluetoothManager::BluetoothManager(nsPIDOMWindow *aWindow)
|
|||
MOZ_ASSERT(aWindow);
|
||||
MOZ_ASSERT(IsDOMBinding());
|
||||
|
||||
BindToOwner(aWindow);
|
||||
mPath.AssignLiteral("/");
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
|
@ -120,6 +119,16 @@ BluetoothManager::~BluetoothManager()
|
|||
bs->UnregisterBluetoothSignalHandler(NS_LITERAL_STRING(KEY_MANAGER), this);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothManager::DisconnectFromOwner()
|
||||
{
|
||||
nsDOMEventTargetHelper::DisconnectFromOwner();
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
NS_ENSURE_TRUE_VOID(bs);
|
||||
bs->UnregisterBluetoothSignalHandler(NS_LITERAL_STRING(KEY_MANAGER), this);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothManager::SetPropertyByValue(const BluetoothNamedValue& aValue)
|
||||
{
|
||||
|
|
|
@ -55,6 +55,8 @@ public:
|
|||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
virtual void DisconnectFromOwner() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
BluetoothManager(nsPIDOMWindow* aWindow);
|
||||
~BluetoothManager();
|
||||
|
|
Загрузка…
Ссылка в новой задаче