зеркало из https://github.com/mozilla/gecko-dev.git
Merge b2g-inbound to m-c. a=merge
This commit is contained in:
Коммит
62bfc4ddfb
|
@ -19,8 +19,8 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="227354333a185180b85471f2cc6abfb029e44718"/>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
|
@ -133,7 +133,7 @@
|
|||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="683623c76338dccd65e698bfb5c4cfee8808d799"/>
|
||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9f28c4faea3b2f01db227b2467b08aeba96d9bec"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="02104803f873a4d5cf9fb611a211b83450e9dfba"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="a7141c4799ac2eb09ac3fe9476bfd066b21285e1"/>
|
||||
<project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/>
|
||||
<project name="darwinstreamingserver" path="system/darwinstreamingserver" remote="b2g" revision="cf85968c7f85e0ec36e72c87ceb4837a943b8af6"/>
|
||||
</manifest>
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="7945ca73e687be5edbc7b928dc7fe3a208242144">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="227354333a185180b85471f2cc6abfb029e44718"/>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
|
@ -145,7 +145,7 @@
|
|||
<project name="platform/hardware/ril" path="hardware/ril" revision="c4e2ac95907a5519a0e09f01a0d8e27fec101af0"/>
|
||||
<project name="platform/system/bluetooth" path="system/bluetooth" revision="e1eb226fa3ad3874ea7b63c56a9dc7012d7ff3c2"/>
|
||||
<project name="platform/system/core" path="system/core" revision="b33c9a7b8eefbeaf480f0b8f9af2c6a8a35b0aee"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="02104803f873a4d5cf9fb611a211b83450e9dfba"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="a7141c4799ac2eb09ac3fe9476bfd066b21285e1"/>
|
||||
<project name="platform/system/qcom" path="system/qcom" revision="1cdab258b15258b7f9657da70e6f06ebd5a2fc25"/>
|
||||
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4ae5df252123591d5b941191790e7abed1bce5a4"/>
|
||||
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="ce18b47b4a4f93a581d672bbd5cb6d12fe796ca9"/>
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
"remote": "",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "41b3413a893fef684b380bb344f9d4a5f491f858",
|
||||
"revision": "716b4db65f6425fa3c66fa11bdd7d27a373d596a",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
|
@ -129,7 +129,7 @@
|
|||
<project name="device-mako" path="device/lge/mako" remote="b2g" revision="78d17f0c117f0c66dd55ee8d5c5dde8ccc93ecba"/>
|
||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
|
||||
<project name="device/lge/mako-kernel" path="device/lge/mako-kernel" revision="d1729e53d71d711c8fde25eab8728ff2b9b4df0e"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="02104803f873a4d5cf9fb611a211b83450e9dfba"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="a7141c4799ac2eb09ac3fe9476bfd066b21285e1"/>
|
||||
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
|
||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
|
||||
<project name="platform/hardware/broadcom/wlan" path="hardware/broadcom/wlan" revision="0e1929fa3aa38bf9d40e9e953d619fab8164c82e"/>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
|
|
|
@ -13,6 +13,16 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#if MOZ_IS_GCC && MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
|
||||
/* use designated array initializers if supported */
|
||||
#define CONVERT(in_, out_) \
|
||||
[in_] = out_
|
||||
#else
|
||||
/* otherwise init array element by position */
|
||||
#define CONVERT(in_, out_) \
|
||||
out_
|
||||
#endif
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
template<class T>
|
||||
|
@ -27,17 +37,17 @@ static nsresult
|
|||
Convert(bt_status_t aIn, BluetoothStatus& aOut)
|
||||
{
|
||||
static const BluetoothStatus sStatus[] = {
|
||||
[BT_STATUS_SUCCESS] = STATUS_SUCCESS,
|
||||
[BT_STATUS_FAIL] = STATUS_FAIL,
|
||||
[BT_STATUS_NOT_READY] = STATUS_NOT_READY,
|
||||
[BT_STATUS_NOMEM] = STATUS_NOMEM,
|
||||
[BT_STATUS_BUSY] = STATUS_BUSY,
|
||||
[BT_STATUS_DONE] = STATUS_DONE,
|
||||
[BT_STATUS_UNSUPPORTED] = STATUS_UNSUPPORTED,
|
||||
[BT_STATUS_PARM_INVALID] = STATUS_PARM_INVALID,
|
||||
[BT_STATUS_UNHANDLED] = STATUS_UNHANDLED,
|
||||
[BT_STATUS_AUTH_FAILURE] = STATUS_AUTH_FAILURE,
|
||||
[BT_STATUS_RMT_DEV_DOWN] = STATUS_RMT_DEV_DOWN
|
||||
CONVERT(BT_STATUS_SUCCESS, STATUS_SUCCESS),
|
||||
CONVERT(BT_STATUS_FAIL, STATUS_FAIL),
|
||||
CONVERT(BT_STATUS_NOT_READY, STATUS_NOT_READY),
|
||||
CONVERT(BT_STATUS_NOMEM, STATUS_NOMEM),
|
||||
CONVERT(BT_STATUS_BUSY, STATUS_BUSY),
|
||||
CONVERT(BT_STATUS_DONE, STATUS_DONE),
|
||||
CONVERT(BT_STATUS_UNSUPPORTED, STATUS_UNSUPPORTED),
|
||||
CONVERT(BT_STATUS_PARM_INVALID, STATUS_PARM_INVALID),
|
||||
CONVERT(BT_STATUS_UNHANDLED, STATUS_UNHANDLED),
|
||||
CONVERT(BT_STATUS_AUTH_FAILURE, STATUS_AUTH_FAILURE),
|
||||
CONVERT(BT_STATUS_RMT_DEV_DOWN, STATUS_RMT_DEV_DOWN)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sStatus)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -72,8 +82,8 @@ static nsresult
|
|||
Convert(bool aIn, bt_scan_mode_t& aOut)
|
||||
{
|
||||
static const bt_scan_mode_t sScanMode[] = {
|
||||
[false] = BT_SCAN_MODE_CONNECTABLE,
|
||||
[true] = BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
|
||||
CONVERT(false, BT_SCAN_MODE_CONNECTABLE),
|
||||
CONVERT(true, BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sScanMode)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -238,10 +248,10 @@ Convert(BluetoothSocketType aIn, btsock_type_t& aOut)
|
|||
// by gcc. Start values in |BluetoothSocketType| at index
|
||||
// 0 to fix this problem.
|
||||
static const btsock_type_t sSocketType[] = {
|
||||
[0] = static_cast<btsock_type_t>(0), // invalid, [0] required by gcc
|
||||
[BluetoothSocketType::RFCOMM] = BTSOCK_RFCOMM,
|
||||
[BluetoothSocketType::SCO] = BTSOCK_SCO,
|
||||
[BluetoothSocketType::L2CAP] = BTSOCK_L2CAP,
|
||||
CONVERT(0, static_cast<btsock_type_t>(0)), // invalid, [0] required by gcc
|
||||
CONVERT(BluetoothSocketType::RFCOMM, BTSOCK_RFCOMM),
|
||||
CONVERT(BluetoothSocketType::SCO, BTSOCK_SCO),
|
||||
CONVERT(BluetoothSocketType::L2CAP, BTSOCK_L2CAP),
|
||||
// EL2CAP is not supported by Bluedroid
|
||||
};
|
||||
if (aIn == BluetoothSocketType::EL2CAP ||
|
||||
|
@ -256,8 +266,8 @@ static nsresult
|
|||
Convert(BluetoothHandsfreeAtResponse aIn, bthf_at_response_t& aOut)
|
||||
{
|
||||
static const bthf_at_response_t sAtResponse[] = {
|
||||
[HFP_AT_RESPONSE_ERROR] = BTHF_AT_RESPONSE_ERROR,
|
||||
[HFP_AT_RESPONSE_OK] = BTHF_AT_RESPONSE_OK
|
||||
CONVERT(HFP_AT_RESPONSE_ERROR, BTHF_AT_RESPONSE_ERROR),
|
||||
CONVERT(HFP_AT_RESPONSE_OK, BTHF_AT_RESPONSE_OK)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sAtResponse)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -270,8 +280,9 @@ static nsresult
|
|||
Convert(BluetoothHandsfreeCallAddressType aIn, bthf_call_addrtype_t& aOut)
|
||||
{
|
||||
static const bthf_call_addrtype_t sCallAddressType[] = {
|
||||
[HFP_CALL_ADDRESS_TYPE_UNKNOWN] = BTHF_CALL_ADDRTYPE_UNKNOWN,
|
||||
[HFP_CALL_ADDRESS_TYPE_INTERNATIONAL] = BTHF_CALL_ADDRTYPE_INTERNATIONAL
|
||||
CONVERT(HFP_CALL_ADDRESS_TYPE_UNKNOWN, BTHF_CALL_ADDRTYPE_UNKNOWN),
|
||||
CONVERT(HFP_CALL_ADDRESS_TYPE_INTERNATIONAL,
|
||||
BTHF_CALL_ADDRTYPE_INTERNATIONAL)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sCallAddressType)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -284,8 +295,8 @@ static nsresult
|
|||
Convert(BluetoothHandsfreeCallDirection aIn, bthf_call_direction_t& aOut)
|
||||
{
|
||||
static const bthf_call_direction_t sCallDirection[] = {
|
||||
[HFP_CALL_DIRECTION_OUTGOING] = BTHF_CALL_DIRECTION_OUTGOING,
|
||||
[HFP_CALL_DIRECTION_INCOMING] = BTHF_CALL_DIRECTION_INCOMING
|
||||
CONVERT(HFP_CALL_DIRECTION_OUTGOING, BTHF_CALL_DIRECTION_OUTGOING),
|
||||
CONVERT(HFP_CALL_DIRECTION_INCOMING, BTHF_CALL_DIRECTION_INCOMING)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sCallDirection)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -298,9 +309,9 @@ static nsresult
|
|||
Convert(BluetoothHandsfreeCallMode aIn, bthf_call_mode_t& aOut)
|
||||
{
|
||||
static const bthf_call_mode_t sCallMode[] = {
|
||||
[HFP_CALL_MODE_VOICE] = BTHF_CALL_TYPE_VOICE,
|
||||
[HFP_CALL_MODE_DATA] = BTHF_CALL_TYPE_DATA,
|
||||
[HFP_CALL_MODE_FAX] = BTHF_CALL_TYPE_FAX
|
||||
CONVERT(HFP_CALL_MODE_VOICE, BTHF_CALL_TYPE_VOICE),
|
||||
CONVERT(HFP_CALL_MODE_DATA, BTHF_CALL_TYPE_DATA),
|
||||
CONVERT(HFP_CALL_MODE_FAX, BTHF_CALL_TYPE_FAX)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sCallMode)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -313,8 +324,8 @@ static nsresult
|
|||
Convert(BluetoothHandsfreeCallMptyType aIn, bthf_call_mpty_type_t& aOut)
|
||||
{
|
||||
static const bthf_call_mpty_type_t sCallMptyType[] = {
|
||||
[HFP_CALL_MPTY_TYPE_SINGLE] = BTHF_CALL_MPTY_TYPE_SINGLE,
|
||||
[HFP_CALL_MPTY_TYPE_MULTI] = BTHF_CALL_MPTY_TYPE_MULTI
|
||||
CONVERT(HFP_CALL_MPTY_TYPE_SINGLE, BTHF_CALL_MPTY_TYPE_SINGLE),
|
||||
CONVERT(HFP_CALL_MPTY_TYPE_MULTI, BTHF_CALL_MPTY_TYPE_MULTI)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sCallMptyType)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -327,13 +338,13 @@ static nsresult
|
|||
Convert(BluetoothHandsfreeCallState aIn, bthf_call_state_t& aOut)
|
||||
{
|
||||
static const bthf_call_state_t sCallState[] = {
|
||||
[HFP_CALL_STATE_ACTIVE] = BTHF_CALL_STATE_ACTIVE,
|
||||
[HFP_CALL_STATE_HELD] = BTHF_CALL_STATE_HELD,
|
||||
[HFP_CALL_STATE_DIALING] = BTHF_CALL_STATE_DIALING,
|
||||
[HFP_CALL_STATE_ALERTING] = BTHF_CALL_STATE_ALERTING,
|
||||
[HFP_CALL_STATE_INCOMING] = BTHF_CALL_STATE_INCOMING,
|
||||
[HFP_CALL_STATE_WAITING] = BTHF_CALL_STATE_WAITING,
|
||||
[HFP_CALL_STATE_IDLE] = BTHF_CALL_STATE_IDLE
|
||||
CONVERT(HFP_CALL_STATE_ACTIVE, BTHF_CALL_STATE_ACTIVE),
|
||||
CONVERT(HFP_CALL_STATE_HELD, BTHF_CALL_STATE_HELD),
|
||||
CONVERT(HFP_CALL_STATE_DIALING, BTHF_CALL_STATE_DIALING),
|
||||
CONVERT(HFP_CALL_STATE_ALERTING, BTHF_CALL_STATE_ALERTING),
|
||||
CONVERT(HFP_CALL_STATE_INCOMING, BTHF_CALL_STATE_INCOMING),
|
||||
CONVERT(HFP_CALL_STATE_WAITING, BTHF_CALL_STATE_WAITING),
|
||||
CONVERT(HFP_CALL_STATE_IDLE, BTHF_CALL_STATE_IDLE)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sCallState)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -346,8 +357,8 @@ static nsresult
|
|||
Convert(BluetoothHandsfreeNetworkState aIn, bthf_network_state_t& aOut)
|
||||
{
|
||||
static const bthf_network_state_t sNetworkState[] = {
|
||||
[HFP_NETWORK_STATE_NOT_AVAILABLE] = BTHF_NETWORK_STATE_NOT_AVAILABLE,
|
||||
[HFP_NETWORK_STATE_AVAILABLE] = BTHF_NETWORK_STATE_AVAILABLE
|
||||
CONVERT(HFP_NETWORK_STATE_NOT_AVAILABLE, BTHF_NETWORK_STATE_NOT_AVAILABLE),
|
||||
CONVERT(HFP_NETWORK_STATE_AVAILABLE, BTHF_NETWORK_STATE_AVAILABLE)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sNetworkState)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -360,8 +371,8 @@ static nsresult
|
|||
Convert(BluetoothHandsfreeServiceType aIn, bthf_service_type_t& aOut)
|
||||
{
|
||||
static const bthf_service_type_t sServiceType[] = {
|
||||
[HFP_SERVICE_TYPE_HOME] = BTHF_SERVICE_TYPE_HOME,
|
||||
[HFP_SERVICE_TYPE_ROAMING] = BTHF_SERVICE_TYPE_ROAMING
|
||||
CONVERT(HFP_SERVICE_TYPE_HOME, BTHF_SERVICE_TYPE_HOME),
|
||||
CONVERT(HFP_SERVICE_TYPE_ROAMING, BTHF_SERVICE_TYPE_ROAMING)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sServiceType)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -374,8 +385,8 @@ static nsresult
|
|||
Convert(BluetoothHandsfreeVolumeType aIn, bthf_volume_type_t& aOut)
|
||||
{
|
||||
static const bthf_volume_type_t sVolumeType[] = {
|
||||
[HFP_VOLUME_TYPE_SPEAKER] = BTHF_VOLUME_TYPE_SPK,
|
||||
[HFP_VOLUME_TYPE_MICROPHONE] = BTHF_VOLUME_TYPE_MIC
|
||||
CONVERT(HFP_VOLUME_TYPE_SPEAKER, BTHF_VOLUME_TYPE_SPK),
|
||||
CONVERT(HFP_VOLUME_TYPE_MICROPHONE, BTHF_VOLUME_TYPE_MIC)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sVolumeType)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -389,11 +400,11 @@ static nsresult
|
|||
Convert(ControlPlayStatus aIn, btrc_play_status_t& aOut)
|
||||
{
|
||||
static const btrc_play_status_t sPlayStatus[] = {
|
||||
[PLAYSTATUS_STOPPED] = BTRC_PLAYSTATE_STOPPED,
|
||||
[PLAYSTATUS_PLAYING] = BTRC_PLAYSTATE_PLAYING,
|
||||
[PLAYSTATUS_PAUSED] = BTRC_PLAYSTATE_PAUSED,
|
||||
[PLAYSTATUS_FWD_SEEK] = BTRC_PLAYSTATE_FWD_SEEK,
|
||||
[PLAYSTATUS_REV_SEEK] = BTRC_PLAYSTATE_REV_SEEK
|
||||
CONVERT(PLAYSTATUS_STOPPED, BTRC_PLAYSTATE_STOPPED),
|
||||
CONVERT(PLAYSTATUS_PLAYING, BTRC_PLAYSTATE_PLAYING),
|
||||
CONVERT(PLAYSTATUS_PAUSED, BTRC_PLAYSTATE_PAUSED),
|
||||
CONVERT(PLAYSTATUS_FWD_SEEK, BTRC_PLAYSTATE_FWD_SEEK),
|
||||
CONVERT(PLAYSTATUS_REV_SEEK, BTRC_PLAYSTATE_REV_SEEK)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sPlayStatus)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -406,10 +417,10 @@ static nsresult
|
|||
Convert(enum BluetoothAvrcpPlayerAttribute aIn, btrc_player_attr_t& aOut)
|
||||
{
|
||||
static const btrc_player_attr_t sPlayerAttr[] = {
|
||||
[AVRCP_PLAYER_ATTRIBUTE_EQUALIZER] = BTRC_PLAYER_ATTR_EQUALIZER,
|
||||
[AVRCP_PLAYER_ATTRIBUTE_REPEAT] = BTRC_PLAYER_ATTR_REPEAT,
|
||||
[AVRCP_PLAYER_ATTRIBUTE_SHUFFLE] = BTRC_PLAYER_ATTR_SHUFFLE,
|
||||
[AVRCP_PLAYER_ATTRIBUTE_SCAN] = BTRC_PLAYER_ATTR_SCAN
|
||||
CONVERT(AVRCP_PLAYER_ATTRIBUTE_EQUALIZER, BTRC_PLAYER_ATTR_EQUALIZER),
|
||||
CONVERT(AVRCP_PLAYER_ATTRIBUTE_REPEAT, BTRC_PLAYER_ATTR_REPEAT),
|
||||
CONVERT(AVRCP_PLAYER_ATTRIBUTE_SHUFFLE, BTRC_PLAYER_ATTR_SHUFFLE),
|
||||
CONVERT(AVRCP_PLAYER_ATTRIBUTE_SCAN, BTRC_PLAYER_ATTR_SCAN)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sPlayerAttr)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -422,11 +433,11 @@ static nsresult
|
|||
Convert(enum BluetoothAvrcpStatus aIn, btrc_status_t& aOut)
|
||||
{
|
||||
static const btrc_status_t sStatus[] = {
|
||||
[AVRCP_STATUS_BAD_COMMAND] = BTRC_STS_BAD_CMD,
|
||||
[AVRCP_STATUS_BAD_PARAMETER] = BTRC_STS_BAD_PARAM,
|
||||
[AVRCP_STATUS_NOT_FOUND] = BTRC_STS_NOT_FOUND,
|
||||
[AVRCP_STATUS_INTERNAL_ERROR] = BTRC_STS_INTERNAL_ERR,
|
||||
[AVRCP_STATUS_SUCCESS] = BTRC_STS_NO_ERROR
|
||||
CONVERT(AVRCP_STATUS_BAD_COMMAND, BTRC_STS_BAD_CMD),
|
||||
CONVERT(AVRCP_STATUS_BAD_PARAMETER, BTRC_STS_BAD_PARAM),
|
||||
CONVERT(AVRCP_STATUS_NOT_FOUND, BTRC_STS_NOT_FOUND),
|
||||
CONVERT(AVRCP_STATUS_INTERNAL_ERROR, BTRC_STS_INTERNAL_ERR),
|
||||
CONVERT(AVRCP_STATUS_SUCCESS, BTRC_STS_NO_ERROR)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sStatus)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -439,12 +450,12 @@ static nsresult
|
|||
Convert(enum BluetoothAvrcpEvent aIn, btrc_event_id_t& aOut)
|
||||
{
|
||||
static const btrc_event_id_t sEventId[] = {
|
||||
[AVRCP_EVENT_PLAY_STATUS_CHANGED] = BTRC_EVT_PLAY_STATUS_CHANGED,
|
||||
[AVRCP_EVENT_TRACK_CHANGE] = BTRC_EVT_TRACK_CHANGE,
|
||||
[AVRCP_EVENT_TRACK_REACHED_END] = BTRC_EVT_TRACK_REACHED_END,
|
||||
[AVRCP_EVENT_TRACK_REACHED_START] = BTRC_EVT_TRACK_REACHED_START,
|
||||
[AVRCP_EVENT_PLAY_POS_CHANGED] = BTRC_EVT_PLAY_POS_CHANGED,
|
||||
[AVRCP_EVENT_APP_SETTINGS_CHANGED] = BTRC_EVT_APP_SETTINGS_CHANGED
|
||||
CONVERT(AVRCP_EVENT_PLAY_STATUS_CHANGED, BTRC_EVT_PLAY_STATUS_CHANGED),
|
||||
CONVERT(AVRCP_EVENT_TRACK_CHANGE, BTRC_EVT_TRACK_CHANGE),
|
||||
CONVERT(AVRCP_EVENT_TRACK_REACHED_END, BTRC_EVT_TRACK_REACHED_END),
|
||||
CONVERT(AVRCP_EVENT_TRACK_REACHED_START, BTRC_EVT_TRACK_REACHED_START),
|
||||
CONVERT(AVRCP_EVENT_PLAY_POS_CHANGED, BTRC_EVT_PLAY_POS_CHANGED),
|
||||
CONVERT(AVRCP_EVENT_APP_SETTINGS_CHANGED, BTRC_EVT_APP_SETTINGS_CHANGED)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sEventId)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -457,8 +468,8 @@ static nsresult
|
|||
Convert(enum BluetoothAvrcpNotification aIn, btrc_notification_type_t& aOut)
|
||||
{
|
||||
static const btrc_notification_type_t sNotificationType[] = {
|
||||
[AVRCP_NTF_INTERIM] = BTRC_NOTIFICATION_TYPE_INTERIM,
|
||||
[AVRCP_NTF_CHANGED] = BTRC_NOTIFICATION_TYPE_CHANGED
|
||||
CONVERT(AVRCP_NTF_INTERIM, BTRC_NOTIFICATION_TYPE_INTERIM),
|
||||
CONVERT(AVRCP_NTF_CHANGED, BTRC_NOTIFICATION_TYPE_CHANGED)
|
||||
};
|
||||
if (aIn >= MOZ_ARRAY_LENGTH(sNotificationType)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "nsDataHashtable.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
|
@ -373,6 +374,7 @@ DispatchToBtThread(nsIRunnable* aRunnable)
|
|||
sBluetoothThread = new LazyIdleThread(BT_LAZY_THREAD_TIMEOUT_MS,
|
||||
NS_LITERAL_CSTRING("BluetoothDBusService"),
|
||||
LazyIdleThread::ManualShutdown);
|
||||
ClearOnShutdown(&sBluetoothThread);
|
||||
}
|
||||
return sBluetoothThread->Dispatch(aRunnable, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
|
|
@ -705,17 +705,13 @@ function getDefaultAdapter() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
* Wait for pending emulator transactions and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
waitFor(function() {
|
||||
SpecialPowers.flushPermissions(function() {
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, "permissions flushed");
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, ":: CLEANING UP ::");
|
||||
|
||||
finish();
|
||||
});
|
||||
}, function() {
|
||||
waitFor(finish, function() {
|
||||
return pendingEmulatorCmdCount === 0;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ private:
|
|||
void (Obj::*mMethod)();
|
||||
};
|
||||
|
||||
template <typename Obj, typename Res, typename Arg1>
|
||||
template <typename Obj, typename Res, typename Tin1, typename Arg1>
|
||||
class BluetoothInterfaceRunnable1 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
|
@ -70,11 +70,12 @@ public:
|
|||
|
||||
private:
|
||||
nsRefPtr<Obj> mObj;
|
||||
void (Obj::*mMethod)(Arg1);
|
||||
Arg1 mArg1;
|
||||
Res (Obj::*mMethod)(Arg1);
|
||||
Tin1 mArg1;
|
||||
};
|
||||
|
||||
template <typename Obj, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Arg1, typename Arg2, typename Arg3>
|
||||
class BluetoothInterfaceRunnable3 : public nsRunnable
|
||||
{
|
||||
|
@ -102,10 +103,10 @@ public:
|
|||
|
||||
private:
|
||||
nsRefPtr<Obj> mObj;
|
||||
void (Obj::*mMethod)(Arg1, Arg2, Arg3);
|
||||
Arg1 mArg1;
|
||||
Arg2 mArg2;
|
||||
Arg3 mArg3;
|
||||
Res (Obj::*mMethod)(Arg1, Arg2, Arg3);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -124,16 +125,18 @@ struct interface_traits<BluetoothSocketInterface>
|
|||
};
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable1<BluetoothSocketResultHandler, void, int>
|
||||
BluetoothInterfaceRunnable1<BluetoothSocketResultHandler, void, int, int>
|
||||
BluetoothSocketIntResultRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable3<BluetoothSocketResultHandler,
|
||||
void, int, const nsAString_internal&, int>
|
||||
BluetoothInterfaceRunnable3<BluetoothSocketResultHandler, void,
|
||||
int, const nsString, int,
|
||||
int, const nsAString_internal&, int>
|
||||
BluetoothSocketIntStringIntResultRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable1<BluetoothSocketResultHandler, void, bt_status_t>
|
||||
BluetoothInterfaceRunnable1<BluetoothSocketResultHandler, void,
|
||||
bt_status_t, bt_status_t>
|
||||
BluetoothSocketErrorRunnable;
|
||||
|
||||
static nsresult
|
||||
|
@ -581,7 +584,8 @@ typedef
|
|||
BluetoothHandsfreeResultRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable1<BluetoothHandsfreeResultHandler, void, bt_status_t>
|
||||
BluetoothInterfaceRunnable1<BluetoothHandsfreeResultHandler, void,
|
||||
bt_status_t, bt_status_t>
|
||||
BluetoothHandsfreeErrorRunnable;
|
||||
|
||||
static nsresult
|
||||
|
@ -852,7 +856,8 @@ typedef
|
|||
BluetoothA2dpResultRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable1<BluetoothA2dpResultHandler, void, bt_status_t>
|
||||
BluetoothInterfaceRunnable1<BluetoothA2dpResultHandler, void,
|
||||
bt_status_t, bt_status_t>
|
||||
BluetoothA2dpErrorRunnable;
|
||||
|
||||
static nsresult
|
||||
|
@ -956,7 +961,8 @@ typedef
|
|||
BluetoothAvrcpResultRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable1<BluetoothAvrcpResultHandler, void, bt_status_t>
|
||||
BluetoothInterfaceRunnable1<BluetoothAvrcpResultHandler, void,
|
||||
bt_status_t, bt_status_t>
|
||||
BluetoothAvrcpErrorRunnable;
|
||||
|
||||
static nsresult
|
||||
|
@ -1155,7 +1161,7 @@ typedef
|
|||
BluetoothResultRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable1<BluetoothResultHandler, void, int>
|
||||
BluetoothInterfaceRunnable1<BluetoothResultHandler, void, int, int>
|
||||
BluetoothErrorRunnable;
|
||||
|
||||
static nsresult
|
||||
|
|
|
@ -811,10 +811,10 @@ BluetoothSocket::CloseDroidSocket()
|
|||
NotifyDisconnect();
|
||||
}
|
||||
|
||||
class ConnectResultHandler MOZ_FINAL : public BluetoothSocketResultHandler
|
||||
class ConnectSocketResultHandler MOZ_FINAL : public BluetoothSocketResultHandler
|
||||
{
|
||||
public:
|
||||
ConnectResultHandler(DroidSocketImpl* aImpl)
|
||||
ConnectSocketResultHandler(DroidSocketImpl* aImpl)
|
||||
: mImpl(aImpl)
|
||||
{
|
||||
MOZ_ASSERT(mImpl);
|
||||
|
@ -861,7 +861,7 @@ BluetoothSocket::Connect(const nsAString& aDeviceAddress, int aChannel)
|
|||
aChannel,
|
||||
(BTSOCK_FLAG_ENCRYPT * mEncrypt) |
|
||||
(BTSOCK_FLAG_AUTH * mAuth),
|
||||
new ConnectResultHandler(mImpl));
|
||||
new ConnectSocketResultHandler(mImpl));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "nsDataHashtable.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
|
@ -370,6 +371,7 @@ DispatchToBtThread(nsIRunnable* aRunnable)
|
|||
sBluetoothThread = new LazyIdleThread(BT_LAZY_THREAD_TIMEOUT_MS,
|
||||
NS_LITERAL_CSTRING("BluetoothDBusService"),
|
||||
LazyIdleThread::ManualShutdown);
|
||||
ClearOnShutdown(&sBluetoothThread);
|
||||
}
|
||||
return sBluetoothThread->Dispatch(aRunnable, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
|
|
@ -626,17 +626,13 @@ function isUuidsEqual(aUuidArray1, aUuidArray2) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
* Wait for pending emulator transactions and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
waitFor(function() {
|
||||
SpecialPowers.flushPermissions(function() {
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, "permissions flushed");
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, ":: CLEANING UP ::");
|
||||
|
||||
finish();
|
||||
});
|
||||
}, function() {
|
||||
waitFor(finish, function() {
|
||||
return pendingEmulatorCmdCount === 0;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -317,17 +317,13 @@ function sendMultipleRawCbsToEmulatorAndWait(aPdus) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
* Wait for pending emulator transactions and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
waitFor(function() {
|
||||
SpecialPowers.flushPermissions(function() {
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, "permissions flushed");
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, ":: CLEANING UP ::");
|
||||
|
||||
finish();
|
||||
});
|
||||
}, function() {
|
||||
waitFor(finish, function() {
|
||||
return pendingEmulatorCmdCount === 0;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -113,17 +113,13 @@ function waitForWindowEvent(aEventName) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
* Wait for pending emulator transactions and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
waitFor(function() {
|
||||
SpecialPowers.flushPermissions(function() {
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, "permissions flushed");
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, ":: CLEANING UP ::");
|
||||
|
||||
finish();
|
||||
});
|
||||
}, function() {
|
||||
waitFor(finish, function() {
|
||||
return _pendingEmulatorCmdCount === 0;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -20,8 +20,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy",
|
|||
"resource://gre/modules/SystemAppProxy.jsm");
|
||||
|
||||
this.Keyboard = {
|
||||
_formMM: null, // The current web page message manager.
|
||||
_keyboardMM: null, // The keyboard app message manager.
|
||||
_formMM: null, // The current web page message manager.
|
||||
_keyboardMM: null, // The keyboard app message manager.
|
||||
_keyboardID: -1, // The keyboard app's ID number. -1 = invalid
|
||||
_nextKeyboardID: 0, // The ID number counter.
|
||||
_systemMessageName: [
|
||||
'SetValue', 'RemoveFocus', 'SetSelectedOption', 'SetSelectedOptions'
|
||||
],
|
||||
|
@ -149,6 +151,20 @@ this.Keyboard = {
|
|||
}
|
||||
}
|
||||
|
||||
// we don't process kb messages (other than register)
|
||||
// if they come from a kb that we're currently not regsitered for.
|
||||
// this decision is made with the kbID kept by us and kb app
|
||||
let kbID = null;
|
||||
if ('kbID' in msg.data) {
|
||||
kbID = msg.data.kbID;
|
||||
}
|
||||
|
||||
if (0 === msg.name.indexOf('Keyboard:') &&
|
||||
('Keyboard:Register' !== msg.name && this._keyboardID !== kbID)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (msg.name) {
|
||||
case 'Forms:Input':
|
||||
this.handleFocusChange(msg);
|
||||
|
@ -212,9 +228,22 @@ this.Keyboard = {
|
|||
break;
|
||||
case 'Keyboard:Register':
|
||||
this._keyboardMM = mm;
|
||||
if (kbID !== null) {
|
||||
// keyboard identifies itself, use its kbID
|
||||
// this msg would be async, so no need to return
|
||||
this._keyboardID = kbID;
|
||||
}else{
|
||||
// generate the id for the keyboard
|
||||
this._keyboardID = this._nextKeyboardID;
|
||||
this._nextKeyboardID++;
|
||||
// this msg is sync,
|
||||
// and we want to return the id back to inputmethod
|
||||
return this._keyboardID;
|
||||
}
|
||||
break;
|
||||
case 'Keyboard:Unregister':
|
||||
this._keyboardMM = null;
|
||||
this._keyboardID = -1;
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -13,16 +13,16 @@ Cu.import("resource://gre/modules/Services.jsm");
|
|||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1", "nsIMessageSender");
|
||||
"@mozilla.org/childprocessmessagemanager;1", "nsISyncMessageSender");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "tm",
|
||||
"@mozilla.org/thread-manager;1", "nsIThreadManager");
|
||||
|
||||
/*
|
||||
* A WeakMap to map input method iframe window to its active status.
|
||||
* A WeakMap to map input method iframe window to its active status and kbID.
|
||||
*/
|
||||
let WindowMap = {
|
||||
// WeakMap of <window, boolean> pairs.
|
||||
// WeakMap of <window, object> pairs.
|
||||
_map: null,
|
||||
|
||||
/*
|
||||
|
@ -32,7 +32,13 @@ let WindowMap = {
|
|||
if (!this._map || !win) {
|
||||
return false;
|
||||
}
|
||||
return this._map.get(win) || false;
|
||||
|
||||
let obj = this._map.get(win);
|
||||
if (obj && 'active' in obj) {
|
||||
return obj.active;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
|
@ -45,10 +51,50 @@ let WindowMap = {
|
|||
if (!this._map) {
|
||||
this._map = new WeakMap();
|
||||
}
|
||||
this._map.set(win, isActive);
|
||||
if (!this._map.has(win)) {
|
||||
this._map.set(win, {});
|
||||
}
|
||||
this._map.get(win).active = isActive;
|
||||
},
|
||||
|
||||
/*
|
||||
* Get the keyboard ID (assigned by Keyboard.ksm) of the given window.
|
||||
*/
|
||||
getKbID: function(win) {
|
||||
if (!this._map || !win) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let obj = this._map.get(win);
|
||||
if (obj && 'kbID' in obj) {
|
||||
return obj.kbID;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Set the keyboard ID (assigned by Keyboard.ksm) of the given window.
|
||||
*/
|
||||
setKbID: function(win, kbID) {
|
||||
if (!win) {
|
||||
return;
|
||||
}
|
||||
if (!this._map) {
|
||||
this._map = new WeakMap();
|
||||
}
|
||||
if (!this._map.has(win)) {
|
||||
this._map.set(win, {});
|
||||
}
|
||||
this._map.get(win).kbID = kbID;
|
||||
}
|
||||
};
|
||||
|
||||
let cpmmSendAsyncMessageWithKbID = function (self, msg, data) {
|
||||
data.kbID = WindowMap.getKbID(self._window);
|
||||
cpmm.sendAsyncMessage(msg, data);
|
||||
};
|
||||
|
||||
/**
|
||||
* ==============================================
|
||||
* InputMethodManager
|
||||
|
@ -70,14 +116,14 @@ MozInputMethodManager.prototype = {
|
|||
if (!WindowMap.isActive(this._window)) {
|
||||
return;
|
||||
}
|
||||
cpmm.sendAsyncMessage('Keyboard:ShowInputMethodPicker', {});
|
||||
cpmmSendAsyncMessageWithKbID(this, 'Keyboard:ShowInputMethodPicker', {});
|
||||
},
|
||||
|
||||
next: function() {
|
||||
if (!WindowMap.isActive(this._window)) {
|
||||
return;
|
||||
}
|
||||
cpmm.sendAsyncMessage('Keyboard:SwitchToNextInputMethod', {});
|
||||
cpmmSendAsyncMessageWithKbID(this, 'Keyboard:SwitchToNextInputMethod', {});
|
||||
},
|
||||
|
||||
supportsSwitching: function() {
|
||||
|
@ -91,7 +137,7 @@ MozInputMethodManager.prototype = {
|
|||
if (!WindowMap.isActive(this._window)) {
|
||||
return;
|
||||
}
|
||||
cpmm.sendAsyncMessage('Keyboard:RemoveFocus', {});
|
||||
cpmmSendAsyncMessageWithKbID(this, 'Keyboard:RemoveFocus', {});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -261,11 +307,23 @@ MozInputMethod.prototype = {
|
|||
// If there is already an active context, then this will trigger
|
||||
// a GetContext:Result:OK event, and we can initialize ourselves.
|
||||
// Otherwise silently ignored.
|
||||
cpmm.sendAsyncMessage('Keyboard:Register', {});
|
||||
cpmm.sendAsyncMessage("Keyboard:GetContext", {});
|
||||
|
||||
// get keyboard ID from Keyboard.jsm,
|
||||
// or if we already have it, get it from our map
|
||||
// Note: if we need to get it from Keyboard.jsm,
|
||||
// we have to use a synchronous message
|
||||
var kbID = WindowMap.getKbID(this._window);
|
||||
if (kbID !== null) {
|
||||
cpmmSendAsyncMessageWithKbID(this, 'Keyboard:Register', {});
|
||||
}else{
|
||||
let res = cpmm.sendSyncMessage('Keyboard:Register', {});
|
||||
WindowMap.setKbID(this._window, res[0]);
|
||||
}
|
||||
|
||||
cpmmSendAsyncMessageWithKbID(this, 'Keyboard:GetContext', {});
|
||||
} else {
|
||||
// Deactive current input method.
|
||||
cpmm.sendAsyncMessage('Keyboard:Unregister', {});
|
||||
cpmmSendAsyncMessageWithKbID(this, 'Keyboard:Unregister', {});
|
||||
if (this._inputcontext) {
|
||||
this.setInputContext(null);
|
||||
}
|
||||
|
@ -489,7 +547,7 @@ MozInputContext.prototype = {
|
|||
getText: function ic_getText(offset, length) {
|
||||
let self = this;
|
||||
return this._sendPromise(function(resolverId) {
|
||||
cpmm.sendAsyncMessage('Keyboard:GetText', {
|
||||
cpmmSendAsyncMessageWithKbID(self, 'Keyboard:GetText', {
|
||||
contextId: self._contextId,
|
||||
requestId: resolverId,
|
||||
offset: offset,
|
||||
|
@ -517,7 +575,7 @@ MozInputContext.prototype = {
|
|||
setSelectionRange: function ic_setSelectionRange(start, length) {
|
||||
let self = this;
|
||||
return this._sendPromise(function(resolverId) {
|
||||
cpmm.sendAsyncMessage("Keyboard:SetSelectionRange", {
|
||||
cpmmSendAsyncMessageWithKbID(self, 'Keyboard:SetSelectionRange', {
|
||||
contextId: self._contextId,
|
||||
requestId: resolverId,
|
||||
selectionStart: start,
|
||||
|
@ -545,7 +603,7 @@ MozInputContext.prototype = {
|
|||
replaceSurroundingText: function ic_replaceSurrText(text, offset, length) {
|
||||
let self = this;
|
||||
return this._sendPromise(function(resolverId) {
|
||||
cpmm.sendAsyncMessage('Keyboard:ReplaceSurroundingText', {
|
||||
cpmmSendAsyncMessageWithKbID(self, 'Keyboard:ReplaceSurroundingText', {
|
||||
contextId: self._contextId,
|
||||
requestId: resolverId,
|
||||
text: text,
|
||||
|
@ -562,7 +620,7 @@ MozInputContext.prototype = {
|
|||
sendKey: function ic_sendKey(keyCode, charCode, modifiers, repeat) {
|
||||
let self = this;
|
||||
return this._sendPromise(function(resolverId) {
|
||||
cpmm.sendAsyncMessage('Keyboard:SendKey', {
|
||||
cpmmSendAsyncMessageWithKbID(self, 'Keyboard:SendKey', {
|
||||
contextId: self._contextId,
|
||||
requestId: resolverId,
|
||||
keyCode: keyCode,
|
||||
|
@ -576,7 +634,7 @@ MozInputContext.prototype = {
|
|||
setComposition: function ic_setComposition(text, cursor, clauses) {
|
||||
let self = this;
|
||||
return this._sendPromise(function(resolverId) {
|
||||
cpmm.sendAsyncMessage('Keyboard:SetComposition', {
|
||||
cpmmSendAsyncMessageWithKbID(self, 'Keyboard:SetComposition', {
|
||||
contextId: self._contextId,
|
||||
requestId: resolverId,
|
||||
text: text,
|
||||
|
@ -589,7 +647,7 @@ MozInputContext.prototype = {
|
|||
endComposition: function ic_endComposition(text) {
|
||||
let self = this;
|
||||
return this._sendPromise(function(resolverId) {
|
||||
cpmm.sendAsyncMessage('Keyboard:EndComposition', {
|
||||
cpmmSendAsyncMessageWithKbID(self, 'Keyboard:EndComposition', {
|
||||
contextId: self._contextId,
|
||||
requestId: resolverId,
|
||||
text: text || ''
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
|
@ -4,6 +4,7 @@ skip-if = (toolkit == 'android' || toolkit == 'gonk') || e10s
|
|||
support-files =
|
||||
inputmethod_common.js
|
||||
file_inputmethod.html
|
||||
file_inputmethod_1043828.html
|
||||
file_test_app.html
|
||||
file_test_sendkey_cancel.html
|
||||
file_test_sms_app.html
|
||||
|
@ -14,5 +15,6 @@ support-files =
|
|||
[test_bug953044.html]
|
||||
[test_bug960946.html]
|
||||
[test_bug978918.html]
|
||||
[test_bug1043828.html]
|
||||
[test_delete_focused_element.html]
|
||||
[test_sendkey_cancel.html]
|
||||
|
|
|
@ -0,0 +1,183 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1043828
|
||||
-->
|
||||
<head>
|
||||
<title>Basic test for Switching Keyboards.</title>
|
||||
<script type="application/javascript;version=1.7" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript;version=1.7" src="inputmethod_common.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1043828">Mozilla Bug 1043828</a>
|
||||
<p id="display"></p>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="application/javascript;version=1.7">
|
||||
|
||||
inputmethod_setup(function() {
|
||||
runTest();
|
||||
});
|
||||
|
||||
// The KB frame script running in Keyboard B.
|
||||
function kbFrameScript() {
|
||||
function tryGetText() {
|
||||
var ctx = content.navigator.mozInputMethod.inputcontext;
|
||||
if (ctx) {
|
||||
var p = ctx.getText();
|
||||
p.then(function(){
|
||||
sendAsyncMessage('test:InputMethod:getText:Resolve');
|
||||
}, function(e){
|
||||
sendAsyncMessage('test:InputMethod:getText:Reject');
|
||||
});
|
||||
}else{
|
||||
dump("Could not get inputcontext") ;
|
||||
}
|
||||
}
|
||||
|
||||
addMessageListener('test:InputMethod:getText:Do', function(){
|
||||
tryGetText();
|
||||
});
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
let app, keyboardA, keyboardB;
|
||||
let getTextPromise;
|
||||
let mmKeyboardA, mmKeyboardB;
|
||||
|
||||
/**
|
||||
* Test flow:
|
||||
* 1. Create two keyboard iframes & a mozbrowser iframe with a text field in it & focus the text
|
||||
* field.
|
||||
* 2. Set keyboard frame A as active input. Wait 200ms.
|
||||
* 3. Set keyboard frame B as active input. Wait 200ms.
|
||||
* 4. Set keyboard frame A as inactive. Wait 200ms.
|
||||
* 5. Allow frame b to use getText() with inputcontext to get the content from the text field
|
||||
* iframe. Wait 200ms.
|
||||
* [Test would succeed if the Promise returned by getText() resolves correctly.
|
||||
* Test would fail if otherwise]
|
||||
*/
|
||||
|
||||
let path = location.pathname;
|
||||
let basePath = location.protocol + '//' + location.host +
|
||||
path.substring(0, path.lastIndexOf('/'));
|
||||
|
||||
const WAIT_TIME = 200;
|
||||
|
||||
// STEP 1: Create the frames.
|
||||
function step1() {
|
||||
// app
|
||||
app = document.createElement('iframe');
|
||||
app.src = basePath + '/file_test_app.html';
|
||||
app.setAttribute('mozbrowser', true);
|
||||
document.body.appendChild(app);
|
||||
|
||||
// keyboards
|
||||
keyboardA = document.createElement('iframe');
|
||||
keyboardA.setAttribute('mozbrowser', true);
|
||||
document.body.appendChild(keyboardA);
|
||||
|
||||
keyboardB = document.createElement('iframe');
|
||||
keyboardB.setAttribute('mozbrowser', true);
|
||||
document.body.appendChild(keyboardB);
|
||||
|
||||
// simulate two different keyboard apps
|
||||
let imeUrl = basePath + '/file_inputmethod_1043828.html';
|
||||
|
||||
SpecialPowers.pushPermissions([{
|
||||
type: 'input',
|
||||
allow: true,
|
||||
context: imeUrl
|
||||
}], function() {
|
||||
keyboardA.src = imeUrl;
|
||||
keyboardB.src = imeUrl;
|
||||
|
||||
var handler = {
|
||||
handleEvent: function(){
|
||||
keyboardB.removeEventListener('mozbrowserloadend', this);
|
||||
|
||||
mmKeyboardB = SpecialPowers.getBrowserFrameMessageManager(keyboardB);
|
||||
|
||||
mmKeyboardB.loadFrameScript('data:,(' + kbFrameScript.toString() + ')();', false);
|
||||
|
||||
mmKeyboardB.addMessageListener('test:InputMethod:getText:Resolve', function() {
|
||||
ok(true, 'getText() was resolved');
|
||||
inputmethod_cleanup();
|
||||
});
|
||||
|
||||
mmKeyboardB.addMessageListener('test:InputMethod:getText:Reject', function() {
|
||||
ok(false, 'getText() was rejected');
|
||||
inputmethod_cleanup();
|
||||
});
|
||||
|
||||
setTimeout(function(){
|
||||
step2();
|
||||
}, WAIT_TIME);
|
||||
}
|
||||
};
|
||||
|
||||
keyboardB.addEventListener('mozbrowserloadend', handler);
|
||||
});
|
||||
}
|
||||
|
||||
// STEP 2: Set keyboard A active
|
||||
function step2() {
|
||||
let req = keyboardA.setInputMethodActive(true);
|
||||
|
||||
req.onsuccess = function(){
|
||||
setTimeout(function(){
|
||||
step3();
|
||||
}, WAIT_TIME);
|
||||
};
|
||||
|
||||
req.onerror = function(){
|
||||
ok(false, 'setInputMethodActive failed: ' + this.error.name);
|
||||
inputmethod_cleanup();
|
||||
};
|
||||
}
|
||||
|
||||
// STEP 3: Set keyboard B active
|
||||
function step3() {
|
||||
let req = keyboardB.setInputMethodActive(true);
|
||||
|
||||
req.onsuccess = function(){
|
||||
setTimeout(function(){
|
||||
step4();
|
||||
}, WAIT_TIME);
|
||||
};
|
||||
|
||||
req.onerror = function(){
|
||||
ok(false, 'setInputMethodActive failed: ' + this.error.name);
|
||||
inputmethod_cleanup();
|
||||
};
|
||||
}
|
||||
|
||||
// STEP 4: Set keyboard A inactive
|
||||
function step4() {
|
||||
let req = keyboardA.setInputMethodActive(false);
|
||||
|
||||
req.onsuccess = function(){
|
||||
setTimeout(function(){
|
||||
step5();
|
||||
}, WAIT_TIME);
|
||||
};
|
||||
|
||||
req.onerror = function(){
|
||||
ok(false, 'setInputMethodActive failed: ' + this.error.name);
|
||||
inputmethod_cleanup();
|
||||
};
|
||||
}
|
||||
|
||||
// STEP 5: getText
|
||||
function step5() {
|
||||
mmKeyboardB.sendAsyncMessage('test:InputMethod:getText:Do');
|
||||
}
|
||||
|
||||
step1();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -85,6 +85,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(MobileConnection,
|
||||
DOMEventTargetHelper)
|
||||
tmp->Shutdown();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mVoice)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mData)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
@ -126,19 +127,28 @@ MobileConnection::MobileConnection(nsPIDOMWindow* aWindow, uint32_t aClientId)
|
|||
void
|
||||
MobileConnection::Shutdown()
|
||||
{
|
||||
if (mProvider && mListener) {
|
||||
if (mListener) {
|
||||
if (mProvider) {
|
||||
mProvider->UnregisterMobileConnectionMsg(mClientId, mListener);
|
||||
}
|
||||
|
||||
mListener->Disconnect();
|
||||
mProvider->UnregisterMobileConnectionMsg(mClientId, mListener);
|
||||
mProvider = nullptr;
|
||||
mListener = nullptr;
|
||||
mVoice = nullptr;
|
||||
mData = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
MobileConnection::~MobileConnection()
|
||||
{
|
||||
MOZ_ASSERT(!(mProvider || mListener || mVoice || mData));
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
MobileConnection::DisconnectFromOwner()
|
||||
{
|
||||
DOMEventTargetHelper::DisconnectFromOwner();
|
||||
// Event listeners can't be handled anymore, so we can shutdown
|
||||
// the MobileConnection.
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
|
@ -214,20 +224,12 @@ MobileConnection::GetLastKnownHomeNetwork(nsString& aRetVal) const
|
|||
MobileConnectionInfo*
|
||||
MobileConnection::Voice() const
|
||||
{
|
||||
if (!mProvider) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mVoice;
|
||||
}
|
||||
|
||||
MobileConnectionInfo*
|
||||
MobileConnection::Data() const
|
||||
{
|
||||
if (!mProvider) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mData;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,9 @@ public:
|
|||
void
|
||||
Shutdown();
|
||||
|
||||
virtual void
|
||||
DisconnectFromOwner() MOZ_OVERRIDE;
|
||||
|
||||
nsPIDOMWindow*
|
||||
GetParentObject() const
|
||||
{
|
||||
|
|
|
@ -10,22 +10,9 @@
|
|||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(MobileConnectionArray)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(MobileConnectionArray)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
|
||||
// Notify our mobile connections that we're going away.
|
||||
tmp->DropConnections();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(MobileConnectionArray)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMobileConnections)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(MobileConnectionArray)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MobileConnectionArray,
|
||||
mWindow,
|
||||
mMobileConnections)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(MobileConnectionArray)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(MobileConnectionArray)
|
||||
|
@ -49,7 +36,6 @@ MobileConnectionArray::MobileConnectionArray(nsPIDOMWindow* aWindow)
|
|||
|
||||
MobileConnectionArray::~MobileConnectionArray()
|
||||
{
|
||||
DropConnections();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -63,18 +49,6 @@ MobileConnectionArray::Init()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
MobileConnectionArray::DropConnections()
|
||||
{
|
||||
if (mInitialized) {
|
||||
for (uint32_t i = 0; i < mMobileConnections.Length(); i++) {
|
||||
mMobileConnections[i]->Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
mMobileConnections.Clear();
|
||||
}
|
||||
|
||||
nsPIDOMWindow*
|
||||
MobileConnectionArray::GetParentObject() const
|
||||
{
|
||||
|
|
|
@ -45,9 +45,6 @@ private:
|
|||
void
|
||||
Init();
|
||||
|
||||
void
|
||||
DropConnections();
|
||||
|
||||
bool mInitialized;
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
|
|
|
@ -1128,17 +1128,13 @@ function getNumOfRadioInterfaces() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
* Wait for pending emulator transactions and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
waitFor(function() {
|
||||
SpecialPowers.flushPermissions(function() {
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, "permissions flushed");
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, ":: CLEANING UP ::");
|
||||
|
||||
finish();
|
||||
});
|
||||
}, function() {
|
||||
waitFor(finish, function() {
|
||||
return _pendingEmulatorCmdCount === 0 &&
|
||||
_pendingEmulatorShellCmdCount === 0;
|
||||
});
|
||||
|
|
|
@ -562,22 +562,12 @@ function compareSmsMessage(aFrom, aTo) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
* Wait for pending emulator transactions and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
ok(true, ":: CLEANING UP ::");
|
||||
|
||||
waitFor(function() {
|
||||
SpecialPowers.flushPermissions(function() {
|
||||
ok(true, "permissions flushed");
|
||||
|
||||
SpecialPowers.flushPrefEnv(function() {
|
||||
ok(true, "preferences flushed");
|
||||
|
||||
finish();
|
||||
})
|
||||
});
|
||||
}, function() {
|
||||
waitFor(finish, function() {
|
||||
return pendingEmulatorCmdCount === 0;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ mozNfc.prototype = {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (!this.nfcObject) {
|
||||
if (!this.nfcObject || this.nfcObject.token != sessionToken) {
|
||||
let obj = new MozNFCPeer();
|
||||
obj.initialize(this._window, sessionToken);
|
||||
this.nfcObject = obj;
|
||||
|
|
|
@ -6013,6 +6013,7 @@ RilObject.prototype[REQUEST_GET_IMEI] = function REQUEST_GET_IMEI(length, option
|
|||
return;
|
||||
}
|
||||
|
||||
options.mmiServiceCode = MMI_KS_SC_IMEI;
|
||||
options.success = (options.rilRequestError === 0);
|
||||
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
|
||||
if ((!options.success || this.IMEI == null) && !options.errorMsg) {
|
||||
|
|
|
@ -124,6 +124,14 @@ dictionary IPConfiguration {
|
|||
NavigatorProperty="mozWifiManager",
|
||||
Func="Navigator::HasWifiManagerSupport"]
|
||||
interface MozWifiManager : EventTarget {
|
||||
/**
|
||||
* Turn on/off wifi functionality.
|
||||
* @param enable true for enable, false for disable.
|
||||
* onsuccess: Wifi enable/disable successfully, including no status change.
|
||||
* onerror: Wifi enable/disable failed or prohibited.
|
||||
*/
|
||||
DOMRequest setWifiEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Returns the list of currently available networks.
|
||||
* onsuccess: We have obtained the current list of networks. request.value
|
||||
|
|
|
@ -113,6 +113,7 @@ DOMWifiManager.prototype = {
|
|||
"WifiManager:importCert:Return:OK", "WifiManager:importCert:Return:NO",
|
||||
"WifiManager:getImportedCerts:Return:OK", "WifiManager:getImportedCerts:Return:NO",
|
||||
"WifiManager:deleteCert:Return:OK", "WifiManager:deleteCert:Return:NO",
|
||||
"WifiManager:setWifiEnabled:Return:OK", "WifiManager:setWifiEnabled:Return:NO",
|
||||
"WifiManager:wifiDown", "WifiManager:wifiUp",
|
||||
"WifiManager:onconnecting", "WifiManager:onassociate",
|
||||
"WifiManager:onconnect", "WifiManager:ondisconnect",
|
||||
|
@ -233,6 +234,14 @@ DOMWifiManager.prototype = {
|
|||
}
|
||||
|
||||
switch (aMessage.name) {
|
||||
case "WifiManager:setWifiEnabled:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(request, msg.data);
|
||||
break;
|
||||
|
||||
case "WifiManager:setWifiEnabled:Return:NO":
|
||||
Services.DOMRequest.fireError(request, "Unable to enable/disable Wifi");
|
||||
break;
|
||||
|
||||
case "WifiManager:getNetworks:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(request, this._convertWifiNetworks(msg.data));
|
||||
break;
|
||||
|
@ -432,6 +441,12 @@ DOMWifiManager.prototype = {
|
|||
this.__DOM_IMPL__.dispatchEvent(evt);
|
||||
},
|
||||
|
||||
setWifiEnabled: function setWifiEnabled(enabled) {
|
||||
var request = this.createRequest();
|
||||
this._sendMessageForRequest("WifiManager:setWifiEnabled", enabled, request);
|
||||
return request;
|
||||
},
|
||||
|
||||
getNetworks: function getNetworks() {
|
||||
var request = this.createRequest();
|
||||
this._sendMessageForRequest("WifiManager:getNetworks", null, request);
|
||||
|
|
|
@ -670,7 +670,7 @@ var WifiManager = (function() {
|
|||
// 2. current network if no SSID is provided, it's not guaranteed that
|
||||
// current network matches requested SSID.
|
||||
if ((!ssid && network.status === "CURRENT") ||
|
||||
(ssid && ssid === dequote(network.ssid))) {
|
||||
(ssid && network.ssid && ssid === dequote(network.ssid))) {
|
||||
return callback(net);
|
||||
}
|
||||
}
|
||||
|
@ -1764,6 +1764,7 @@ function WifiWorker() {
|
|||
"WifiManager:importCert",
|
||||
"WifiManager:getImportedCerts",
|
||||
"WifiManager:deleteCert",
|
||||
"WifiManager:setWifiEnabled",
|
||||
"child-process-shutdown"];
|
||||
|
||||
messages.forEach((function(msgName) {
|
||||
|
@ -2028,8 +2029,8 @@ function WifiWorker() {
|
|||
WifiManager.getNetworkId(connectionInfo.ssid, function(netId) {
|
||||
// Trying to get netId from current network.
|
||||
if (!netId &&
|
||||
self.currentNetwork &&
|
||||
self.currentNetwork.ssid == dequote(connectionInfo.ssid) &&
|
||||
self.currentNetwork && self.currentNetwork.ssid &&
|
||||
dequote(self.currentNetwork.ssid) == connectionInfo.ssid &&
|
||||
typeof self.currentNetwork.netId !== "undefined") {
|
||||
netId = self.currentNetwork.netId;
|
||||
}
|
||||
|
@ -2714,6 +2715,9 @@ WifiWorker.prototype = {
|
|||
}
|
||||
|
||||
switch (aMessage.name) {
|
||||
case "WifiManager:setWifiEnabled":
|
||||
this.setWifiEnabled(msg);
|
||||
break;
|
||||
case "WifiManager:getNetworks":
|
||||
this.getNetworks(msg);
|
||||
break;
|
||||
|
@ -2909,7 +2913,47 @@ WifiWorker.prototype = {
|
|||
WifiManager.start();
|
||||
},
|
||||
|
||||
setWifiEnabled: function(enabled, callback) {
|
||||
/**
|
||||
* Compatibility flags for detecting if Gaia is controlling wifi by settings
|
||||
* or API, once API is called, gecko will no longer accept wifi enable
|
||||
* control from settings.
|
||||
* This is used to deal with compatibility issue while Gaia adopted to use
|
||||
* API but gecko doesn't remove the settings code in time.
|
||||
* TODO: Remove this flag in Bug 1050147
|
||||
*/
|
||||
ignoreWifiEnabledFromSettings: false,
|
||||
setWifiEnabled: function(msg) {
|
||||
const message = "WifiManager:setWifiEnabled:Return";
|
||||
let self = this;
|
||||
let enabled = msg.data;
|
||||
|
||||
self.ignoreWifiEnabledFromSettings = true;
|
||||
// No change.
|
||||
if (enabled === WifiManager.enabled) {
|
||||
this._sendMessage(message, true, true, msg);
|
||||
}
|
||||
|
||||
// Can't enable wifi while hotspot mode is enabled.
|
||||
if (enabled && (this.tetheringSettings[SETTINGS_WIFI_TETHERING_ENABLED] ||
|
||||
WifiManager.isWifiTetheringEnabled(WifiManager.tetheringState))) {
|
||||
self._sendMessage(message, false, "Can't enable Wifi while hotspot mode is enabled", msg);
|
||||
}
|
||||
|
||||
// Reply error to pending requests.
|
||||
if (!enabled) {
|
||||
this._clearPendingRequest();
|
||||
}
|
||||
|
||||
WifiManager.setWifiEnabled(enabled, function(ok) {
|
||||
if (ok === 0 || ok === "no change") {
|
||||
self._sendMessage(message, true, true, msg);
|
||||
} else {
|
||||
self._sendMessage(message, false, "Set power saving mode failed", msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_setWifiEnabled: function(enabled, callback) {
|
||||
// Reply error to pending requests.
|
||||
if (!enabled) {
|
||||
this._clearPendingRequest();
|
||||
|
@ -2920,6 +2964,7 @@ WifiWorker.prototype = {
|
|||
|
||||
// requestDone() must be called to before callback complete(or error)
|
||||
// so next queue in the request quene can be executed.
|
||||
// TODO: Remove command queue in Bug 1050147
|
||||
queueRequest: function(data, callback) {
|
||||
if (!callback) {
|
||||
throw "Try to enqueue a request without callback";
|
||||
|
@ -3362,10 +3407,11 @@ WifiWorker.prototype = {
|
|||
shutdown: function() {
|
||||
debug("shutting down ...");
|
||||
this.queueRequest({command: "setWifiEnabled", value: false}, function(data) {
|
||||
this.setWifiEnabled(false, this._setWifiEnabledCallback.bind(this));
|
||||
this._setWifiEnabled(false, this._setWifiEnabledCallback.bind(this));
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
// TODO: Remove command queue in Bug 1050147.
|
||||
requestProcessing: false, // Hold while dequeue and execution a request.
|
||||
// Released upon the request is fully executed,
|
||||
// i.e, mostly after callback is done.
|
||||
|
@ -3437,6 +3483,10 @@ WifiWorker.prototype = {
|
|||
},
|
||||
|
||||
handleWifiEnabled: function(enabled) {
|
||||
if (this.ignoreWifiEnabledFromSettings) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure Wifi hotspot is idle before switching to Wifi mode.
|
||||
if (enabled) {
|
||||
this.queueRequest({command: "setWifiApEnabled", value: false}, function(data) {
|
||||
|
@ -3451,7 +3501,7 @@ WifiWorker.prototype = {
|
|||
}
|
||||
|
||||
this.queueRequest({command: "setWifiEnabled", value: enabled}, function(data) {
|
||||
this.setWifiEnabled(enabled, this._setWifiEnabledCallback.bind(this));
|
||||
this._setWifiEnabled(enabled, this._setWifiEnabledCallback.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
if (!enabled) {
|
||||
|
@ -3472,7 +3522,7 @@ WifiWorker.prototype = {
|
|||
this.queueRequest({command: "setWifiEnabled", value: false}, function(data) {
|
||||
if (WifiManager.isWifiEnabled(WifiManager.state)) {
|
||||
this.disconnectedByWifiTethering = true;
|
||||
this.setWifiEnabled(false, this._setWifiEnabledCallback.bind(this));
|
||||
this._setWifiEnabled(false, this._setWifiEnabledCallback.bind(this));
|
||||
} else {
|
||||
this.requestDone();
|
||||
}
|
||||
|
@ -3486,7 +3536,7 @@ WifiWorker.prototype = {
|
|||
if (!enabled) {
|
||||
this.queueRequest({command: "setWifiEnabled", value: true}, function(data) {
|
||||
if (this.disconnectedByWifiTethering) {
|
||||
this.setWifiEnabled(true, this._setWifiEnabledCallback.bind(this));
|
||||
this._setWifiEnabled(true, this._setWifiEnabledCallback.bind(this));
|
||||
} else {
|
||||
this.requestDone();
|
||||
}
|
||||
|
@ -3523,6 +3573,7 @@ WifiWorker.prototype = {
|
|||
|
||||
handle: function handle(aName, aResult) {
|
||||
switch(aName) {
|
||||
// TODO: Remove function call in Bug 1050147.
|
||||
case SETTINGS_WIFI_ENABLED:
|
||||
this.handleWifiEnabled(aResult)
|
||||
break;
|
||||
|
|
|
@ -237,19 +237,6 @@ class BaseMarionetteOptions(OptionParser):
|
|||
OptionParser.__init__(self, **kwargs)
|
||||
self.parse_args_handlers = [] # Used by mixins
|
||||
self.verify_usage_handlers = [] # Used by mixins
|
||||
self.add_option('--autolog',
|
||||
action='store_true',
|
||||
dest='autolog',
|
||||
default=False,
|
||||
help='send test results to autolog')
|
||||
self.add_option('--revision',
|
||||
action='store',
|
||||
dest='revision',
|
||||
help='git revision for autolog submissions')
|
||||
self.add_option('--testgroup',
|
||||
action='store',
|
||||
dest='testgroup',
|
||||
help='testgroup names for autolog submissions')
|
||||
self.add_option('--emulator',
|
||||
action='store',
|
||||
dest='emulator',
|
||||
|
@ -451,15 +438,13 @@ class BaseMarionetteTestRunner(object):
|
|||
|
||||
def __init__(self, address=None, emulator=None, emulator_binary=None,
|
||||
emulator_img=None, emulator_res='480x800', homedir=None,
|
||||
app=None, app_args=None, binary=None, profile=None, autolog=False,
|
||||
revision=None, logger=None, testgroup="marionette", no_window=False,
|
||||
logdir=None, xml_output=None, repeat=0,
|
||||
testvars=None, tree=None, type=None, device_serial=None,
|
||||
symbols_path=None, timeout=None, shuffle=False,
|
||||
shuffle_seed=random.randint(0, sys.maxint), sdcard=None,
|
||||
this_chunk=1, total_chunks=1, sources=None, server_root=None,
|
||||
gecko_log=None,
|
||||
**kwargs):
|
||||
app=None, app_args=None, binary=None, profile=None,
|
||||
logger=None, no_window=False, logdir=None, xml_output=None,
|
||||
repeat=0, testvars=None, tree=None, type=None,
|
||||
device_serial=None, symbols_path=None, timeout=None,
|
||||
shuffle=False, shuffle_seed=random.randint(0, sys.maxint),
|
||||
sdcard=None, this_chunk=1, total_chunks=1, sources=None,
|
||||
server_root=None, gecko_log=None, **kwargs):
|
||||
self.address = address
|
||||
self.emulator = emulator
|
||||
self.emulator_binary = emulator_binary
|
||||
|
@ -470,9 +455,6 @@ class BaseMarionetteTestRunner(object):
|
|||
self.app_args = app_args or []
|
||||
self.bin = binary
|
||||
self.profile = profile
|
||||
self.autolog = autolog
|
||||
self.testgroup = testgroup
|
||||
self.revision = revision
|
||||
self.logger = logger
|
||||
self.no_window = no_window
|
||||
self.httpd = None
|
||||
|
|
|
@ -29,12 +29,6 @@ else
|
|||
python setup_development.py
|
||||
cd ..
|
||||
|
||||
# set up mozautolog
|
||||
hg clone http://hg.mozilla.org/automation/mozautolog/
|
||||
cd mozautolog
|
||||
python setup.py develop
|
||||
cd ..
|
||||
|
||||
# set up gitpython
|
||||
easy_install http://pypi.python.org/packages/source/G/GitPython/GitPython-0.3.2.RC1.tar.gz
|
||||
fi
|
||||
|
|
Загрузка…
Ссылка в новой задаче