merge b2g-inbound to mozilla-central

This commit is contained in:
Carsten "Tomcat" Book 2014-05-23 16:03:42 +02:00
commit c4077a7d02
40 changed files with 618 additions and 100 deletions

View File

@ -19,13 +19,13 @@
<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="b61129780e085636d09406f2a46e922d0f8b9757"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e83bd91c8f7c66f95d55cb741299e12bc8f7b429"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="e5f4683183a1dec2cfdb21b76509819977e9d09c"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6c8ce047653af40a32b23744cc77cd25929b6b21"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -17,10 +17,10 @@
</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="b61129780e085636d09406f2a46e922d0f8b9757"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e83bd91c8f7c66f95d55cb741299e12bc8f7b429"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6c8ce047653af40a32b23744cc77cd25929b6b21"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -15,14 +15,14 @@
<project name="platform_build" path="build" remote="b2g" revision="276ce45e78b09c4a4ee643646f691d22804754c1">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b61129780e085636d09406f2a46e922d0f8b9757"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e83bd91c8f7c66f95d55cb741299e12bc8f7b429"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6c8ce047653af40a32b23744cc77cd25929b6b21"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

View File

@ -19,13 +19,13 @@
<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="b61129780e085636d09406f2a46e922d0f8b9757"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e83bd91c8f7c66f95d55cb741299e12bc8f7b429"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="e5f4683183a1dec2cfdb21b76509819977e9d09c"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6c8ce047653af40a32b23744cc77cd25929b6b21"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -18,10 +18,10 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<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="b61129780e085636d09406f2a46e922d0f8b9757"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e83bd91c8f7c66f95d55cb741299e12bc8f7b429"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6c8ce047653af40a32b23744cc77cd25929b6b21"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "2838c1b561aa929af18e45518cb002927dee4eaa",
"revision": "43a532cc479db14fb9f680d5919791b225560ed1",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,12 +17,12 @@
<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="b61129780e085636d09406f2a46e922d0f8b9757"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e83bd91c8f7c66f95d55cb741299e12bc8f7b429"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<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="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6c8ce047653af40a32b23744cc77cd25929b6b21"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>

View File

@ -15,7 +15,7 @@
<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="b61129780e085636d09406f2a46e922d0f8b9757"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e83bd91c8f7c66f95d55cb741299e12bc8f7b429"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -19,12 +19,12 @@
<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="b61129780e085636d09406f2a46e922d0f8b9757"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e83bd91c8f7c66f95d55cb741299e12bc8f7b429"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<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="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6c8ce047653af40a32b23744cc77cd25929b6b21"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="cd5dfce80bc3f0139a56b58aca633202ccaee7f8"/>

View File

@ -17,12 +17,12 @@
<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="b61129780e085636d09406f2a46e922d0f8b9757"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e83bd91c8f7c66f95d55cb741299e12bc8f7b429"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<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="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6c8ce047653af40a32b23744cc77cd25929b6b21"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -17,10 +17,10 @@
</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="b61129780e085636d09406f2a46e922d0f8b9757"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e83bd91c8f7c66f95d55cb741299e12bc8f7b429"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6c8ce047653af40a32b23744cc77cd25929b6b21"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -17,12 +17,12 @@
<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="b61129780e085636d09406f2a46e922d0f8b9757"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e83bd91c8f7c66f95d55cb741299e12bc8f7b429"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<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="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6c8ce047653af40a32b23744cc77cd25929b6b21"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -704,6 +704,7 @@ 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")

View File

@ -159,17 +159,14 @@ DOMInterfaces = {
'BluetoothAdapter': {
'nativeType': 'mozilla::dom::bluetooth::BluetoothAdapter',
'headerFile': 'BluetoothAdapter.h'
},
'BluetoothDevice': {
'nativeType': 'mozilla::dom::bluetooth::BluetoothDevice',
'headerFile': 'BluetoothDevice.h'
},
'BluetoothManager': {
'nativeType': 'mozilla::dom::bluetooth::BluetoothManager',
'headerFile': 'BluetoothManager.h'
},
'CameraCapabilities': {

View File

@ -14,6 +14,7 @@
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
#include "mozilla/dom/BluetoothAdapterBinding.h"
#include "mozilla/dom/BluetoothDeviceEvent.h"
#include "mozilla/dom/BluetoothDiscoveryStateChangedEvent.h"
#include "mozilla/dom/BluetoothStatusChangedEvent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/LazyIdleThread.h"
@ -330,6 +331,16 @@ BluetoothAdapter::Notify(const BluetoothSignal& aData)
for (uint32_t i = 0, propCount = arr.Length(); i < propCount; ++i) {
SetPropertyByValue(arr[i]);
}
} else if (aData.name().EqualsLiteral(DISCOVERY_STATE_CHANGED_ID)) {
MOZ_ASSERT(v.type() == BluetoothValue::Tbool);
BluetoothDiscoveryStateChangedEventInit init;
init.mDiscovering = v.get_bool();
nsRefPtr<BluetoothDiscoveryStateChangedEvent> event =
BluetoothDiscoveryStateChangedEvent::Constructor(
this, NS_LITERAL_STRING(DISCOVERY_STATE_CHANGED_ID), init);
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) ||

View File

@ -148,6 +148,7 @@ 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);

View File

@ -111,6 +111,11 @@ 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.

View File

@ -51,7 +51,6 @@ static InfallibleTArray<nsString> sAdapterBondedAddressArray;
static InfallibleTArray<BluetoothNamedValue> sRemoteDevicesPack;
static nsTArray<nsRefPtr<BluetoothProfileController> > sControllerArray;
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sBondingRunnableArray;
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sChangeDiscoveryRunnableArray;
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sGetDeviceRunnableArray;
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sSetPropertyRunnableArray;
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sUnbondingRunnableArray;
@ -98,7 +97,6 @@ public:
// Bluetooth just enabled, clear profile controllers and runnable arrays.
sControllerArray.Clear();
sBondingRunnableArray.Clear();
sChangeDiscoveryRunnableArray.Clear();
sGetDeviceRunnableArray.Clear();
sSetPropertyRunnableArray.Clear();
sUnbondingRunnableArray.Clear();
@ -516,12 +514,14 @@ DiscoveryStateChangedCallback(bt_discovery_state_t aState)
{
MOZ_ASSERT(!NS_IsMainThread());
if (!sChangeDiscoveryRunnableArray.IsEmpty()) {
BluetoothValue values(true);
DispatchBluetoothReply(sChangeDiscoveryRunnableArray[0],
values, EmptyString());
bool isDiscovering = (aState == BT_DISCOVERY_STARTED);
BluetoothSignal signal(NS_LITERAL_STRING(DISCOVERY_STATE_CHANGED_ID),
NS_LITERAL_STRING(KEY_ADAPTER), isDiscovering);
sChangeDiscoveryRunnableArray.RemoveElementAt(0);
nsRefPtr<DistributeBluetoothSignalTask> t =
new DistributeBluetoothSignalTask(signal);
if (NS_FAILED(NS_DispatchToMainThread(t))) {
BT_WARNING("Failed to dispatch to main thread!");
}
}
@ -935,9 +935,9 @@ 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"));
@ -945,7 +945,8 @@ BluetoothServiceBluedroid::StartDiscoveryInternal(
return NS_OK;
}
sChangeDiscoveryRunnableArray.AppendElement(aRunnable);
DispatchBluetoothReply(aRunnable, true, EmptyString());
return NS_OK;
}
@ -964,10 +965,10 @@ BluetoothServiceBluedroid::StopDiscoveryInternal(
int ret = sBtInterface->cancel_discovery();
if (ret != BT_STATUS_SUCCESS) {
ReplyStatusError(aRunnable, ret, NS_LITERAL_STRING("StopDiscovery"));
return NS_OK;
return NS_ERROR_FAILURE;
}
sChangeDiscoveryRunnableArray.AppendElement(aRunnable);
DispatchBluetoothReply(aRunnable, true, EmptyString());
return NS_OK;
}

View File

@ -570,6 +570,21 @@ private:
bool mDelay;
};
class InternalStopDiscoveryTask : public nsRunnable
{
nsresult Run()
{
MOZ_ASSERT(NS_IsMainThread());
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE(bs, NS_ERROR_FAILURE);
bs->StopDiscoveryInternal(nullptr);
return NS_OK;
}
};
static bool
IsDBusMessageError(DBusMessage* aMsg, DBusError* aErr, nsAString& aErrorStr)
{
@ -1809,6 +1824,17 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
errorStr,
sAdapterProperties,
ArrayLength(sAdapterProperties));
BluetoothNamedValue& property = v.get_ArrayOfBluetoothNamedValue()[0];
if (property.name().EqualsLiteral("Discovering")) {
// Special handling when discovery process is stopped by the stack. It
// does happen when the stack uses Periodic Inquiry instead of Inquiry.
bool isDiscovering = property.value();
if (!isDiscovering &&
NS_FAILED(NS_DispatchToMainThread(new InternalStopDiscoveryTask()))) {
BT_WARNING("Failed to dispatch to main thread!");
}
}
} else if (dbus_message_is_signal(aMsg, DBUS_DEVICE_IFACE,
"PropertyChanged")) {
ParsePropertyChange(aMsg,
@ -2404,6 +2430,20 @@ OnSendDiscoveryMessageReply(DBusMessage *aReply, void *aData)
errorStr.AssignLiteral("SendDiscovery failed");
}
// aData may be a nullptr because we may call StopDiscovery internally when
// receiving PropertyChanged event of property Discovering from BlueZ.
//
// Please see bug 942104 for more details.
if (!aData) {
BluetoothSignal signal(NS_LITERAL_STRING(DISCOVERY_STATE_CHANGED_ID),
NS_LITERAL_STRING(KEY_ADAPTER), false);
nsresult rv =
NS_DispatchToMainThread(new DistributeBluetoothSignalTask(signal));
NS_ENSURE_SUCCESS_VOID(rv);
return;
}
nsRefPtr<BluetoothReplyRunnable> runnable =
dont_AddRef<BluetoothReplyRunnable>(static_cast<BluetoothReplyRunnable*>(aData));
@ -2419,7 +2459,6 @@ public:
, mRunnable(aRunnable)
{
MOZ_ASSERT(!mMessageName.IsEmpty());
MOZ_ASSERT(mRunnable);
}
void Run() MOZ_OVERRIDE
@ -2453,8 +2492,11 @@ BluetoothDBusService::SendDiscoveryMessage(const char* aMessageName,
MOZ_ASSERT(!sAdapterPath.IsEmpty());
if (!IsReady()) {
NS_NAMED_LITERAL_STRING(errorStr, "Bluetooth service is not ready yet!");
DispatchBluetoothReply(aRunnable, BluetoothValue(), errorStr);
if (aRunnable) {
NS_NAMED_LITERAL_STRING(errorStr, "Bluetooth service is not ready yet!");
DispatchBluetoothReply(aRunnable, BluetoothValue(), errorStr);
}
return NS_OK;
}

View File

@ -91,7 +91,10 @@ EXPORTS.mozilla.dom.bluetooth.ipc += [
]
EXPORTS.mozilla.dom.bluetooth += [
'BluetoothAdapter.h',
'BluetoothCommon.h',
'BluetoothDevice.h',
'BluetoothManager.h',
]
IPDL_SOURCES += [

View File

@ -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);
},

View File

@ -37,7 +37,7 @@ let emulator = (function() {
}());
function toggleNFC(enabled, callback) {
isnot(callback, null);
let deferred = Promise.defer();
let req;
if (enabled) {
@ -47,13 +47,32 @@ function toggleNFC(enabled, callback) {
}
req.onsuccess = function() {
callback();
if(callback) {
callback();
}
deferred.resolve();
};
req.onerror = function() {
ok(false, 'operation failed, error ' + req.error.name);
deferred.reject();
finish();
};
return deferred.promise;
}
function enableRE0() {
let deferred = Promise.defer();
let cmd = 'nfc nci rf_intf_activated_ntf 0';
emulator.run(cmd, function(result) {
is(result.pop(), 'OK', 'check activation of RE0');
deferred.resolve();
});
return deferred.promise;
}
function cleanUp() {

View File

@ -8,3 +8,5 @@ qemu=true
[test_nfc_manager_tech_discovered.js]
[test_nfc_peer.js]
[test_nfc_peer_sendndef.js]
[test_nfc_checkP2PRegistration.js]
[test_nfc_error_messages.js]

View File

@ -0,0 +1,158 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
'use strict';
/* globals log, is, ok, runTests, toggleNFC, runNextTest,
SpecialPowers, nfc, enableRE0 */
const MARIONETTE_TIMEOUT = 30000;
const MARIONETTE_HEAD_JS = 'head.js';
const MANIFEST_URL = 'app://system.gaiamobile.org/manifest.webapp';
const FAKE_MANIFEST_URL = 'app://fake.gaiamobile.org/manifest.webapp';
/**
* Failure scenarion without onpeerread handler registration
* Nfc not enabled -> no session token.
*/
function testNoTargetNoSessionToken() {
log('testNoTargetNoSessionToken');
fireCheckP2PReg(MANIFEST_URL)
.then((result) => {
is(result, false, 'No target, no sesionToken, result should be false');
runNextTest();
})
.catch(handleRejectedPromise);
}
/**
* Failure scenario onpeerready handler registered but Nfc not enabled
* -> no session token.
*/
function testWithTargetNoSessionToken() {
log('testWithTargetNoSessionToken');
registerOnpeerready()
.then(() => fireCheckP2PReg(MANIFEST_URL))
.then((result) => {
is(result, false,
'session token is available and it shouldnt be');
nfc.onpeerready = null;
runNextTest();
})
.catch(handleRejectedPromise);
}
/**
* Success scenario, nfc enabled, activated RE0 (p2p ndef is received,
* creates session token) opeerreadyhandler registered.
*/
function testWithSessionTokenWithTarget() {
log('testWithSessionTokenWithTarget');
toggleNFC(true)
.then(enableRE0)
.then(registerOnpeerready)
.then(() => fireCheckP2PReg(MANIFEST_URL))
.then((result) => {
is(result, true, 'should be true, onpeerready reg, sessionToken set');
nfc.onpeerready = null;
return toggleNFC(false);
})
.then(runNextTest)
.catch(handleRejectedPromiseWithNfcOn);
}
/**
* Failure scenario, nfc enabled, activated RE0 (p2p ndef is received,
* creates session token) opeerready handler not registered.
*/
function testWithSessionTokenNoTarget() {
log('testWithSessionTokenNoTarget');
toggleNFC(true)
.then(enableRE0)
.then(() => fireCheckP2PReg(MANIFEST_URL))
.then((result) => {
is(result, false,
'session token avilable but onpeerready not registered');
return toggleNFC(false);
})
.then(runNextTest)
.catch(handleRejectedPromiseWithNfcOn);
}
/**
* Failure scenario, nfc enabled, re0 activated, onpeerready registered,
* checking wrong manifest url.
*/
function testWithSessionTokenWrongTarget() {
log('testWithSessionTokenWrongTarget');
toggleNFC(true)
.then(enableRE0)
.then(registerOnpeerready)
.then(() => fireCheckP2PReg(FAKE_MANIFEST_URL))
.then((result) => {
is(result, false, 'should be false, fake manifest, sessionToken set');
nfc.onpeerready = null;
return toggleNFC(false);
})
.then(runNextTest)
.catch(handleRejectedPromiseWithNfcOn);
}
function registerOnpeerready() {
nfc.onpeerready = function() {
ok(false, 'onpeerready callback cannot be fired');
};
let d = Promise.defer();
d.resolve();
return d.promise;
}
function fireCheckP2PReg(manifestUrl) {
let deferred = Promise.defer();
let request = nfc.checkP2PRegistration(manifestUrl);
request.onsuccess = function() {
ok(true, 'checkP2PRegistration allways results in success');
deferred.resolve(request.result);
};
request.onerror = function() {
ok(false, 'see NfcContentHelper.handleCheckP2PRegistrationResponse');
deferred.reject();
};
return deferred.promise;
}
function handleRejectedPromise() {
ok(false, 'Promise rejected. This should not happen');
nfc.onpeerready = null;
runNextTest();
}
function handleRejectedPromiseWithNfcOn() {
ok(false, 'Promise rejected. This should not happen. Turning off nfc');
nfc.onpeerready = null;
toggleNFC(false).then(runNextTest);
}
let tests = [
testNoTargetNoSessionToken,
testWithTargetNoSessionToken,
testWithSessionTokenWithTarget,
testWithSessionTokenNoTarget,
testWithSessionTokenWrongTarget
];
/**
* nfc-manager for mozNfc.checkP2PRegistration(manifestUrl)
* -> "NFC:CheckP2PRegistration" IPC
* nfc-write to set/unset onpeerready
* -> "NFC:RegisterPeerTarget", "NFC:UnregisterPeerTarget" IPC
*/
SpecialPowers.pushPermissions(
[
{'type': 'nfc-manager', 'allow': true, context: document},
{'type': 'nfc-write', 'allow': true, context: document}
], runTests);

View File

@ -0,0 +1,174 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
'use strict';
/* globals log, is, ok, runTests, toggleNFC, runNextTest,
SpecialPowers, nfc, enableRE0, MozNDEFRecord */
const MARIONETTE_TIMEOUT = 30000;
const MARIONETTE_HEAD_JS = 'head.js';
const MANIFEST_URL = 'app://system.gaiamobile.org/manifest.webapp';
const NDEF_MESSAGE = [new MozNDEFRecord(new Uint8Array(0x01),
new Uint8Array(0x84),
new Uint8Array(0),
new Uint8Array(0x20))];
let nfcPeers = [];
let sessionTokens = [];
/**
* Enables nfc and RE0 then registers onpeerready callback and once
* it's fired it creates mozNFCPeer and stores it for later.
* After disabling nfc tries to do mozNFCPeer.sendNDEF which should
* fail with NfcNotEnabledError.
*/
function testNfcNotEnabledError() {
log('testNfcNotEnabledError');
toggleNFC(true)
.then(enableRE0)
.then(registerAndFireOnpeerready)
.then(() => toggleNFC(false))
.then(() => sendNDEFExpectError(nfcPeers[0], 'NfcNotEnabledError'))
.then(endTest)
.catch(handleRejectedPromise);
}
/**
* Enables nfc and RE0, register onpeerready callback, once it's fired
* it creates and stores mozNFCPeer. Disables nfc, enables nfc and
* once again registers and fires new onpeerready callback and stores
* mozNfcPeer. Than fires sendNDEF on the first stored peer which
* should have invalid session token and we should get NfcBadSessionIdError
*/
function testNfcBadSessionIdError() {
log('testNfcBadSessionIdError');
toggleNFC(true)
.then(enableRE0)
.then(registerAndFireOnpeerready)
.then(() => toggleNFC(false))
.then(() => toggleNFC(true))
.then(enableRE0)
.then(registerAndFireOnpeerready)
// we have 2 peers in nfcPeers array, peer0 has old/invalid session token
.then(() => sendNDEFExpectError(nfcPeers[0], 'NfcBadSessionIdError'))
.then(() => toggleNFC(false))
.then(endTest)
.catch(handleRejectedPromise);
}
/**
* Eables nfc and RE0, register onpeerready callback, once it's fired
* it stores sessionToken. Using sessionToken cretes mozNFCTag and fires
* mozNFCTag.connect('NDEF') which should result in NfcConnectError.
*/
function testNfcConnectError() {
log('testNfcConnectError');
toggleNFC(true)
.then(enableRE0)
.then(registerAndFireOnpeerready)
.then(() => connectToNFCTagExpectError(sessionTokens[0],
'NDEF',
'NfcConnectError'))
.then(() => toggleNFC(false))
.then(endTest)
.catch(handleRejectedPromise);
}
function endTest() {
nfcPeers = [];
sessionTokens = [];
runNextTest();
}
function handleRejectedPromise() {
ok(false, 'Handling rejected promise');
toggleNFC(false).then(endTest);
}
function registerAndFireOnpeerready() {
let deferred = Promise.defer();
nfc.onpeerready = function(event) {
sessionTokens.push(event.detail);
nfcPeers.push(nfc.getNFCPeer(event.detail));
nfc.onpeerready = null;
deferred.resolve();
};
let req = nfc.checkP2PRegistration(MANIFEST_URL);
req.onsuccess = function() {
is(req.result, true, 'P2P registration result');
if(req.result) {
nfc.notifyUserAcceptedP2P(MANIFEST_URL);
} else {
ok(false, 'this should not happen');
nfc.onpeerready = null;
deferred.reject();
}
};
req.onerror = function() {
ok(false, 'not possible');
nfc.onpeerready = null;
deferred.reject();
};
return deferred.promise;
}
function sendNDEFExpectError(peer, errorMsg) {
let deferred = Promise.defer();
let req = peer.sendNDEF(NDEF_MESSAGE);
req.onsuccess = function() {
ok(false, 'success on sending ndef not possible shoudl get: ' + errorMsg);
deferred.reject();
};
req.onerror = function() {
ok(true, 'this should happen');
is(req.error.name, errorMsg, 'Should have proper error name');
deferred.resolve();
};
return deferred.promise;
}
function connectToNFCTagExpectError(sessionToken, tech, errorMsg) {
let deferred = Promise.defer();
let nfcTag = nfc.getNFCTag(sessionTokens[0]);
let req = nfcTag.connect(tech);
req.onsuccess = function() {
ok(false, 'we should not be able to connect to the tag');
deferred.reject();
};
req.onerror = function() {
ok(true, 'we should get an error');
is(req.error.name, errorMsg, 'Should have proper error name');
deferred.resolve();
};
return deferred.promise;
}
let tests = [
testNfcNotEnabledError,
testNfcBadSessionIdError,
testNfcConnectError
];
/**
* nfc-manager for mozNfc.checkP2PRegistration(manifestUrl)
* -> "NFC:CheckP2PRegistration" IPC
* nfc-write to set/unset onpeerready
* -> "NFC:RegisterPeerTarget", "NFC:UnregisterPeerTarget" IPC
*/
SpecialPowers.pushPermissions(
[
{'type': 'nfc-manager', 'allow': true, context: document},
{'type': 'nfc-write', 'allow': true, context: document}
], runTests);

View File

@ -315,14 +315,13 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
NFC.NFC_PEER_EVENT_READY);
// Remember the current AppId if registered.
this.currentPeerAppId = (isValid) ? msg.json.appId : null;
let status = (isValid) ? NFC.GECKO_NFC_ERROR_SUCCESS :
NFC.GECKO_NFC_ERROR_GENERIC_FAILURE;
let respMsg = { requestId: msg.json.requestId };
if(!isValid) {
respMsg.errorMsg = this.nfc.getErrorMessage(NFC.NFC_GECKO_ERROR_P2P_REG_INVALID);
}
// Notify the content process immediately of the status
msg.target.sendAsyncMessage(msg.name + "Response", {
status: status,
requestId: msg.json.requestId
});
msg.target.sendAsyncMessage(msg.name + "Response", respMsg);
},
/**
@ -461,22 +460,26 @@ Nfc.prototype = {
},
/**
* Send Error response to content.
* Send Error response to content. This is used only
* in case of discovering an error in message received from
* content process.
*
* @param message
* An nsIMessageListener's message parameter.
*/
sendNfcErrorResponse: function sendNfcErrorResponse(message) {
sendNfcErrorResponse: function sendNfcErrorResponse(message, errorCode) {
if (!message.target) {
return;
}
let nfcMsgType = message.name + "Response";
message.target.sendAsyncMessage(nfcMsgType, {
sessionId: message.json.sessionToken,
requestId: message.json.requestId,
status: NFC.GECKO_NFC_ERROR_GENERIC_FAILURE
});
message.json.errorMsg = this.getErrorMessage(errorCode);
message.target.sendAsyncMessage(nfcMsgType, message.json);
},
getErrorMessage: function getErrorMessage(errorCode) {
return NFC.NFC_ERROR_MSG[errorCode] ||
NFC.NFC_ERROR_MSG[NFC.NFC_GECKO_ERROR_GENERIC_FAILURE];
},
/**
@ -486,6 +489,11 @@ Nfc.prototype = {
let message = event.data;
debug("Received message from NFC worker: " + JSON.stringify(message));
// mapping error code to error message
if(message.status !== NFC.NFC_SUCCESS) {
message.errorMsg = this.getErrorMessage(message.status);
}
switch (message.type) {
case "techDiscovered":
this._currentSessionId = message.sessionId;
@ -525,7 +533,7 @@ Nfc.prototype = {
}
delete this.targetsByRequestId[message.requestId];
if (message.status == NFC.GECKO_NFC_ERROR_SUCCESS) {
if (message.status === NFC.NFC_SUCCESS) {
this.powerLevel = message.powerLevel;
}
@ -580,7 +588,7 @@ Nfc.prototype = {
if (this.powerLevel != NFC.NFC_POWER_LEVEL_ENABLED) {
debug("NFC is not enabled. current powerLevel:" + this.powerLevel);
this.sendNfcErrorResponse(message);
this.sendNfcErrorResponse(message, NFC.NFC_GECKO_ERROR_NOT_ENABLED);
return null;
}
@ -588,7 +596,7 @@ Nfc.prototype = {
if (message.json.sessionToken !== this.sessionTokenMap[this._currentSessionId]) {
debug("Invalid Session Token: " + message.json.sessionToken +
" Expected Session Token: " + this.sessionTokenMap[this._currentSessionId]);
this.sendNfcErrorResponse(message);
this.sendNfcErrorResponse(message, NFC.NFC_ERROR_BAD_SESSION_ID);
return null;
}

View File

@ -383,17 +383,17 @@ NfcContentHelper.prototype = {
Services.DOMRequest.fireSuccess(request, result);
},
fireRequestError: function fireRequestError(requestId, error) {
fireRequestError: function fireRequestError(requestId, errorMsg) {
let request = this.takeRequest(requestId);
if (!request) {
debug("not firing error for id: " + requestId +
", error: " + JSON.stringify(error));
", errormsg: " + errorMsg);
return;
}
debug("fire request error, id: " + requestId +
", result: " + JSON.stringify(error));
Services.DOMRequest.fireError(request, error);
", errormsg: " + errorMsg);
Services.DOMRequest.fireError(request, errorMsg);
},
receiveMessage: function receiveMessage(message) {
@ -416,8 +416,8 @@ NfcContentHelper.prototype = {
case "NFC:MakeReadOnlyNDEFResponse":
case "NFC:NotifySendFileStatusResponse":
case "NFC:ConfigResponse":
if (result.status !== NFC.GECKO_NFC_ERROR_SUCCESS) {
this.fireRequestError(atob(result.requestId), result.status);
if (result.errorMsg) {
this.fireRequestError(atob(result.requestId), result.errorMsg);
} else {
this.fireRequestSuccess(atob(result.requestId), result);
}
@ -442,8 +442,8 @@ NfcContentHelper.prototype = {
}
delete this._requestMap[result.requestId];
if (result.status !== NFC.GECKO_NFC_ERROR_SUCCESS) {
this.fireRequestError(atob(result.requestId), result.status);
if (result.errorMsg) {
this.fireRequestError(atob(result.requestId), result.errorMsg);
return;
}
@ -461,8 +461,8 @@ NfcContentHelper.prototype = {
},
handleGetDetailsNDEFResponse: function handleGetDetailsNDEFResponse(result) {
if (result.status !== NFC.GECKO_NFC_ERROR_SUCCESS) {
this.fireRequestError(atob(result.requestId), result.status);
if (result.errorMsg) {
this.fireRequestError(atob(result.requestId), result.errorMsg);
return;
}
@ -475,7 +475,7 @@ NfcContentHelper.prototype = {
// Privilaged status API. Always fire success to avoid using exposed props.
// The receiver must check the boolean mapped status code to handle.
let requestId = atob(result.requestId);
this.fireRequestSuccess(requestId, result.status == NFC.GECKO_NFC_ERROR_SUCCESS);
this.fireRequestSuccess(requestId, !result.errorMsg);
},
};

View File

@ -56,9 +56,83 @@ this.NFC_TECHS = {
8:"NFC_ISO_DEP"
};
// TODO: Bug 933595. Fill-in all error codes for Gonk/nfcd protocol
this.GECKO_NFC_ERROR_SUCCESS = 0;
this.GECKO_NFC_ERROR_GENERIC_FAILURE = 1;
// nfcd error codes
this.NFC_SUCCESS = 0;
this.NFC_ERROR_IO = -1;
this.NFC_ERROR_CANCELLED = -2;
this.NFC_ERROR_TIMEOUT = -3;
this.NFC_ERROR_BUSY = -4;
this.NFC_ERROR_CONNECT = -5;
this.NFC_ERROR_DISCONNECT = -6;
this.NFC_ERROR_READ = -7;
this.NFC_ERROR_WRITE = -8;
this.NFC_ERROR_INVALID_PARAM = -9;
this.NFC_ERROR_INSUFFICIENT_RESOURCES = -10;
this.NFC_ERROR_SOCKET_CREATION = -11;
this.NFC_ERROR_SOCKET_NOT_CONNECTED = -12;
this.NFC_ERROR_BUFFER_TOO_SMALL = -13;
this.NFC_ERROR_SAP_USED = -14;
this.NFC_ERROR_SERVICE_NAME_USED = -15;
this.NFC_ERROR_SOCKET_OPTIONS = -16;
this.NFC_ERROR_NFC_ALREADY_ON = -17;
this.NFC_ERROR_NFC_ALREADY_OFF = -18;
this.NFC_ERROR_ALREADY_DISCOVERY_ON = -19;
this.NFC_ERROR_ALREADY_DISCOVERY_OFF = -20;
this.NFC_ERROR_FAIL_ENABLE_DISCOVERY = -21;
this.NFC_ERROR_FAIL_DISABLE_DISCOVERY = -22;
this.NFC_ERROR_NOT_INITIALIZED = -23;
this.NFC_ERROR_INITIALIZE_FAIL = -24;
this.NFC_ERROR_DEINITIALIZE_FAIL = -25;
this.NFC_ERROR_SE_ALREADY_SELECTED = -26;
this.NFC_ERROR_SE_CONNECTED = -27;
this.NFC_ERROR_NO_SE_CONNECTED = -28;
this.NFC_ERROR_NOT_SUPPORTED = -29;
this.NFC_ERROR_BAD_SESSION_ID = -30;
this.NFC_ERROR_LOST_TECH = -31;
this.NFC_ERROR_BAD_TECH_TYPE = -32;
// Gecko specific error codes
this.NFC_GECKO_ERROR_GENERIC_FAILURE = 1;
this.NFC_GECKO_ERROR_P2P_REG_INVALID = 2;
this.NFC_GECKO_ERROR_NOT_ENABLED = 3;
this.NFC_ERROR_MSG = {};
this.NFC_ERROR_MSG[this.NFC_ERROR_IO] = "NfcIoError";
this.NFC_ERROR_MSG[this.NFC_ERROR_CANCELLED] = "NfcCancelledError";
this.NFC_ERROR_MSG[this.NFC_ERROR_TIMEOUT] = "NfcTimeoutError";
this.NFC_ERROR_MSG[this.NFC_ERROR_BUSY] = "NfcBusyError";
this.NFC_ERROR_MSG[this.NFC_ERROR_CONNECT] = "NfcConnectError";
this.NFC_ERROR_MSG[this.NFC_ERROR_DISCONNECT] = "NfcDisconnectError";
this.NFC_ERROR_MSG[this.NFC_ERROR_READ] = "NfcReadError";
this.NFC_ERROR_MSG[this.NFC_ERROR_WRITE] = "NfcWriteError";
this.NFC_ERROR_MSG[this.NFC_ERROR_INVALID_PARAM] = "NfcInvalidParamError";
this.NFC_ERROR_MSG[this.NFC_ERROR_INSUFFICIENT_RESOURCES] = "NfcInsufficentResourcesError";
this.NFC_ERROR_MSG[this.NFC_ERROR_SOCKET_CREATION] = "NfcSocketCreationError";
this.NFC_ERROR_MSG[this.NFC_ERROR_SOCKET_NOT_CONNECTED] = "NfcSocketNotConntectedError";
this.NFC_ERROR_MSG[this.NFC_ERROR_BUFFER_TOO_SMALL] = "NfcBufferTooSmallError";
this.NFC_ERROR_MSG[this.NFC_ERROR_SAP_USED] = "NfcSapUsedError";
this.NFC_ERROR_MSG[this.NFC_ERROR_SERVICE_NAME_USED] = "NfcServiceNameUsedError";
this.NFC_ERROR_MSG[this.NFC_ERROR_SOCKET_OPTIONS] = "NfcSocketOptionsError";
this.NFC_ERROR_MSG[this.NFC_ERROR_NFC_ALREADY_ON] = "NfcAlreadOnError";
this.NFC_ERROR_MSG[this.NFC_ERROR_NFC_ALREADY_OFF] = "NfcAlreadyOffError";
this.NFC_ERROR_MSG[this.NFC_ERROR_ALREADY_DISCOVERY_ON] = "NfcDiscoveryOnError";
this.NFC_ERROR_MSG[this.NFC_ERROR_ALREADY_DISCOVERY_OFF] = "NfcDiscoveryOffError";
this.NFC_ERROR_MSG[this.NFC_ERROR_FAIL_ENABLE_DISCOVERY] = "NfcFailEnableDiscoveryError";
this.NFC_ERROR_MSG[this.NFC_ERROR_FAIL_DISABLE_DISCOVERY] = "NfcFailDisableDiscoveryError";
this.NFC_ERROR_MSG[this.NFC_ERROR_NOT_INITIALIZED] = "NfcNotInitializedError";
this.NFC_ERROR_MSG[this.NFC_ERROR_INITIALIZE_FAIL] = "NfcInitializeFailError";
this.NFC_ERROR_MSG[this.NFC_ERROR_DEINITIALIZE_FAIL] = "NfcDeinitializeFailError";
this.NFC_ERROR_MSG[this.NFC_ERROR_SE_ALREADY_SELECTED] = "NfcSeAlreadySelectedError";
this.NFC_ERROR_MSG[this.NFC_ERROR_SE_CONNECTED] = "NfcSeConnectedError";
this.NFC_ERROR_MSG[this.NFC_ERROR_NO_SE_CONNECTED] = "NfcNoSeConnectedError";
this.NFC_ERROR_MSG[this.NFC_ERROR_NOT_SUPPORTED] = "NfcNotSupportedError";
this.NFC_ERROR_MSG[this.NFC_ERROR_BAD_SESSION_ID] = "NfcBadSessionIdError";
this.NFC_ERROR_MSG[this.NFC_ERROR_LOST_TECH] = "NfcLostTechError";
this.NFC_ERROR_MSG[this.NFC_ERROR_BAD_TECH_TYPE] = "NfcBadTechTypeError";
this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_GENERIC_FAILURE] = "NfcGenericFailureError";
this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_P2P_REG_INVALID] = "NfcP2PRegistrationInvalid";
this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_NOT_ENABLED] = "NfcNotEnabledError";
// NFC powerlevels must match config PDUs.
this.NFC_POWER_LEVEL_UNKNOWN = -1;

View File

@ -153,8 +153,7 @@ let NfcWorker = {
message.type = "ReadNDEFResponse";
message.sessionId = sessionId;
message.records = records;
message.status = (error === 0) ? GECKO_NFC_ERROR_SUCCESS :
GECKO_NFC_ERROR_GENERIC_FAILURE;
message.status = error;
this.sendDOMMessage(message);
}
@ -173,8 +172,7 @@ let NfcWorker = {
message.type = "WriteNDEFResponse";
message.sessionId = sessionId;
message.status = (error === 0) ? GECKO_NFC_ERROR_SUCCESS :
GECKO_NFC_ERROR_GENERIC_FAILURE;
message.status = error;
this.sendDOMMessage(message);
};
@ -231,8 +229,7 @@ let NfcWorker = {
message.type = "MakeReadOnlyNDEFResponse";
message.sessionId = sessionId;
message.status = (error === 0) ? GECKO_NFC_ERROR_SUCCESS :
GECKO_NFC_ERROR_GENERIC_FAILURE;
message.status = error;
this.sendDOMMessage(message);
};
@ -260,8 +257,7 @@ let NfcWorker = {
message.isReadOnly = isReadOnly;
message.canBeMadeReadOnly = canBeMadeReadOnly;
message.maxSupportedLength = maxSupportedLength;
message.status = (error === 0) ? GECKO_NFC_ERROR_SUCCESS :
GECKO_NFC_ERROR_GENERIC_FAILURE;
message.status = error;
this.sendDOMMessage(message);
};
Buf.newParcel(NFC_REQUEST_GET_DETAILS, cb);
@ -280,8 +276,7 @@ let NfcWorker = {
message.type = "ConnectResponse";
message.sessionId = sessionId;
message.status = (error === 0) ? GECKO_NFC_ERROR_SUCCESS :
GECKO_NFC_ERROR_GENERIC_FAILURE;
message.status = error;
this.sendDOMMessage(message);
};
@ -299,8 +294,7 @@ let NfcWorker = {
let error = Buf.readInt32();
message.type = "ConfigResponse";
message.status = (error === 0) ? GECKO_NFC_ERROR_SUCCESS :
GECKO_NFC_ERROR_GENERIC_FAILURE;
message.status = error;
this.sendDOMMessage(message);
};
@ -319,8 +313,7 @@ let NfcWorker = {
message.type = "CloseResponse";
message.sessionId = sessionId;
message.status = (error === 0) ? GECKO_NFC_ERROR_SUCCESS :
GECKO_NFC_ERROR_GENERIC_FAILURE;
message.status = error;
this.sendDOMMessage(message);
};

View File

@ -127,7 +127,6 @@ interface nsINfcContentHelper : nsISupports
*
* @param status
* Status of sendFile operation
* (GECKO_NFC_ERROR_SUCCESS, GECKO_NFC_ERROR_GENERIC_FAILURE)
*
* @param requestId
* Request ID of SendFile DOM Request

View File

@ -154,15 +154,18 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
"BlobEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "BluetoothAdapter", b2g: true},
{name: "BluetoothAdapter", b2g: true, permission: "bluetooth"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "BluetoothDevice", b2g: true},
{name: "BluetoothDevice", b2g: true, permission: "bluetooth"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "BluetoothDeviceEvent", b2g: true},
{name: "BluetoothDeviceEvent", b2g: true, permission: "bluetooth"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "BluetoothManager", b2g: true},
{name: "BluetoothDiscoveryStateChangedEvent", b2g: true,
permission: "bluetooth"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "BluetoothStatusChangedEvent", b2g: true},
{name: "BluetoothManager", b2g: true, permission: "bluetooth"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "BluetoothStatusChangedEvent", b2g: true, permission: "bluetooth"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "BoxObject", xbl: true},
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -32,6 +32,7 @@ dictionary MediaPlayStatus
DOMString playStatus = "";
};
[Func="Navigator::HasBluetoothSupport"]
interface BluetoothAdapter : EventTarget {
readonly attribute DOMString address;
readonly attribute unsigned long class;
@ -50,6 +51,9 @@ interface BluetoothAdapter : EventTarget {
attribute EventHandler ondevicefound;
// Fired when discovery process has been done or has started
attribute EventHandler ondiscoverystatechanged;
// Fired when pairing process is completed
attribute EventHandler onpairedstatuschanged;

View File

@ -4,6 +4,7 @@
* 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/. */
[Func="Navigator::HasBluetoothSupport"]
interface BluetoothDevice : EventTarget {
readonly attribute DOMString address;
readonly attribute DOMString name;

View File

@ -4,7 +4,8 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
[Constructor(DOMString type, optional BluetoothDeviceEventInit eventInitDict)]
[Constructor(DOMString type, optional BluetoothDeviceEventInit eventInitDict),
Func="Navigator::HasBluetoothSupport"]
interface BluetoothDeviceEvent : Event
{
readonly attribute BluetoothDevice? device;

View File

@ -0,0 +1,19 @@
/* -*- 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),
Func="Navigator::HasBluetoothSupport"]
interface BluetoothDiscoveryStateChangedEvent : Event
{
readonly attribute boolean discovering;
};
dictionary BluetoothDiscoveryStateChangedEventInit : EventInit
{
boolean discovering = false;
};

View File

@ -3,6 +3,7 @@
* 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/. */
[Func="Navigator::HasBluetoothSupport"]
interface BluetoothManager : EventTarget {
[Throws]
readonly attribute boolean enabled;

View File

@ -4,7 +4,9 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
[Constructor(DOMString type, optional BluetoothStatusChangedEventInit eventInitDict)]
[Constructor(DOMString type,
optional BluetoothStatusChangedEventInit eventInitDict),
Func="Navigator::HasBluetoothSupport"]
interface BluetoothStatusChangedEvent : Event
{
readonly attribute DOMString address;

View File

@ -656,6 +656,7 @@ if CONFIG['MOZ_GAMEPAD']:
if CONFIG['MOZ_B2G_BT']:
GENERATED_EVENTS_WEBIDL_FILES += [
'BluetoothDeviceEvent.webidl',
'BluetoothDiscoveryStateChangedEvent.webidl',
'BluetoothStatusChangedEvent.webidl',
]

View File

@ -840,12 +840,6 @@ struct RtspConnectionHandler : public AHandler {
size_t trackIndex = 0;
msg->findSize("trackIndex", &trackIndex);
postQueueEOS(trackIndex, ERROR_END_OF_STREAM);
TrackInfo *info = &mTracks.editItemAt(trackIndex);
if (info) {
mRTPConn->removeStream(info->mRTPSocket, info->mRTCPSocket);
PR_Close(info->mRTPSocket);
PR_Close(info->mRTCPSocket);
}
break;
}

View File

@ -247,7 +247,7 @@ void RTSPSource::performSuspend() {
}
void RTSPSource::performSeek(int64_t seekTimeUs) {
if (mState != PLAYING && mState != PAUSING) {
if (mState != CONNECTED && mState != PLAYING && mState != PAUSING) {
return;
}