Bug 980039 - Don't create BT adapter if the owner window of BT manager was cleaned up. r=echou, f=shuang

It's meaningless to create a adapter for a BluetoothManager which was disconnected from its owner window.
This commit is contained in:
Jamin Liu 2014-04-01 08:58:55 -04:00
parent ac3e84ab48
commit f952f1aad2

View File

@ -52,6 +52,15 @@ public:
return false; return false;
} }
if (!mManagerPtr->GetOwner()) {
BT_WARNING("Bluetooth manager was disconnected from owner window.");
// Stop to create adapter since owner window of Bluetooth manager was
// gone. These is no need to create a DOMEvent target which has no owner
// to reply to.
return false;
}
const InfallibleTArray<BluetoothNamedValue>& values = const InfallibleTArray<BluetoothNamedValue>& values =
v.get_ArrayOfBluetoothNamedValue(); v.get_ArrayOfBluetoothNamedValue();
nsRefPtr<BluetoothAdapter> adapter = nsRefPtr<BluetoothAdapter> adapter =