mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Merge m-c to fx-team, a=merge
--HG-- extra : commitid : 2bzybQqlwy0
This commit is contained in:
commit
c0ece6bf0d
@ -478,14 +478,17 @@
|
||||
attrs = { "font-family": kAbsentFontFamily };
|
||||
testTextAttrs(ID, 18, attrs, defAttrs, 18, 22);
|
||||
|
||||
attrs = { };
|
||||
testTextAttrs(ID, 22, attrs, defAttrs, 22, 27);
|
||||
// bug 1224498 - this fails with 'cursive' fontconfig lookup
|
||||
if (!LINUX) {
|
||||
attrs = { };
|
||||
testTextAttrs(ID, 22, attrs, defAttrs, 22, 27);
|
||||
|
||||
attrs = { "font-family": kCursiveFontFamily };
|
||||
testTextAttrs(ID, 27, attrs, defAttrs, 27, 31);
|
||||
attrs = { "font-family": kCursiveFontFamily };
|
||||
testTextAttrs(ID, 27, attrs, defAttrs, 27, 31);
|
||||
|
||||
attrs = { };
|
||||
testTextAttrs(ID, 31, attrs, defAttrs, 31, 44);
|
||||
attrs = { };
|
||||
testTextAttrs(ID, 31, attrs, defAttrs, 31, 44);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// area17, "text-decoration" tests
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e8c15ae4e5324a210000ee0a869a962aa542009f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="54167ef91545c948e44098deb9f721210890eaf0"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f009c98ba697582c857c5788e5cdf0640e287ae6"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- 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="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e8c15ae4e5324a210000ee0a869a962aa542009f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="54167ef91545c948e44098deb9f721210890eaf0"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f009c98ba697582c857c5788e5cdf0640e287ae6"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- 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="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
|
@ -19,7 +19,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="e8c15ae4e5324a210000ee0a869a962aa542009f"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="54167ef91545c948e44098deb9f721210890eaf0"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cb4604d5a578efd027277059ce3e0f6e3af59bd1"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e8c15ae4e5324a210000ee0a869a962aa542009f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="54167ef91545c948e44098deb9f721210890eaf0"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f009c98ba697582c857c5788e5cdf0640e287ae6"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e8c15ae4e5324a210000ee0a869a962aa542009f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="54167ef91545c948e44098deb9f721210890eaf0"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f009c98ba697582c857c5788e5cdf0640e287ae6"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- 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"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e8c15ae4e5324a210000ee0a869a962aa542009f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="54167ef91545c948e44098deb9f721210890eaf0"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f009c98ba697582c857c5788e5cdf0640e287ae6"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
|
@ -19,7 +19,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="e8c15ae4e5324a210000ee0a869a962aa542009f"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="54167ef91545c948e44098deb9f721210890eaf0"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cb4604d5a578efd027277059ce3e0f6e3af59bd1"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e8c15ae4e5324a210000ee0a869a962aa542009f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="54167ef91545c948e44098deb9f721210890eaf0"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f009c98ba697582c857c5788e5cdf0640e287ae6"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- 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="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"git": {
|
||||
"git_revision": "e8c15ae4e5324a210000ee0a869a962aa542009f",
|
||||
"git_revision": "54167ef91545c948e44098deb9f721210890eaf0",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "6394e546d2ec13a35c18d2c2bfb66e238c040fdc",
|
||||
"revision": "503587ee1e9b599ee7f2f8a0be7256141c4c48c6",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e8c15ae4e5324a210000ee0a869a962aa542009f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="54167ef91545c948e44098deb9f721210890eaf0"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f009c98ba697582c857c5788e5cdf0640e287ae6"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- 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"/>
|
||||
|
@ -18,10 +18,10 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e8c15ae4e5324a210000ee0a869a962aa542009f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="54167ef91545c948e44098deb9f721210890eaf0"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f009c98ba697582c857c5788e5cdf0640e287ae6"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e8c15ae4e5324a210000ee0a869a962aa542009f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="54167ef91545c948e44098deb9f721210890eaf0"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f009c98ba697582c857c5788e5cdf0640e287ae6"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
|
@ -1,2 +1,19 @@
|
||||
console.log('script evaluation');
|
||||
|
||||
console.log("Hello from serviceworker");
|
||||
addEventListener('install', function(evt) {
|
||||
console.log('install event');
|
||||
});
|
||||
|
||||
addEventListener('activate', function(evt) {
|
||||
console.log('activate event');
|
||||
});
|
||||
|
||||
addEventListener('fetch', function(evt) {
|
||||
console.log('fetch event: ' + evt.request.url);
|
||||
evt.respondWith(new Response('Hello world'));
|
||||
});
|
||||
|
||||
addEventListener('message', function(evt) {
|
||||
console.log('message event: ' + evt.data.message);
|
||||
evt.source.postMessage({ type: 'PONG' });
|
||||
});
|
||||
|
@ -14,16 +14,40 @@
|
||||
<script class="testbody" type="text/javascript;version=1.8">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let SERVICE_WORKER_URL = "https://example.com/chrome/devtools/shared/webconsole/test/helper_serviceworker.js";
|
||||
let FRAME_URL = "https://example.com/chrome/devtools/shared/webconsole/test/sandboxed_iframe.html";
|
||||
let BASE_URL = "https://example.com/chrome/devtools/shared/webconsole/test/";
|
||||
let SERVICE_WORKER_URL = BASE_URL + "helper_serviceworker.js";
|
||||
let SCOPE = BASE_URL + "foo/";
|
||||
let NONSCOPE_FRAME_URL = BASE_URL + "sandboxed_iframe.html";
|
||||
let SCOPE_FRAME_URL = SCOPE + "fake.html";
|
||||
let SCOPE_FRAME_URL2 = SCOPE + "whatsit.html";
|
||||
let MESSAGE = 'Tic Tock';
|
||||
|
||||
let swClosed = new Promise(() => {});
|
||||
let expectedConsoleCalls = [
|
||||
{
|
||||
level: "log",
|
||||
filename: /helper_serviceworker/,
|
||||
arguments: ["Hello from serviceworker"],
|
||||
}
|
||||
arguments: ['script evaluation'],
|
||||
},
|
||||
{
|
||||
level: "log",
|
||||
filename: /helper_serviceworker/,
|
||||
arguments: ['install event'],
|
||||
},
|
||||
{
|
||||
level: "log",
|
||||
filename: /helper_serviceworker/,
|
||||
arguments: ['activate event'],
|
||||
},
|
||||
{
|
||||
level: "log",
|
||||
filename: /helper_serviceworker/,
|
||||
arguments: ['fetch event: ' + SCOPE_FRAME_URL],
|
||||
},
|
||||
{
|
||||
level: "log",
|
||||
filename: /helper_serviceworker/,
|
||||
arguments: ['fetch event: ' + SCOPE_FRAME_URL2],
|
||||
},
|
||||
];
|
||||
let consoleCalls = [];
|
||||
|
||||
@ -40,55 +64,160 @@ let startTest = Task.async(function*() {
|
||||
});
|
||||
addEventListener("load", startTest);
|
||||
|
||||
function onAttach(state, response) {
|
||||
onConsoleAPICall = onConsoleAPICall.bind(null, state);
|
||||
state.dbgClient.addListener("consoleAPICall", onConsoleAPICall);
|
||||
|
||||
info("Loading a ServiceWorker that will use console API");
|
||||
swClosed = new Promise(resolve => {
|
||||
function withFrame(url) {
|
||||
return new Promise(resolve => {
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.onload = function() {
|
||||
let win = iframe.contentWindow;
|
||||
info("Registering the service worker");
|
||||
win.navigator.serviceWorker.register(SERVICE_WORKER_URL).then(swr => {
|
||||
|
||||
info("Service worker registered. Unregistering");
|
||||
swr.unregister().then(() => {
|
||||
resolve();
|
||||
});
|
||||
}, error => {
|
||||
info("Error registering service worker: " + error);
|
||||
});
|
||||
resolve(iframe);
|
||||
};
|
||||
iframe.src = FRAME_URL;
|
||||
|
||||
iframe.src = url;
|
||||
document.body.appendChild(iframe);
|
||||
});
|
||||
}
|
||||
|
||||
function navigateFrame(iframe, url) {
|
||||
return new Promise(resolve => {
|
||||
iframe.onload = function() {
|
||||
resolve(iframe);
|
||||
};
|
||||
iframe.src = url;
|
||||
});
|
||||
}
|
||||
|
||||
function forceReloadFrame(iframe) {
|
||||
return new Promise(resolve => {
|
||||
iframe.onload = function() {
|
||||
resolve(iframe);
|
||||
};
|
||||
iframe.contentWindow.location.reload(true);
|
||||
});
|
||||
}
|
||||
|
||||
function withActiveServiceWorker(win, url, scope) {
|
||||
return win.navigator.serviceWorker.register(url, { scope: scope }).then(swr => {
|
||||
if (swr.active) {
|
||||
return swr;
|
||||
}
|
||||
|
||||
// Unfortunately we can't just use navigator.serviceWorker.ready promise
|
||||
// here. If the service worker is for a scope that does not cover the window
|
||||
// then the ready promise will never resolve. Instead monitor the service
|
||||
// workers state change events to determine when its activated.
|
||||
return new Promise(resolve => {
|
||||
let sw = swr.waiting || swr.installing;
|
||||
sw.addEventListener('statechange', function stateHandler(evt) {
|
||||
if (sw.state === 'activated') {
|
||||
sw.removeEventListener('statechange', stateHandler);
|
||||
resolve(swr);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function messageServiceWorker(win, scope, message) {
|
||||
return win.navigator.serviceWorker.getRegistration(scope).then(swr => {
|
||||
return new Promise(resolve => {
|
||||
win.navigator.serviceWorker.onmessage = evt => {
|
||||
resolve();
|
||||
};
|
||||
let sw = swr.active || swr.waiting || swr.installing;
|
||||
sw.postMessage({ type: 'PING', message: message });
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function unregisterServiceWorker(win) {
|
||||
return win.navigator.serviceWorker.ready.then(swr => {
|
||||
return swr.unregister();
|
||||
});
|
||||
}
|
||||
|
||||
let onAttach = Task.async(function*(state, response) {
|
||||
onConsoleAPICall = onConsoleAPICall.bind(null, state);
|
||||
state.dbgClient.addListener("consoleAPICall", onConsoleAPICall);
|
||||
|
||||
let currentFrame;
|
||||
try {
|
||||
// First, we need a frame from which to register our script. This
|
||||
// will not trigger any console calls.
|
||||
info("Loading a non-scope frame from which to register a service worker.");
|
||||
currentFrame = yield withFrame(NONSCOPE_FRAME_URL);
|
||||
|
||||
// Now register the service worker and wait for it to become
|
||||
// activate. This should trigger 3 console calls; 1 for script
|
||||
// evaluation, 1 for the install event, and 1 for the activate
|
||||
// event. These console calls are received because we called
|
||||
// register(), not because we are in scope for the worker.
|
||||
info("Registering the service worker");
|
||||
yield withActiveServiceWorker(currentFrame.contentWindow,
|
||||
SERVICE_WORKER_URL, SCOPE);
|
||||
ok(!currentFrame.contentWindow.navigator.serviceWorker.controller,
|
||||
'current frame should not be controlled');
|
||||
|
||||
// Now that the service worker is activate, lets navigate our frame.
|
||||
// This will trigger 1 more console call for the fetch event.
|
||||
info("Service worker registered. Navigating frame.");
|
||||
yield navigateFrame(currentFrame, SCOPE_FRAME_URL);
|
||||
ok(currentFrame.contentWindow.navigator.serviceWorker.controller,
|
||||
'navigated frame should be controlled');
|
||||
|
||||
// We now have a controlled frame. Lets perform a non-navigation fetch.
|
||||
// This should produce another console call for the fetch event.
|
||||
info("Frame navigated. Calling fetch().");
|
||||
yield currentFrame.contentWindow.fetch(SCOPE_FRAME_URL2);
|
||||
|
||||
// Now force refresh our controlled frame. This will cause the frame
|
||||
// to bypass the service worker and become an uncontrolled frame. It
|
||||
// also happens to make the frame display a 404 message because the URL
|
||||
// does not resolve to a real resource. This is ok, as we really only
|
||||
// care about the frame being non-controlled, but still having a location
|
||||
// that matches our service worker scope so we can provide its not
|
||||
// incorrectly getting console calls.
|
||||
info("Completed fetch(). Force refreshing to get uncontrolled frame.");
|
||||
yield forceReloadFrame(currentFrame);
|
||||
ok(!currentFrame.contentWindow.navigator.serviceWorker.controller,
|
||||
'current frame should not be controlled after force refresh');
|
||||
is(currentFrame.contentWindow.location.toString(), SCOPE_FRAME_URL,
|
||||
'current frame should still have in-scope location URL even though it got 404');
|
||||
|
||||
// Now postMessage() the service worker to trigger its message event
|
||||
// handler. This will generate 1 or 2 to console.log() statements
|
||||
// depending on if the worker thread needs to spin up again. In either
|
||||
// case, though, we should not get any console calls because we don't
|
||||
// have a controlled or registering document.
|
||||
info("Completed force refresh. Messaging service worker.");
|
||||
yield messageServiceWorker(currentFrame.contentWindow, SCOPE, MESSAGE);
|
||||
|
||||
info("Done messaging service worker. Unregistering service worker.");
|
||||
yield unregisterServiceWorker(currentFrame.contentWindow);
|
||||
|
||||
info('Service worker unregistered. Checking console calls.');
|
||||
state.dbgClient.removeListener("consoleAPICall", onConsoleAPICall);
|
||||
is(consoleCalls.length, expectedConsoleCalls.length,
|
||||
'received correct number of console calls');
|
||||
expectedConsoleCalls.forEach(function(aMessage, aIndex) {
|
||||
info("checking received console call #" + aIndex);
|
||||
checkConsoleAPICall(consoleCalls[aIndex], expectedConsoleCalls[aIndex]);
|
||||
});
|
||||
} catch(error) {
|
||||
ok(false, 'unexpected error: ' + error);
|
||||
} finally {
|
||||
if (currentFrame) {
|
||||
currentFrame.remove();
|
||||
currentFrame = null;
|
||||
}
|
||||
consoleCalls = [];
|
||||
closeDebugger(state, function() {
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function onConsoleAPICall(state, type, packet) {
|
||||
info("received message level: " + packet.message.level);
|
||||
is(packet.from, state.actor, "console API call actor");
|
||||
|
||||
consoleCalls.push(packet.message);
|
||||
if (consoleCalls.length != expectedConsoleCalls.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
state.dbgClient.removeListener("consoleAPICall", onConsoleAPICall);
|
||||
|
||||
expectedConsoleCalls.forEach(function(aMessage, aIndex) {
|
||||
info("checking received console call #" + aIndex);
|
||||
checkConsoleAPICall(consoleCalls[aIndex], expectedConsoleCalls[aIndex]);
|
||||
});
|
||||
|
||||
consoleCalls = [];
|
||||
|
||||
closeDebugger(state, function() {
|
||||
swClosed.then(() => {
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@ -18,6 +18,11 @@ loader.lazyImporter(this, "Services", "resource://gre/modules/Services.jsm");
|
||||
loader.lazyImporter(this, "VariablesView", "resource://devtools/client/shared/widgets/VariablesView.jsm");
|
||||
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this,
|
||||
"swm",
|
||||
"@mozilla.org/serviceworkers/manager;1",
|
||||
"nsIServiceWorkerManager");
|
||||
|
||||
// Match the function name from the result of toString() or toSource().
|
||||
//
|
||||
// Examples:
|
||||
@ -126,29 +131,6 @@ var WebConsoleUtils = {
|
||||
aTo.style.fontStyle = style.getPropertyCSSValue("font-style").cssText;
|
||||
},
|
||||
|
||||
/**
|
||||
* Recursively gather a list of window locations given
|
||||
* a top level window.
|
||||
*
|
||||
* @param nsIDOMWindow aWindow
|
||||
* @return Array
|
||||
* list of window locations as strings
|
||||
*/
|
||||
getLocationsForFrames: function(aWindow)
|
||||
{
|
||||
let location = aWindow.location.toString();
|
||||
let locations = [location];
|
||||
|
||||
if (aWindow.frames) {
|
||||
for (let i = 0; i < aWindow.frames.length; i++) {
|
||||
let frame = aWindow.frames[i];
|
||||
locations = locations.concat(this.getLocationsForFrames(frame));
|
||||
}
|
||||
}
|
||||
|
||||
return locations;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the ID of the inner window of this DOM window.
|
||||
*
|
||||
@ -994,9 +976,8 @@ ConsoleAPIListener.prototype =
|
||||
// scope, which can be used to determine whether it's controlling
|
||||
// a window.
|
||||
let scope = message.ID;
|
||||
let locations = WebConsoleUtils.getLocationsForFrames(this.window);
|
||||
|
||||
if (!locations.some(loc => loc.startsWith(scope))) {
|
||||
if (!swm.shouldReportToWindow(this.window, scope)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -13714,6 +13714,13 @@ nsDocShell::SetIsBrowserInsideApp(uint32_t aContainingAppId)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetIsSignedPackage(const nsAString& aSignedPkg)
|
||||
{
|
||||
mSignedPkg = aSignedPkg;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetIsBrowserElement(bool* aIsBrowser)
|
||||
{
|
||||
@ -13821,6 +13828,9 @@ nsDocShell::GetOriginAttributes()
|
||||
attrs.mInBrowser = true;
|
||||
}
|
||||
|
||||
// Bug 1209162 will address the inheritance of each attributes.
|
||||
attrs.mSignedPkg = mSignedPkg;
|
||||
|
||||
return attrs;
|
||||
}
|
||||
|
||||
|
@ -1005,6 +1005,10 @@ protected:
|
||||
|
||||
nsString GetInheritedPaymentRequestId();
|
||||
|
||||
// The packageId for a signed packaged iff this docShell is created
|
||||
// for a signed package.
|
||||
nsString mSignedPkg;
|
||||
|
||||
private:
|
||||
nsCString mForcedCharset;
|
||||
nsCString mParentCharset;
|
||||
|
@ -43,7 +43,7 @@ interface nsITabParent;
|
||||
|
||||
typedef unsigned long nsLoadFlags;
|
||||
|
||||
[scriptable, builtinclass, uuid(41b1cf17-b37b-4a62-9df8-5f67cfecab3f)]
|
||||
[scriptable, builtinclass, uuid(63adb599-6dc9-4746-972e-c22e9018020b)]
|
||||
interface nsIDocShell : nsIDocShellTreeItem
|
||||
{
|
||||
/**
|
||||
@ -824,6 +824,12 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||
*/
|
||||
void setIsBrowserInsideApp(in unsigned long containingAppId);
|
||||
|
||||
/**
|
||||
* Indicate that this docshell corresponds to a signed package with
|
||||
* the given packageId.
|
||||
*/
|
||||
void setIsSignedPackage(in AString packageId);
|
||||
|
||||
/**
|
||||
* Returns the id of the app associated with this docshell. If this docshell
|
||||
* is an <iframe mozbrowser> inside an <iframe mozapp>, we return the app's
|
||||
|
@ -49,6 +49,8 @@ XPCOMUtils.defineLazyGetter(this, "powerManagerService", function() {
|
||||
*/
|
||||
|
||||
this.AlarmService = {
|
||||
lastChromeId: 0,
|
||||
|
||||
init: function init() {
|
||||
debug("init()");
|
||||
|
||||
@ -205,6 +207,12 @@ this.AlarmService = {
|
||||
};
|
||||
}
|
||||
|
||||
// Is this a chrome alarm?
|
||||
if (aId < 0) {
|
||||
aRemoveSuccessCb();
|
||||
return;
|
||||
}
|
||||
|
||||
this._db.remove(aId, aManifestURL, aRemoveSuccessCb,
|
||||
function removeErrorCb(aErrorMsg) {
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
@ -241,11 +249,19 @@ this.AlarmService = {
|
||||
_notifyAlarmObserver: function _notifyAlarmObserver(aAlarm) {
|
||||
debug("_notifyAlarmObserver()");
|
||||
|
||||
if (aAlarm.manifestURL) {
|
||||
this._fireSystemMessage(aAlarm);
|
||||
} else if (typeof aAlarm.alarmFiredCb === "function") {
|
||||
aAlarm.alarmFiredCb(this._publicAlarm(aAlarm));
|
||||
}
|
||||
let wakeLock = powerManagerService.newWakeLock("cpu");
|
||||
|
||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer.initWithCallback(() => {
|
||||
debug("_notifyAlarmObserver - timeout()");
|
||||
if (aAlarm.manifestURL) {
|
||||
this._fireSystemMessage(aAlarm);
|
||||
} else if (typeof aAlarm.alarmFiredCb === "function") {
|
||||
aAlarm.alarmFiredCb(this._publicAlarm(aAlarm));
|
||||
}
|
||||
|
||||
wakeLock.unlock();
|
||||
}, 0, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
},
|
||||
|
||||
_onAlarmFired: function _onAlarmFired() {
|
||||
@ -265,8 +281,12 @@ this.AlarmService = {
|
||||
}
|
||||
|
||||
this._removeAlarmFromDb(this._currentAlarm.id, null);
|
||||
this._notifyAlarmObserver(this._currentAlarm);
|
||||
// We need to clear the current alarm before notifying because chrome
|
||||
// alarms may add a new alarm during their callback, and we do not want
|
||||
// to clobber it.
|
||||
let firingAlarm = this._currentAlarm;
|
||||
this._currentAlarm = null;
|
||||
this._notifyAlarmObserver(firingAlarm);
|
||||
}
|
||||
|
||||
// Reset the next alarm from the queue.
|
||||
@ -309,15 +329,25 @@ this.AlarmService = {
|
||||
debug("Callback after getting alarms from database: " +
|
||||
JSON.stringify(aAlarms));
|
||||
|
||||
// Clear any alarms set or queued in the cache.
|
||||
// Clear any alarms set or queued in the cache if coming from db.
|
||||
let alarmQueue = this._alarmQueue;
|
||||
alarmQueue.length = 0;
|
||||
this._currentAlarm = null;
|
||||
if (this._currentAlarm) {
|
||||
alarmQueue.unshift(this._currentAlarm);
|
||||
this._currentAlarm = null;
|
||||
}
|
||||
for (let i = 0; i < alarmQueue.length;) {
|
||||
if (alarmQueue[i]['id'] < 0) {
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
alarmQueue.splice(i, 1);
|
||||
}
|
||||
|
||||
// Only restore the alarm that's not yet expired; otherwise, remove it
|
||||
// from the database and notify the observer.
|
||||
aAlarms.forEach(function addAlarm(aAlarm) {
|
||||
if (this._getAlarmTime(aAlarm) > Date.now()) {
|
||||
if ("manifestURL" in aAlarm && aAlarm.manifestURL &&
|
||||
this._getAlarmTime(aAlarm) > Date.now()) {
|
||||
alarmQueue.push(aAlarm);
|
||||
} else {
|
||||
this._removeAlarmFromDb(aAlarm.id, null);
|
||||
@ -416,55 +446,65 @@ this.AlarmService = {
|
||||
|
||||
aNewAlarm['timezoneOffset'] = this._currentTimezoneOffset;
|
||||
|
||||
this._db.add(aNewAlarm,
|
||||
function addSuccessCb(aNewId) {
|
||||
debug("Callback after adding alarm in database.");
|
||||
if ("manifestURL" in aNewAlarm) {
|
||||
this._db.add(aNewAlarm,
|
||||
function addSuccessCb(aNewId) {
|
||||
debug("Callback after adding alarm in database.");
|
||||
this.processNewAlarm(aNewAlarm, aNewId, aAlarmFiredCb, aSuccessCb);
|
||||
}.bind(this),
|
||||
function addErrorCb(aErrorMsg) {
|
||||
aErrorCb(aErrorMsg);
|
||||
}.bind(this));
|
||||
} else {
|
||||
// alarms without manifests are managed by chrome code. For them we use
|
||||
// negative IDs.
|
||||
this.processNewAlarm(aNewAlarm, --this.lastChromeId, aAlarmFiredCb,
|
||||
aSuccessCb);
|
||||
}
|
||||
},
|
||||
|
||||
aNewAlarm['id'] = aNewId;
|
||||
processNewAlarm: function(aNewAlarm, aNewId, aAlarmFiredCb, aSuccessCb) {
|
||||
aNewAlarm['id'] = aNewId;
|
||||
|
||||
// Now that the alarm has been added to the database, we can tack on
|
||||
// the non-serializable callback to the in-memory object.
|
||||
aNewAlarm['alarmFiredCb'] = aAlarmFiredCb;
|
||||
// Now that the alarm has been added to the database, we can tack on
|
||||
// the non-serializable callback to the in-memory object.
|
||||
aNewAlarm['alarmFiredCb'] = aAlarmFiredCb;
|
||||
|
||||
// If the new alarm already expired at this moment, we directly
|
||||
// notify this alarm
|
||||
let aNewAlarmTime = this._getAlarmTime(aNewAlarm);
|
||||
if (aNewAlarmTime < Date.now()) {
|
||||
aSuccessCb(aNewId);
|
||||
this._removeAlarmFromDb(aNewAlarm.id, null);
|
||||
this._notifyAlarmObserver(aNewAlarm);
|
||||
return;
|
||||
}
|
||||
// If the new alarm already expired at this moment, we directly
|
||||
// notify this alarm
|
||||
let newAlarmTime = this._getAlarmTime(aNewAlarm);
|
||||
if (newAlarmTime < Date.now()) {
|
||||
aSuccessCb(aNewId);
|
||||
this._removeAlarmFromDb(aNewAlarm.id, null);
|
||||
this._notifyAlarmObserver(aNewAlarm);
|
||||
return;
|
||||
}
|
||||
|
||||
// If there is no alarm being set in system, set the new alarm.
|
||||
if (this._currentAlarm == null) {
|
||||
this._currentAlarm = aNewAlarm;
|
||||
this._debugCurrentAlarm();
|
||||
aSuccessCb(aNewId);
|
||||
return;
|
||||
}
|
||||
// If there is no alarm being set in system, set the new alarm.
|
||||
if (this._currentAlarm == null) {
|
||||
this._currentAlarm = aNewAlarm;
|
||||
this._debugCurrentAlarm();
|
||||
aSuccessCb(aNewId);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the new alarm is earlier than the current alarm, swap them and
|
||||
// push the previous alarm back to the queue.
|
||||
let alarmQueue = this._alarmQueue;
|
||||
let currentAlarmTime = this._getAlarmTime(this._currentAlarm);
|
||||
if (aNewAlarmTime < currentAlarmTime) {
|
||||
alarmQueue.unshift(this._currentAlarm);
|
||||
this._currentAlarm = aNewAlarm;
|
||||
this._debugCurrentAlarm();
|
||||
aSuccessCb(aNewId);
|
||||
return;
|
||||
}
|
||||
// If the new alarm is earlier than the current alarm, swap them and
|
||||
// push the previous alarm back to the queue.
|
||||
let alarmQueue = this._alarmQueue;
|
||||
let currentAlarmTime = this._getAlarmTime(this._currentAlarm);
|
||||
if (newAlarmTime < currentAlarmTime) {
|
||||
alarmQueue.unshift(this._currentAlarm);
|
||||
this._currentAlarm = aNewAlarm;
|
||||
this._debugCurrentAlarm();
|
||||
aSuccessCb(aNewId);
|
||||
return;
|
||||
}
|
||||
|
||||
// Push the new alarm in the queue.
|
||||
alarmQueue.push(aNewAlarm);
|
||||
alarmQueue.sort(this._sortAlarmByTimeStamps.bind(this));
|
||||
this._debugCurrentAlarm();
|
||||
aSuccessCb(aNewId);
|
||||
}.bind(this),
|
||||
function addErrorCb(aErrorMsg) {
|
||||
aErrorCb(aErrorMsg);
|
||||
}.bind(this));
|
||||
// Push the new alarm in the queue.
|
||||
alarmQueue.push(aNewAlarm);
|
||||
alarmQueue.sort(this._sortAlarmByTimeStamps.bind(this));
|
||||
this._debugCurrentAlarm();
|
||||
aSuccessCb(aNewId);
|
||||
},
|
||||
|
||||
/*
|
||||
|
@ -601,6 +601,10 @@ Animation::DoCancel()
|
||||
mStartTime.SetNull();
|
||||
|
||||
UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);
|
||||
|
||||
if (mTimeline) {
|
||||
mTimeline->RemoveAnimation(this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration
|
||||
#include "mozilla/dom/AnimationBinding.h" // for AnimationPlayState
|
||||
#include "mozilla/dom/AnimationTimeline.h" // for AnimationTimeline
|
||||
@ -48,6 +49,7 @@ class CSSTransition;
|
||||
|
||||
class Animation
|
||||
: public DOMEventTargetHelper
|
||||
, public LinkedListElement<Animation>
|
||||
{
|
||||
protected:
|
||||
virtual ~Animation() {}
|
||||
|
@ -6,12 +6,25 @@
|
||||
|
||||
#include "AnimationTimeline.h"
|
||||
#include "mozilla/AnimationComparator.h"
|
||||
#include "mozilla/dom/Animation.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AnimationTimeline, mWindow,
|
||||
mAnimationOrder)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(AnimationTimeline)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AnimationTimeline)
|
||||
tmp->mAnimationOrder.clear();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow, mAnimations)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(AnimationTimeline)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow, mAnimations)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(AnimationTimeline)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(AnimationTimeline)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(AnimationTimeline)
|
||||
@ -32,9 +45,10 @@ AnimationTimeline::GetAnimations(AnimationSequence& aAnimations)
|
||||
}
|
||||
}
|
||||
|
||||
aAnimations.SetCapacity(mAnimationOrder.Length());
|
||||
aAnimations.SetCapacity(mAnimations.Count());
|
||||
|
||||
for (Animation* animation : mAnimationOrder) {
|
||||
for (Animation* animation = mAnimationOrder.getFirst(); animation;
|
||||
animation = animation->getNext()) {
|
||||
|
||||
// Skip animations which are no longer relevant or which have been
|
||||
// associated with another timeline. These animations will be removed
|
||||
@ -69,8 +83,22 @@ AnimationTimeline::NotifyAnimationUpdated(Animation& aAnimation)
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAnimation.GetTimeline() && aAnimation.GetTimeline() != this) {
|
||||
aAnimation.GetTimeline()->RemoveAnimation(&aAnimation);
|
||||
}
|
||||
|
||||
mAnimations.PutEntry(&aAnimation);
|
||||
mAnimationOrder.AppendElement(&aAnimation);
|
||||
mAnimationOrder.insertBack(&aAnimation);
|
||||
}
|
||||
|
||||
void
|
||||
AnimationTimeline::RemoveAnimation(Animation* aAnimation)
|
||||
{
|
||||
MOZ_ASSERT(!aAnimation->GetTimeline() || aAnimation->GetTimeline() == this);
|
||||
if (aAnimation->isInList()) {
|
||||
aAnimation->remove();
|
||||
}
|
||||
mAnimations.RemoveEntry(aAnimation);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
@ -40,7 +40,10 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~AnimationTimeline() { }
|
||||
virtual ~AnimationTimeline()
|
||||
{
|
||||
mAnimationOrder.clear();
|
||||
}
|
||||
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
@ -91,6 +94,8 @@ public:
|
||||
*/
|
||||
virtual void NotifyAnimationUpdated(Animation& aAnimation);
|
||||
|
||||
void RemoveAnimation(Animation* aAnimation);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIGlobalObject> mWindow;
|
||||
|
||||
@ -99,13 +104,11 @@ protected:
|
||||
// We store them in (a) a hashset for quick lookup, and (b) an array
|
||||
// to maintain a fixed sampling order.
|
||||
//
|
||||
// The array keeps a strong reference to each animation in order
|
||||
// to save some addref/release traffic and because we never dereference
|
||||
// the pointers in the hashset.
|
||||
typedef nsTHashtable<nsPtrHashKey<dom::Animation>> AnimationSet;
|
||||
typedef nsTArray<RefPtr<dom::Animation>> AnimationArray;
|
||||
AnimationSet mAnimations;
|
||||
AnimationArray mAnimationOrder;
|
||||
// The hashset keeps a strong reference to each animation since
|
||||
// dealing with addref/release with LinkedList is difficult.
|
||||
typedef nsTHashtable<nsRefPtrHashKey<dom::Animation>> AnimationSet;
|
||||
AnimationSet mAnimations;
|
||||
LinkedList<dom::Animation> mAnimationOrder;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -112,14 +112,18 @@ DocumentTimeline::WillRefresh(mozilla::TimeStamp aTime)
|
||||
MOZ_ASSERT(mIsObservingRefreshDriver);
|
||||
|
||||
bool needsTicks = false;
|
||||
AnimationArray animationsToKeep(mAnimationOrder.Length());
|
||||
nsTArray<Animation*> animationsToRemove(mAnimations.Count());
|
||||
|
||||
nsAutoAnimationMutationBatch mb(mDocument);
|
||||
|
||||
for (Animation* animation : mAnimationOrder) {
|
||||
for (Animation* animation = mAnimationOrder.getFirst(); animation;
|
||||
animation = animation->getNext()) {
|
||||
// Skip any animations that are longer need associated with this timeline.
|
||||
if (animation->GetTimeline() != this) {
|
||||
mAnimations.RemoveEntry(animation);
|
||||
// If animation has some other timeline, it better not be also in the
|
||||
// animation list of this timeline object!
|
||||
MOZ_ASSERT(!animation->GetTimeline());
|
||||
animationsToRemove.AppendElement(animation);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -129,14 +133,14 @@ DocumentTimeline::WillRefresh(mozilla::TimeStamp aTime)
|
||||
// order to dispatch events.
|
||||
animation->Tick();
|
||||
|
||||
if (animation->IsRelevant() || animation->NeedsTicks()) {
|
||||
animationsToKeep.AppendElement(animation);
|
||||
} else {
|
||||
mAnimations.RemoveEntry(animation);
|
||||
if (!animation->IsRelevant() && !animation->NeedsTicks()) {
|
||||
animationsToRemove.AppendElement(animation);
|
||||
}
|
||||
}
|
||||
|
||||
mAnimationOrder.SwapElements(animationsToKeep);
|
||||
for (Animation* animation : animationsToRemove) {
|
||||
RemoveAnimation(animation);
|
||||
}
|
||||
|
||||
if (!needsTicks) {
|
||||
// If another refresh driver observer destroys the nsPresContext,
|
||||
@ -155,7 +159,7 @@ DocumentTimeline::NotifyRefreshDriverCreated(nsRefreshDriver* aDriver)
|
||||
"Timeline should not be observing the refresh driver before"
|
||||
" it is created");
|
||||
|
||||
if (!mAnimationOrder.IsEmpty()) {
|
||||
if (!mAnimationOrder.isEmpty()) {
|
||||
aDriver->AddRefreshObserver(this, Flush_Style);
|
||||
mIsObservingRefreshDriver = true;
|
||||
}
|
||||
|
@ -10,8 +10,15 @@ function runTest()
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPrefEnv({'set': [ ["dom.archivereader.enabled", true] ]}, function() {
|
||||
testGenerator = testSteps();
|
||||
return testGenerator.next();
|
||||
SpecialPowers.createFiles(filesToCreate(),
|
||||
function (files) {
|
||||
testGenerator = testSteps(files);
|
||||
return testGenerator.next();
|
||||
},
|
||||
function (msg) {
|
||||
ok(false, "File creation error: " + msg);
|
||||
finishTest();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
[DEFAULT]
|
||||
skip-if = e10s
|
||||
support-files =
|
||||
helpers.js
|
||||
|
||||
|
@ -10,57 +10,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<script type="text/javascript;version=1.7">
|
||||
function createZipFileWithData(fileData) {
|
||||
var Cc = SpecialPowers.Cc;
|
||||
var Ci = SpecialPowers.Ci;
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
testFile.append("fileArchiveReader.zip");
|
||||
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
0666, 0);
|
||||
outStream.write(fileData, fileData.length);
|
||||
outStream.close();
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
|
||||
return fileList.files[0];
|
||||
}
|
||||
|
||||
function createTextFileWithData(fileData) {
|
||||
var Cc = SpecialPowers.Cc;
|
||||
var Ci = SpecialPowers.Ci;
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
testFile.append("fileArchiveReader.txt");
|
||||
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
0666, 0);
|
||||
outStream.write(fileData, fileData.length);
|
||||
outStream.close();
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
|
||||
return fileList.files[0];
|
||||
}
|
||||
|
||||
handleFinished = 0;
|
||||
function markTestDone() {
|
||||
++handleFinished;
|
||||
if (isFinished()) {
|
||||
finishTest();
|
||||
}
|
||||
}
|
||||
function isFinished() {
|
||||
return handleFinished == 6;
|
||||
}
|
||||
|
||||
function testSteps()
|
||||
{
|
||||
function filesToCreate() {
|
||||
var binaryString = '504B03040A00000000002E6BF14000000000000000000000000005001C00746573742F555409000337CA055039CA055075780B' +
|
||||
'000104E803000004E8030000504B03041400000008002D6BF1401780E15015000000580200000A001C00746573742F612E7478' +
|
||||
'74555409000336CA05503ACA055075780B000104E803000004E8030000CB48CDC9C95728CF2FCA49E1CA18658FB2A9C4060050' +
|
||||
@ -78,8 +28,25 @@
|
||||
binaryData += String.fromCharCode(parseInt(hex,16));
|
||||
}
|
||||
|
||||
var binaryFile = createZipFileWithData(binaryData);
|
||||
var textFile = createTextFileWithData("Hello World");
|
||||
return [ {name: "fileArchiveReader.zip", data: binaryData},
|
||||
{name: "fileArchiveReader.txt", data: "Hello World"}];
|
||||
}
|
||||
|
||||
handleFinished = 0;
|
||||
function markTestDone() {
|
||||
++handleFinished;
|
||||
if (isFinished()) {
|
||||
finishTest();
|
||||
}
|
||||
}
|
||||
function isFinished() {
|
||||
return handleFinished == 6;
|
||||
}
|
||||
|
||||
function testSteps(files)
|
||||
{
|
||||
var binaryFile = files[0];
|
||||
var textFile = files[1];
|
||||
|
||||
var status;
|
||||
|
||||
@ -254,7 +221,6 @@
|
||||
|
||||
<body onload="runTest();">
|
||||
<p id="display">
|
||||
<input id="fileList" type="file"></input>
|
||||
</p>
|
||||
</body>
|
||||
|
||||
|
@ -10,35 +10,17 @@
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<script type="text/javascript;version=1.7">
|
||||
function createNonUnicodeData() {
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
testFile.append("fileArchiveReader_nonUnicode.zip");
|
||||
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
0666, 0);
|
||||
|
||||
function filesToCreate() {
|
||||
var binaryData = "";
|
||||
for (var i = 0, len = binaryString.length / 2; i < len; ++i) {
|
||||
var hex = binaryString[i * 2] + binaryString[i * 2 + 1];
|
||||
binaryData += String.fromCharCode(parseInt(hex,16));
|
||||
}
|
||||
outStream.write(binaryData, binaryData.length);
|
||||
outStream.close();
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
|
||||
return fileList.files[0];
|
||||
return [ {name: "fileArchiveReader_nonUnicode.zip", data: binaryData} ];
|
||||
}
|
||||
|
||||
function test1()
|
||||
function test1(binaryFile)
|
||||
{
|
||||
var binaryFile = createNonUnicodeData();
|
||||
|
||||
var r = new ArchiveReader(binaryFile, { encoding: "ISO-8859-1" });
|
||||
isnot(r, null, "ArchiveReader cannot be null");
|
||||
|
||||
@ -51,14 +33,12 @@
|
||||
is(this.result.length, 1, "ArchiveReader.getFilenames(): the array contains 1 item");
|
||||
ok(this.reader, r, "ArchiveRequest.reader should be == ArchiveReader");
|
||||
dump('Content: ' + this.result[0] + '\n');
|
||||
test2();
|
||||
test2(binaryFile);
|
||||
}
|
||||
}
|
||||
|
||||
function test2()
|
||||
function test2(binaryFile)
|
||||
{
|
||||
var binaryFile = createNonUnicodeData();
|
||||
|
||||
try {
|
||||
new ArchiveReader(binaryFile, { encoding: "random stuff" });
|
||||
ok(false, "Should have thrown for bogus encoding label.");
|
||||
@ -68,9 +48,9 @@
|
||||
finishTest();
|
||||
}
|
||||
|
||||
function testSteps()
|
||||
function testSteps(files)
|
||||
{
|
||||
test1();
|
||||
test1(files[0]);
|
||||
yield undefined;
|
||||
}
|
||||
|
||||
@ -82,7 +62,6 @@
|
||||
|
||||
<body onload="runTest();">
|
||||
<p id="display">
|
||||
<input id="fileList" type="file"></input>
|
||||
</p>
|
||||
<script type="text/javascript;version=1.7">
|
||||
var binaryString = '' +
|
||||
|
@ -10,34 +10,18 @@
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<script type="text/javascript;version=1.7">
|
||||
function createZipInZipData() {
|
||||
var Cc = SpecialPowers.Cc;
|
||||
var Ci = SpecialPowers.Ci;
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
testFile.append("fileArchiveReader_42.zip");
|
||||
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
0666, 0);
|
||||
|
||||
function filesToCreate() {
|
||||
var binaryData = "";
|
||||
for (var i = 0, len = binaryString.length / 2; i < len; ++i) {
|
||||
var hex = binaryString[i * 2] + binaryString[i * 2 + 1];
|
||||
binaryData += String.fromCharCode(parseInt(hex,16));
|
||||
}
|
||||
outStream.write(binaryData, binaryData.length);
|
||||
outStream.close();
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
|
||||
return fileList.files[0];
|
||||
return [ {name: "fileArchiveReader_42.zip", data: binaryData} ];
|
||||
}
|
||||
|
||||
function testSteps()
|
||||
function testSteps(files)
|
||||
{
|
||||
var binaryFile = createZipInZipData();
|
||||
var binaryFile = files[0];
|
||||
|
||||
// The input is 4 nested zip archives:
|
||||
doLoop(binaryFile, 4);
|
||||
@ -96,7 +80,6 @@
|
||||
|
||||
<body onload="runTest();">
|
||||
<p id="display">
|
||||
<input id="fileList" type="file"></input>
|
||||
</p>
|
||||
<script type="text/javascript;version=1.7">
|
||||
var binaryString = '' +
|
||||
|
@ -130,6 +130,11 @@ AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType,
|
||||
mCallback = aCallback;
|
||||
}
|
||||
|
||||
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
|
||||
("AudioChannelAgent, InitInternal, this = %p, type = %d, "
|
||||
"owner = %p, hasCallback = %d\n", this, mAudioChannelType,
|
||||
mWindow.get(), (!!mCallback || !!mWeakCallback)));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -158,6 +163,10 @@ NS_IMETHODIMP AudioChannelAgent::NotifyStartedPlaying(uint32_t aNotifyPlayback,
|
||||
|
||||
service->GetState(mWindow, mAudioChannelType, aVolume, aMuted);
|
||||
|
||||
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
|
||||
("AudioChannelAgent, NotifyStartedPlaying, this = %p, mute = %d, "
|
||||
"volume = %f\n", this, *aMuted, *aVolume));
|
||||
|
||||
mNotifyPlayback = aNotifyPlayback;
|
||||
mIsRegToService = true;
|
||||
return NS_OK;
|
||||
@ -170,8 +179,14 @@ NS_IMETHODIMP AudioChannelAgent::NotifyStoppedPlaying()
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
|
||||
("AudioChannelAgent, NotifyStoppedPlaying, this = %p\n", this));
|
||||
|
||||
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
service->UnregisterAudioChannelAgent(this, mNotifyPlayback);
|
||||
if (service) {
|
||||
service->UnregisterAudioChannelAgent(this, mNotifyPlayback);
|
||||
}
|
||||
|
||||
mIsRegToService = false;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -198,7 +213,13 @@ AudioChannelAgent::WindowVolumeChanged()
|
||||
bool muted = false;
|
||||
|
||||
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
service->GetState(mWindow, mAudioChannelType, &volume, &muted);
|
||||
if (service) {
|
||||
service->GetState(mWindow, mAudioChannelType, &volume, &muted);
|
||||
}
|
||||
|
||||
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
|
||||
("AudioChannelAgent, WindowVolumeChanged, this = %p, mute = %d, "
|
||||
"volume = %f\n", this, muted, volume));
|
||||
|
||||
callback->WindowVolumeChanged(volume, muted);
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ namespace {
|
||||
|
||||
// If true, any new AudioChannelAgent will be muted when created.
|
||||
bool sAudioChannelMutedByDefault = false;
|
||||
bool sXPCOMShuttingDown = false;
|
||||
|
||||
class NotifyChannelActiveRunnable final : public nsRunnable
|
||||
{
|
||||
@ -78,6 +79,11 @@ public:
|
||||
mActive
|
||||
? MOZ_UTF16("active")
|
||||
: MOZ_UTF16("inactive"));
|
||||
|
||||
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
|
||||
("NotifyChannelActiveRunnable, type = %d, active = %d\n",
|
||||
mAudioChannel, mActive));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -173,12 +179,26 @@ AudioChannelService::CreateServiceIfNeeded()
|
||||
/* static */ already_AddRefed<AudioChannelService>
|
||||
AudioChannelService::GetOrCreate()
|
||||
{
|
||||
if (sXPCOMShuttingDown) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CreateServiceIfNeeded();
|
||||
RefPtr<AudioChannelService> service = gAudioChannelService.get();
|
||||
return service.forget();
|
||||
}
|
||||
|
||||
void
|
||||
/* static */ PRLogModuleInfo*
|
||||
AudioChannelService::GetAudioChannelLog()
|
||||
{
|
||||
static PRLogModuleInfo *gAudioChannelLog;
|
||||
if (!gAudioChannelLog) {
|
||||
gAudioChannelLog = PR_NewLogModule("AudioChannel");
|
||||
}
|
||||
return gAudioChannelLog;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
AudioChannelService::Shutdown()
|
||||
{
|
||||
if (gAudioChannelService) {
|
||||
@ -197,6 +217,12 @@ AudioChannelService::Shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
gAudioChannelService->mWindows.Clear();
|
||||
gAudioChannelService->mPlayingChildren.Clear();
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
gAudioChannelService->mSpeakerManager.Clear();
|
||||
#endif
|
||||
|
||||
gAudioChannelService = nullptr;
|
||||
}
|
||||
}
|
||||
@ -468,7 +494,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
const char16_t* aData)
|
||||
{
|
||||
if (!strcmp(aTopic, "xpcom-shutdown")) {
|
||||
mWindows.Clear();
|
||||
sXPCOMShuttingDown = true;
|
||||
Shutdown();
|
||||
} else if (!strcmp(aTopic, "outer-window-destroyed")) {
|
||||
nsCOMPtr<nsISupportsPRUint64> wrapper = do_QueryInterface(aSubject);
|
||||
@ -719,6 +745,10 @@ AudioChannelService::SetAudioChannelVolume(nsPIDOMWindow* aWindow,
|
||||
MOZ_ASSERT(aWindow);
|
||||
MOZ_ASSERT(aWindow->IsOuterWindow());
|
||||
|
||||
MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug,
|
||||
("AudioChannelService, SetAudioChannelVolume, window = %p, type = %d, "
|
||||
"volume = %d\n", aWindow, aAudioChannel, aVolume));
|
||||
|
||||
AudioChannelWindow* winData = GetOrCreateWindowData(aWindow);
|
||||
winData->mChannels[(uint32_t)aAudioChannel].mVolume = aVolume;
|
||||
RefreshAgentsVolume(aWindow);
|
||||
@ -773,6 +803,10 @@ AudioChannelService::SetAudioChannelMuted(nsPIDOMWindow* aWindow,
|
||||
MOZ_ASSERT(aWindow);
|
||||
MOZ_ASSERT(aWindow->IsOuterWindow());
|
||||
|
||||
MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug,
|
||||
("AudioChannelService, SetAudioChannelMuted, window = %p, type = %d, "
|
||||
"mute = %d\n", aWindow, aAudioChannel, aMuted));
|
||||
|
||||
if (aAudioChannel == AudioChannel::System) {
|
||||
// Workaround for bug1183033, system channel type can always playback.
|
||||
return;
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
class nsIRunnable;
|
||||
class nsPIDOMWindow;
|
||||
struct PRLogModuleInfo;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -45,6 +46,8 @@ public:
|
||||
|
||||
static bool IsAudioChannelMutedByDefault();
|
||||
|
||||
static PRLogModuleInfo* GetAudioChannelLog();
|
||||
|
||||
/**
|
||||
* Any audio channel agent that starts playing should register itself to
|
||||
* this service, sharing the AudioChannel.
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsStyledElement.h"
|
||||
#include "HTMLCanvasElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -112,6 +113,30 @@ AnonymousContent::RemoveAttributeForElement(const nsAString& aElementId,
|
||||
element->RemoveAttribute(aName, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<nsISupports>
|
||||
AnonymousContent::GetCanvasContext(const nsAString& aElementId,
|
||||
const nsAString& aContextId,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
Element* element = GetElementById(aElementId);
|
||||
|
||||
if (!element) {
|
||||
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!element->IsHTMLElement(nsGkAtoms::canvas)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> context;
|
||||
|
||||
HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(element);
|
||||
canvas->GetContext(aContextId, getter_AddRefs(context));
|
||||
|
||||
return context.forget();
|
||||
}
|
||||
|
||||
Element*
|
||||
AnonymousContent::GetElementById(const nsAString& aElementId)
|
||||
{
|
||||
|
@ -52,6 +52,10 @@ public:
|
||||
const nsAString& aName,
|
||||
ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<nsISupports> GetCanvasContext(const nsAString& aElementId,
|
||||
const nsAString& aContextId,
|
||||
ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
~AnonymousContent();
|
||||
Element* GetElementById(const nsAString& aElementId);
|
||||
|
@ -1760,6 +1760,23 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
}
|
||||
SetParentIsContent(false);
|
||||
}
|
||||
|
||||
// Ensure that CSS transitions don't continue on an element at a
|
||||
// different place in the tree (even if reinserted before next
|
||||
// animation refresh).
|
||||
// We need to delete the properties while we're still in document
|
||||
// (if we were in document).
|
||||
// FIXME (Bug 522599): Need a test for this.
|
||||
//XXXsmaug this looks slow.
|
||||
if (HasFlag(NODE_HAS_PROPERTIES)) {
|
||||
DeleteProperty(nsGkAtoms::transitionsOfBeforeProperty);
|
||||
DeleteProperty(nsGkAtoms::transitionsOfAfterProperty);
|
||||
DeleteProperty(nsGkAtoms::transitionsProperty);
|
||||
DeleteProperty(nsGkAtoms::animationsOfBeforeProperty);
|
||||
DeleteProperty(nsGkAtoms::animationsOfAfterProperty);
|
||||
DeleteProperty(nsGkAtoms::animationsProperty);
|
||||
}
|
||||
|
||||
ClearInDocument();
|
||||
|
||||
// Editable descendant count only counts descendants that
|
||||
@ -1794,19 +1811,6 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that CSS transitions don't continue on an element at a
|
||||
// different place in the tree (even if reinserted before next
|
||||
// animation refresh).
|
||||
// FIXME (Bug 522599): Need a test for this.
|
||||
if (HasFlag(NODE_HAS_PROPERTIES)) {
|
||||
DeleteProperty(nsGkAtoms::transitionsOfBeforeProperty);
|
||||
DeleteProperty(nsGkAtoms::transitionsOfAfterProperty);
|
||||
DeleteProperty(nsGkAtoms::transitionsProperty);
|
||||
DeleteProperty(nsGkAtoms::animationsOfBeforeProperty);
|
||||
DeleteProperty(nsGkAtoms::animationsOfAfterProperty);
|
||||
DeleteProperty(nsGkAtoms::animationsProperty);
|
||||
}
|
||||
|
||||
// Unset this since that's what the old code effectively did.
|
||||
UnsetFlags(NODE_FORCE_XBL_BINDINGS);
|
||||
bool clearBindingParent = true;
|
||||
|
@ -1051,7 +1051,7 @@ EventSource::DispatchCurrentMessageEvent()
|
||||
message->mLastEventID.Assign(mLastEventID);
|
||||
}
|
||||
|
||||
int32_t sizeBefore = mMessagesToDispatch.GetSize();
|
||||
size_t sizeBefore = mMessagesToDispatch.GetSize();
|
||||
mMessagesToDispatch.Push(message.forget());
|
||||
NS_ENSURE_TRUE(mMessagesToDispatch.GetSize() == sizeBefore + 1,
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
|
@ -2592,37 +2592,6 @@ Navigator::HasMobileIdSupport(JSContext* aCx, JSObject* aGlobal)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* static */
|
||||
bool
|
||||
Navigator::HasTVSupport(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
JS::Rooted<JSObject*> global(aCx, aGlobal);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(global);
|
||||
if (!win) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Just for testing, we can enable TV for any kind of app.
|
||||
if (Preferences::GetBool("dom.testing.tv_enabled_for_hosted_apps", false)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
nsIDocument* doc = win->GetExtantDoc();
|
||||
if (!doc || !doc->NodePrincipal()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIPrincipal* principal = doc->NodePrincipal();
|
||||
uint16_t status;
|
||||
if (NS_FAILED(principal->GetAppStatus(&status))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only support TV Manager API for certified apps for now.
|
||||
return status == nsIPrincipal::APP_STATUS_CERTIFIED;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
Navigator::HasPresentationSupport(JSContext* aCx, JSObject* aGlobal)
|
||||
|
@ -333,8 +333,6 @@ public:
|
||||
static bool HasMobileIdSupport(JSContext* aCx, JSObject* aGlobal);
|
||||
#endif
|
||||
|
||||
static bool HasTVSupport(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
static bool HasPresentationSupport(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
static bool IsE10sEnabled(JSContext* aCx, JSObject* aGlobal);
|
||||
|
@ -253,8 +253,9 @@ namespace {
|
||||
void SerializeString(const nsCString& aInput, nsAString& aValue)
|
||||
{
|
||||
const unsigned char* p = (const unsigned char*) aInput.get();
|
||||
const unsigned char* end = p + aInput.Length();
|
||||
|
||||
while (p && *p) {
|
||||
while (p != end) {
|
||||
// ' ' to '+'
|
||||
if (*p == 0x20) {
|
||||
aValue.Append(0x2B);
|
||||
@ -314,7 +315,7 @@ URLSearchParams::URLSearchParams(nsISupports* aParent,
|
||||
const URLSearchParams& aOther)
|
||||
: mParams(new URLParams(*aOther.mParams.get()))
|
||||
, mParent(aParent)
|
||||
, mObserver(aOther.mObserver)
|
||||
, mObserver(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -100,10 +100,6 @@
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "mozilla/dom/HTMLCollectionBinding.h"
|
||||
|
||||
#include "nsIDOMMozSmsMessage.h"
|
||||
#include "nsIDOMMozMmsMessage.h"
|
||||
#include "nsIDOMMozMobileMessageThread.h"
|
||||
|
||||
#ifdef MOZ_B2G_FM
|
||||
#include "FMRadio.h"
|
||||
#endif
|
||||
@ -243,15 +239,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSSupportsRule, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(MozSmsMessage, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(MozMmsMessage, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(MozMobileMessageThread, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
@ -651,18 +638,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSSupportsRule)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozSmsMessage, nsIDOMMozSmsMessage)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSmsMessage)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozMmsMessage, nsIDOMMozMmsMessage)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozMmsMessage)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozMobileMessageThread, nsIDOMMozMobileMessageThread)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozMobileMessageThread)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CSSFontFaceRule, nsIDOMCSSFontFaceRule)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFaceRule)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
@ -32,10 +32,6 @@ DOMCI_CLASS(XULTreeBuilder)
|
||||
DOMCI_CLASS(CSSMozDocumentRule)
|
||||
DOMCI_CLASS(CSSSupportsRule)
|
||||
|
||||
DOMCI_CLASS(MozSmsMessage)
|
||||
DOMCI_CLASS(MozMmsMessage)
|
||||
DOMCI_CLASS(MozMobileMessageThread)
|
||||
|
||||
// @font-face in CSS
|
||||
DOMCI_CLASS(CSSFontFaceRule)
|
||||
|
||||
|
@ -3703,7 +3703,9 @@ void
|
||||
nsPIDOMWindow::RefreshMediaElements()
|
||||
{
|
||||
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
service->RefreshAgentsVolume(GetOuterWindow());
|
||||
if (service) {
|
||||
service->RefreshAgentsVolume(GetOuterWindow());
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
@ -3721,7 +3723,9 @@ nsPIDOMWindow::SetAudioCapture(bool aCapture)
|
||||
mAudioCaptured = aCapture;
|
||||
|
||||
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
service->RefreshAgentsCapture(GetOuterWindow(), mWindowID);
|
||||
if (service) {
|
||||
service->RefreshAgentsCapture(GetOuterWindow(), mWindowID);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2809,11 +2809,15 @@ protected:
|
||||
// True iff we've ever fired a DOMTitleChanged event for this document
|
||||
bool mHaveFiredTitleChange : 1;
|
||||
|
||||
// True iff IsShowing() should be returning true
|
||||
// State for IsShowing(). mIsShowing starts off false. It becomes true when
|
||||
// OnPageShow happens and becomes false when OnPageHide happens. So it's false
|
||||
// before the initial load completes and when we're in bfcache or unloaded,
|
||||
// true otherwise.
|
||||
bool mIsShowing : 1;
|
||||
|
||||
// True iff the document "page" is not hidden (i.e. currently in the
|
||||
// bfcache)
|
||||
// State for IsVisible(). mVisible starts off true. It becomes false when
|
||||
// OnPageHide happens, and becomes true again when OnPageShow happens. So
|
||||
// it's false only when we're in bfcache or unloaded.
|
||||
bool mVisible : 1;
|
||||
|
||||
// True if our content viewer has been removed from the docshell
|
||||
|
@ -259,6 +259,8 @@ support-files =
|
||||
|
||||
[test_anonymousContent_api.html]
|
||||
[test_anonymousContent_append_after_reflow.html]
|
||||
[test_anonymousContent_canvas.html]
|
||||
skip-if = buildapp == 'b2g' # Requires webgl support
|
||||
[test_anonymousContent_insert.html]
|
||||
[test_anonymousContent_manipulate_content.html]
|
||||
[test_anonymousContent_style_csp.html]
|
||||
@ -372,7 +374,6 @@ skip-if = toolkit != 'gonk'
|
||||
[test_XHRDocURI.html]
|
||||
[test_XHRResponseURL.html]
|
||||
[test_XHRSendData.html]
|
||||
skip-if = buildapp == 'b2g' || e10s # b2g(seems to stall) b2g-debug(seems to stall) b2g-desktop(seems to stall) e10s(Bug 1220304 - Creates a file)
|
||||
[test_XHR_anon.html]
|
||||
[test_XHR_header.html]
|
||||
[test_XHR_onuploadprogress.html]
|
||||
@ -794,7 +795,7 @@ skip-if = toolkit == 'android' || e10s #RANDOM
|
||||
[test_w3element_traversal.xhtml]
|
||||
[test_w3element_traversal_svg.html]
|
||||
[test_websocket.html]
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android' # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
|
||||
[test_websocket_basic.html]
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android'
|
||||
[test_websocket_hello.html]
|
||||
|
@ -5,27 +5,48 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=464848
|
||||
-->
|
||||
<head>
|
||||
<title>XMLHttpRequest send data and headers</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="gen.next();">
|
||||
<body onload="createFiles();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=464848">Mozilla Bug 464848</a>
|
||||
<p id="display">
|
||||
<input id="fileList" type="file"></input>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="application/javascript;version=1.8">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testData = "blahblahblahblahblahblahblaaaaaaaah. blah.";
|
||||
var extensions = [".txt",".png",".jpg",".gif",".xml", "noext"];
|
||||
var fileTypes = ["text/plain", "image/png", "image/jpeg", "image/gif", "text/xml", null];
|
||||
var gen = runTests();
|
||||
var testDOMFiles;
|
||||
|
||||
function createFiles() {
|
||||
var filesToCreate = new Array();
|
||||
extensions.forEach(function (extension) {
|
||||
filesToCreate.push({name: "testfile" + extension, data: testData});
|
||||
});
|
||||
SpecialPowers.createFiles(filesToCreate,
|
||||
function (files) {
|
||||
testDOMFiles = files;
|
||||
gen.next();
|
||||
},
|
||||
function (msg) {
|
||||
testDOMFiles = new Array;
|
||||
ok(false, "File creation error: " + msg);
|
||||
gen.next();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function continueTest() { gen.next(); }
|
||||
|
||||
function runTests() {
|
||||
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "file_XHRSendData_doc.xml", false);
|
||||
xhr.send();
|
||||
@ -38,12 +59,6 @@ testDoc2.appendChild(testDoc2.createElement("res"));
|
||||
testDoc2.documentElement.appendChild(testDoc2.createTextNode("text"));
|
||||
is(testDoc2.inputEncoding, "UTF-8", "wrong encoding");
|
||||
|
||||
var testData = "blahblahblahblahblahblahblaaaaaaaah. blah.";
|
||||
var extensions = [".txt",".png",".jpg",".gif",".xml", "noext"];
|
||||
var fileTypes = ["text/plain", "image/png", "image/jpeg", "image/gif", "text/xml", null];
|
||||
var testFiles = new Array;
|
||||
var testDOMFiles = new Array;
|
||||
|
||||
// arraybuffer test objects
|
||||
var shortArray = new ArrayBuffer(1);
|
||||
var shortInt8View = new Uint8Array(shortArray);
|
||||
@ -64,28 +79,6 @@ var longInt16View2 = new Uint16Array(longArray, 256, 64)
|
||||
var longInt8View1 = new Int8Array(longArraySlice)
|
||||
var longInt8View2 = new Int8Array(longArray, 256, 128)
|
||||
|
||||
extensions.forEach(
|
||||
function (extension) {
|
||||
var testFile = createFileWithDataExt(testData, extension);
|
||||
testFiles.push(testFile);
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
testDOMFiles.push(fileList.files[0]);
|
||||
}
|
||||
);
|
||||
|
||||
function createFileWithDataExt(fileData, extension) {
|
||||
var testFile = SpecialPowers.Services.dirsvc.get("ProfD", SpecialPowers.Ci.nsIFile);
|
||||
testFile.append("testfile" + extension);
|
||||
var outStream = SpecialPowers.Cc["@mozilla.org/network/file-output-stream;1"].createInstance(SpecialPowers.Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, 0666, 0);
|
||||
outStream.write(fileData, fileData.length);
|
||||
outStream.close();
|
||||
|
||||
return testFile;
|
||||
}
|
||||
|
||||
tests = [{ body: null,
|
||||
resBody: "",
|
||||
},
|
||||
@ -253,19 +246,7 @@ try {
|
||||
"Wrong page for redirect");
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
cleanUpData();
|
||||
}
|
||||
|
||||
function cleanUpData() {
|
||||
testFiles.forEach(
|
||||
function (testFile) {
|
||||
try {
|
||||
testFile.remove(false);
|
||||
} catch (e) {}
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
function is_identical_arraybuffer(ab1, ab2) {
|
||||
|
@ -45,7 +45,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1020244
|
||||
|
||||
let members = ["getTextContentForElement", "setTextContentForElement",
|
||||
"getAttributeForElement", "setAttributeForElement",
|
||||
"removeAttributeForElement"];
|
||||
"removeAttributeForElement", "getCanvasContext"];
|
||||
for (let member of members) {
|
||||
ok(member in anonymousContent, "AnonymousContent object defines " + member);
|
||||
}
|
||||
|
57
dom/base/test/test_anonymousContent_canvas.html
Normal file
57
dom/base/test/test_anonymousContent_canvas.html
Normal file
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1212477
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1212477 - Needs a way to access to <canvas>'s context (2d, webgl) from Anonymous Content API</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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=1212477">Mozilla Bug 1212477</a>
|
||||
<div>
|
||||
<div id="id" class="test">text content</div>
|
||||
<canvas id="canvas2d"></canvas>
|
||||
<canvas id="canvas-webgl"></canvas>
|
||||
<canvas id="canvas-foo"></canvas>
|
||||
</div>
|
||||
<script type="application/javascript;version=1.8">
|
||||
let chromeDocument = SpecialPowers.wrap(document);
|
||||
let testElement = document.querySelector("div");
|
||||
|
||||
let anonymousContent = chromeDocument.insertAnonymousContent(testElement);
|
||||
|
||||
is(anonymousContent.getCanvasContext("id", "2d"), null,
|
||||
"Context is null for non-canvas elements");
|
||||
|
||||
let context2d = anonymousContent.getCanvasContext("canvas2d", "2d");
|
||||
|
||||
is(context2d.toString(), "[object CanvasRenderingContext2D]",
|
||||
"2D Context is returned properly");
|
||||
|
||||
is(context2d.canvas, null,
|
||||
"context's canvas property is null in anonymous content");
|
||||
|
||||
is (anonymousContent.getCanvasContext("canvas-foo", "foo"), null,
|
||||
"Context is null for unknown context type");
|
||||
|
||||
SimpleTest.doesThrow(
|
||||
() => anonymousContent.getCanvasContext("foo", "2d"),
|
||||
"NS_ERROR_NOT_AVAILABLE",
|
||||
"Get a context using unexisting id should throw"
|
||||
);
|
||||
|
||||
let webgl = anonymousContent.getCanvasContext("canvas-webgl", "webgl");
|
||||
|
||||
is(webgl.toString(), "[object WebGLRenderingContext]",
|
||||
"WebGL Context is returned properly");
|
||||
|
||||
is(webgl.canvas, null,
|
||||
"WebGL context's canvas property is null in anonymous content");
|
||||
|
||||
chromeDocument.removeAnonymousContent(anonymousContent);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -289,6 +289,31 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
runTest();
|
||||
}
|
||||
|
||||
function testZeroHandling() {
|
||||
var u = new URLSearchParams;
|
||||
u.set("a", "b\0c");
|
||||
u.set("d\0e", "f");
|
||||
u.set("g\0h", "i\0j");
|
||||
is(u.toString(), "a=b%00c&d%00e=f&g%00h=i%00j",
|
||||
"Should encode U+0000 as %00");
|
||||
|
||||
runTest();
|
||||
}
|
||||
|
||||
function testCopyConstructor() {
|
||||
var url = new URL("http://example.com/");
|
||||
var p = url.searchParams;
|
||||
var q = new URLSearchParams(p);
|
||||
q.set("a", "b");
|
||||
is(url.href, "http://example.com/",
|
||||
"Messing with copy of URLSearchParams should not affect URL");
|
||||
p.set("c", "d");
|
||||
is(url.href, "http://example.com/?c=d",
|
||||
"Messing with URLSearchParams should affect URL");
|
||||
|
||||
runTest();
|
||||
}
|
||||
|
||||
var tests = [
|
||||
testSimpleURLSearchParams,
|
||||
testCopyURLSearchParams,
|
||||
@ -301,7 +326,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
testDelete,
|
||||
testGetNULL,
|
||||
testSet,
|
||||
testIterable
|
||||
testIterable,
|
||||
testZeroHandling,
|
||||
testCopyConstructor,
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
|
@ -9,7 +9,6 @@
|
||||
<body onload="testWebSocket()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=472529">Mozilla Bug </a>
|
||||
<p id="display">
|
||||
<input id="fileList" type="file"></input>
|
||||
</p>
|
||||
<div id="content">
|
||||
</div>
|
||||
@ -66,8 +65,8 @@
|
||||
* 41. HSTS
|
||||
* 42. non-char utf-8 sequences
|
||||
* 43. Test setting binaryType attribute
|
||||
* 44. Test sending/receving binary ArrayBuffer
|
||||
* 45. Test sending/receving binary Blob
|
||||
* 44. Test sending/receving binary ArrayBuffer
|
||||
* 45. Test sending/receving binary Blob
|
||||
* 46. Test that we don't dispatch incoming msgs once in CLOSING state
|
||||
* 47. Make sure onerror/onclose aren't called during close()
|
||||
*/
|
||||
@ -77,13 +76,13 @@ var last_test = 47;
|
||||
|
||||
|
||||
// Set this to >1 if you want to run the suite multiple times to probe for
|
||||
// random orange failures.
|
||||
// random orange failures.
|
||||
// - Do NOT check into mozilla-central with a value != 1.
|
||||
// - Too large a count will wind up causing tryserver to timeout the test (which
|
||||
// is ok, but means all testruns will be orange). If I set first_test to >22
|
||||
// (i.e don't run any of the tests that require waiting) I can get ~250-300
|
||||
// iterations of the remaining tests w/o a timeout.
|
||||
var testsuite_iterations = 1;
|
||||
var testsuite_iterations = 1;
|
||||
|
||||
|
||||
var current_test = first_test;
|
||||
@ -113,7 +112,7 @@ function shouldNotReceiveCloseEvent(e)
|
||||
extendedErrorInfo += (i + ": " + e[i] + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FIXME: see bug 578276. This should be a test failure, but it's too flaky on the tbox.
|
||||
ok(true, "onclose shouldn't be called on test " + ws._testNumber + "!" + extendedErrorInfo);
|
||||
}
|
||||
@ -191,7 +190,7 @@ function doTest(number)
|
||||
}
|
||||
|
||||
if (testsuite_iteration > 1) {
|
||||
$("feedback").innerHTML = "test suite iteration #" + testsuite_iteration + " of " + testsuite_iterations +
|
||||
$("feedback").innerHTML = "test suite iteration #" + testsuite_iteration + " of " + testsuite_iterations +
|
||||
": executing test: " + number + " of " + last_test + " tests.";
|
||||
} else {
|
||||
$("feedback").innerHTML = "executing test: " + number + " of " + last_test + " tests.";
|
||||
@ -390,7 +389,7 @@ function test8()
|
||||
{
|
||||
shouldCloseCleanly(e);
|
||||
// We called close() with no close code: so pywebsocket will also send no
|
||||
// close code, which translates to code 1005
|
||||
// close code, which translates to code 1005
|
||||
ok(e.code == 1005, "test-8 close code has wrong value:" + e.code);
|
||||
ok(e.reason == "", "test-8 close reason has wrong value:" + e.reason);
|
||||
doTest(9);
|
||||
@ -419,7 +418,7 @@ function test9()
|
||||
};
|
||||
|
||||
ws.close();
|
||||
|
||||
|
||||
// the server injects a delay, so proceed with this in the background
|
||||
doTest(10);
|
||||
}
|
||||
@ -520,7 +519,7 @@ function test12()
|
||||
|
||||
function test13()
|
||||
{
|
||||
// previous versions of this test counted the number of protocol errors returned, but the
|
||||
// previous versions of this test counted the number of protocol errors returned, but the
|
||||
// protocol stack typically closes down after reporting a protocol level error - trying
|
||||
// to resync is too dangerous
|
||||
|
||||
@ -1110,7 +1109,7 @@ function test37()
|
||||
{
|
||||
ok(e.code != 3101, "test 37c custom server code not present");
|
||||
ok(e.reason == "", "test 37c custom server reason not present");
|
||||
doTest(38);
|
||||
doTest(38);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1152,7 +1151,7 @@ function test39()
|
||||
ws.onclose = function(e)
|
||||
{
|
||||
ok(true, "test 39 close");
|
||||
ok(status_test39 == "opened", "test 39 did open");
|
||||
ok(status_test39 == "opened", "test 39 did open");
|
||||
doTest(40);
|
||||
};
|
||||
}
|
||||
@ -1176,7 +1175,7 @@ function test40()
|
||||
ws.onclose = function(e)
|
||||
{
|
||||
ok(true, "test 40 close");
|
||||
ok(status_test40 == "started", "test 40 did not open");
|
||||
ok(status_test40 == "started", "test 40 did not open");
|
||||
doTest(41);
|
||||
};
|
||||
}
|
||||
@ -1211,7 +1210,7 @@ function test41()
|
||||
|
||||
// try ws:// again, it should be done over wss:// now due to hsts
|
||||
var wsc = CreateTestWS("ws://example.com/tests/dom/base/test/file_websocket", "test-41c");
|
||||
|
||||
|
||||
wsc.onopen = function(e)
|
||||
{
|
||||
ok(true, "test 41c open");
|
||||
@ -1328,35 +1327,21 @@ function test44()
|
||||
{
|
||||
ok(ws.readyState == 3, "onclose bad readyState in test-44!");
|
||||
shouldCloseCleanly(e);
|
||||
doTest(45);
|
||||
SpecialPowers.createFiles([{name: "testBlobFile", data: "flob"}], function (files) {
|
||||
blobFile = files[0];
|
||||
doTest(45);
|
||||
},
|
||||
function (msg) {
|
||||
testFailed("Failed to create file for test45: " + msg);
|
||||
doTest(46);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function createDOMFile(fileName, fileData)
|
||||
{
|
||||
// create File in profile dir
|
||||
var dirSvc = SpecialPowers.Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", SpecialPowers.Ci.nsIFile);
|
||||
testFile.append(fileName);
|
||||
var outStream = SpecialPowers.Cc["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(SpecialPowers.Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, 0666, 0);
|
||||
outStream.write(fileData, fileData.length);
|
||||
outStream.close();
|
||||
|
||||
// Set filename into DOM <input> field, as if selected by user
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
|
||||
// return JS File object, aka Blob
|
||||
return fileList.files[0];
|
||||
}
|
||||
var blobFile;
|
||||
|
||||
function test45()
|
||||
{
|
||||
var blobFile = createDOMFile("testBlobFile", "flob");
|
||||
|
||||
var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-45");
|
||||
ok(ws.readyState == 0, "bad readyState in test-45!");
|
||||
|
||||
@ -1387,7 +1372,7 @@ function test45()
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(event)
|
||||
{
|
||||
ok(reader.result == "flob", "response should be 'flob': got '"
|
||||
ok(reader.result == "flob", "response should be 'flob': got '"
|
||||
+ reader.result + "'");
|
||||
};
|
||||
reader.onerror = function(event)
|
||||
@ -1433,7 +1418,7 @@ function test47()
|
||||
|
||||
ws.onerror = function (e)
|
||||
{
|
||||
ok(ws.readyState == 3, "test-47: readyState should be CLOSED(3) in onerror: got "
|
||||
ok(ws.readyState == 3, "test-47: readyState should be CLOSED(3) in onerror: got "
|
||||
+ ws.readyState);
|
||||
ok(!ws._withinClose, "onerror() called during close()!");
|
||||
hasError = true;
|
||||
@ -1443,7 +1428,7 @@ function test47()
|
||||
{
|
||||
shouldCloseNotCleanly(e);
|
||||
ok(hasError, "test-47: should have called onerror before onclose");
|
||||
ok(ws.readyState == 3, "test-47: readyState should be CLOSED(3) in onclose: got "
|
||||
ok(ws.readyState == 3, "test-47: readyState should be CLOSED(3) in onclose: got "
|
||||
+ ws.readyState);
|
||||
ok(!ws._withinClose, "onclose() called during close()!");
|
||||
ok(e.code == 1006, "test-47 close code should be 1006 but is:" + e.code);
|
||||
|
@ -10,4 +10,4 @@ skip-if = buildapp == 'b2g' || toolkit == 'android'
|
||||
[test_send-arraybuffer.html]
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android'
|
||||
[test_send-blob.html]
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android'
|
||||
|
@ -7,7 +7,6 @@
|
||||
<body>
|
||||
|
||||
<p id="display">
|
||||
<input id="fileList" type="file"></input>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
@ -20,74 +19,51 @@ function startsWith(target, prefix)
|
||||
return target.indexOf(prefix) === 0;
|
||||
}
|
||||
|
||||
function createDOMFile(fileName, fileData)
|
||||
{
|
||||
// create File in profile dir
|
||||
var dirSvc = SpecialPowers.Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", SpecialPowers.Ci.nsIFile);
|
||||
testFile.append(fileName);
|
||||
var outStream = SpecialPowers.Cc["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(SpecialPowers.Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, 0666, 0);
|
||||
if (fileData) {
|
||||
outStream.write(fileData, fileData.length);
|
||||
outStream.close();
|
||||
}
|
||||
|
||||
// Set filename into DOM <input> field, as if selected by user
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
|
||||
// return JS File object, aka Blob
|
||||
return fileList.files[0];
|
||||
}
|
||||
|
||||
|
||||
function createBlobContainingHelloWorld()
|
||||
{
|
||||
return createDOMFile("hellofile", "Hello, world!");
|
||||
}
|
||||
|
||||
function createEmptyBlob()
|
||||
{
|
||||
return createDOMFile("emptyfile");
|
||||
}
|
||||
|
||||
function createBlobContainingAllDistinctBytes()
|
||||
function distinctBytes()
|
||||
{
|
||||
var array = new Array();
|
||||
for (var i = 0; i < 256; ++i)
|
||||
array[i] = i;
|
||||
// Concatenates chars into a single binary string
|
||||
binaryString = String.fromCharCode.apply(null, array);
|
||||
return createDOMFile("allchars", binaryString);
|
||||
// Concatenates chars into a single binary string
|
||||
return String.fromCharCode.apply(null, array);
|
||||
}
|
||||
|
||||
var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/websocket_hybi/file_check-binary-messages");
|
||||
var closeEvent;
|
||||
var filesToCreate = [
|
||||
{name: "hellofile", data: "Hello, world!"},
|
||||
{name: "emptyfile"},
|
||||
{name: "allchars", data: distinctBytes()},
|
||||
];
|
||||
|
||||
ws.onopen = function()
|
||||
{
|
||||
ws.send(createBlobContainingHelloWorld());
|
||||
ws.send(createEmptyBlob());
|
||||
ws.send(createBlobContainingAllDistinctBytes());
|
||||
};
|
||||
SpecialPowers.createFiles(filesToCreate, function (files) {
|
||||
var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/websocket_hybi/file_check-binary-messages");
|
||||
var closeEvent;
|
||||
|
||||
ws.onmessage = function(event)
|
||||
{
|
||||
var message = event.data;
|
||||
if (startsWith(message, "PASS"))
|
||||
ok(true, message);
|
||||
else
|
||||
ok(false, message);
|
||||
};
|
||||
ws.onopen = function()
|
||||
{
|
||||
ws.send(files[0]);
|
||||
ws.send(files[1]);
|
||||
ws.send(files[2]);
|
||||
};
|
||||
|
||||
ws.onclose = function(event)
|
||||
{
|
||||
ws.onmessage = function(event)
|
||||
{
|
||||
var message = event.data;
|
||||
if (startsWith(message, "PASS"))
|
||||
ok(true, message);
|
||||
else
|
||||
ok(false, message);
|
||||
};
|
||||
|
||||
ws.onclose = function(event)
|
||||
{
|
||||
ok(event.wasClean, "should have closed cleanly");
|
||||
SimpleTest.finish();
|
||||
};
|
||||
};
|
||||
},
|
||||
function (msg) {
|
||||
ok(false, "Failed to create files: " + msg);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -1977,12 +1977,10 @@ addExternalIface('imgIRequest', nativeType='imgIRequest', notflattened=True)
|
||||
addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
|
||||
addExternalIface('MozControllers', nativeType='nsIControllers')
|
||||
addExternalIface('MozFrameLoader', nativeType='nsIFrameLoader', notflattened=True)
|
||||
addExternalIface('MozMmsMessage')
|
||||
addExternalIface('MozObserver', nativeType='nsIObserver', notflattened=True)
|
||||
addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource',
|
||||
notflattened=True)
|
||||
addExternalIface('MozRDFResource', nativeType='nsIRDFResource', notflattened=True)
|
||||
addExternalIface('MozSmsMessage')
|
||||
addExternalIface('MozTreeView', nativeType='nsITreeView',
|
||||
headerFile='nsITreeView.h', notflattened=True)
|
||||
addExternalIface('MozWakeLockListener', headerFile='nsIDOMWakeLockListener.h')
|
||||
|
@ -83,3 +83,5 @@ MSG_DEF(MSG_NOTIFICATION_PERMISSION_DENIED, 0, JSEXN_TYPEERR, "Permission to sho
|
||||
MSG_DEF(MSG_NOTIFICATION_NO_CONSTRUCTOR_IN_SERVICEWORKER, 0, JSEXN_TYPEERR, "Notification constructor cannot be used in ServiceWorkerGlobalScope. Use registration.showNotification() instead.")
|
||||
MSG_DEF(MSG_INVALID_SCOPE, 2, JSEXN_TYPEERR, "Invalid scope trying to resolve {0} with base URL {1}.")
|
||||
MSG_DEF(MSG_INVALID_KEYFRAME_OFFSETS, 0, JSEXN_TYPEERR, "Keyframes with specified offsets must be in order and all be in the range [0, 1].")
|
||||
MSG_DEF(MSG_SW_INSTALL_ERROR, 2, JSEXN_TYPEERR, "ServiceWorker script at {0} for scope {1} encountered an error during installation.")
|
||||
MSG_DEF(MSG_SW_SCRIPT_THREW, 2, JSEXN_TYPEERR, "ServiceWorker script at {0} for scope {1} threw an exception during script evaluation.")
|
||||
|
@ -70,32 +70,6 @@ USING_BLUETOOTH_NAMESPACE
|
||||
static BluetoothInterface* sBtInterface;
|
||||
static nsTArray<RefPtr<BluetoothProfileController> > sControllerArray;
|
||||
|
||||
/*
|
||||
* Static methods
|
||||
*/
|
||||
|
||||
ControlPlayStatus
|
||||
BluetoothServiceBluedroid::PlayStatusStringToControlPlayStatus(
|
||||
const nsAString& aPlayStatus)
|
||||
{
|
||||
ControlPlayStatus playStatus = ControlPlayStatus::PLAYSTATUS_UNKNOWN;
|
||||
if (aPlayStatus.EqualsLiteral("STOPPED")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_STOPPED;
|
||||
} else if (aPlayStatus.EqualsLiteral("PLAYING")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_PLAYING;
|
||||
} else if (aPlayStatus.EqualsLiteral("PAUSED")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_PAUSED;
|
||||
} else if (aPlayStatus.EqualsLiteral("FWD_SEEK")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_FWD_SEEK;
|
||||
} else if (aPlayStatus.EqualsLiteral("REV_SEEK")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_REV_SEEK;
|
||||
} else if (aPlayStatus.EqualsLiteral("ERROR")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_ERROR;
|
||||
}
|
||||
|
||||
return playStatus;
|
||||
}
|
||||
|
||||
class BluetoothServiceBluedroid::EnableResultHandler final
|
||||
: public BluetoothResultHandler
|
||||
{
|
||||
@ -352,7 +326,7 @@ BluetoothServiceBluedroid::StopInternal(BluetoothReplyRunnable* aRunnable)
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::StartLeScanInternal(
|
||||
const nsTArray<nsString>& aServiceUuids,
|
||||
const nsTArray<BluetoothUuid>& aServiceUuids,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -361,18 +335,12 @@ BluetoothServiceBluedroid::StartLeScanInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
nsTArray<BluetoothUuid> serviceUuids(aServiceUuids.Length());
|
||||
|
||||
for (auto i = 0ul; i < aServiceUuids.Length(); ++i) {
|
||||
StringToUuid(aServiceUuids[i], serviceUuids[i]);
|
||||
}
|
||||
|
||||
gatt->StartLeScan(serviceUuids, aRunnable);
|
||||
gatt->StartLeScan(aServiceUuids, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::StopLeScanInternal(
|
||||
const nsAString& aScanUuid,
|
||||
const BluetoothUuid& aScanUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -381,15 +349,12 @@ BluetoothServiceBluedroid::StopLeScanInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid scanUuid;
|
||||
StringToUuid(aScanUuid, scanUuid);
|
||||
|
||||
gatt->StopLeScan(scanUuid, aRunnable);
|
||||
gatt->StopLeScan(aScanUuid, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::ConnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -399,21 +364,12 @@ BluetoothServiceBluedroid::ConnectGattClientInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->Connect(appUuid, deviceAddress, aRunnable);
|
||||
gatt->Connect(aAppUuid, aDeviceAddress, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::DisconnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -423,21 +379,12 @@ BluetoothServiceBluedroid::DisconnectGattClientInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->Disconnect(appUuid, deviceAddress, aRunnable);
|
||||
gatt->Disconnect(aAppUuid, aDeviceAddress, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::DiscoverGattServicesInternal(
|
||||
const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothUuid& aAppUuid, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -446,15 +393,12 @@ BluetoothServiceBluedroid::DiscoverGattServicesInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->Discover(appUuid, aRunnable);
|
||||
gatt->Discover(aAppUuid, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattClientStartNotificationsInternal(
|
||||
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -464,15 +408,12 @@ BluetoothServiceBluedroid::GattClientStartNotificationsInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->RegisterNotifications(appUuid, aServId, aCharId, aRunnable);
|
||||
gatt->RegisterNotifications(aAppUuid, aServId, aCharId, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattClientStopNotificationsInternal(
|
||||
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -482,10 +423,7 @@ BluetoothServiceBluedroid::GattClientStopNotificationsInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->DeregisterNotifications(appUuid, aServId, aCharId, aRunnable);
|
||||
gatt->DeregisterNotifications(aAppUuid, aServId, aCharId, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
@ -504,7 +442,7 @@ BluetoothServiceBluedroid::UnregisterGattClientInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattClientReadRemoteRssiInternal(
|
||||
int aClientIf, const nsAString& aDeviceAddress,
|
||||
int aClientIf, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -514,18 +452,12 @@ BluetoothServiceBluedroid::GattClientReadRemoteRssiInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->ReadRemoteRssi(aClientIf, deviceAddress, aRunnable);
|
||||
gatt->ReadRemoteRssi(aClientIf, aDeviceAddress, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattClientReadCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
@ -537,16 +469,13 @@ BluetoothServiceBluedroid::GattClientReadCharacteristicValueInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->ReadCharacteristicValue(appUuid, aServiceId, aCharacteristicId,
|
||||
gatt->ReadCharacteristicValue(aAppUuid, aServiceId, aCharacteristicId,
|
||||
aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattClientWriteCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattWriteType& aWriteType,
|
||||
@ -560,16 +489,13 @@ BluetoothServiceBluedroid::GattClientWriteCharacteristicValueInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->WriteCharacteristicValue(appUuid, aServiceId, aCharacteristicId,
|
||||
gatt->WriteCharacteristicValue(aAppUuid, aServiceId, aCharacteristicId,
|
||||
aWriteType, aValue, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattClientReadDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -582,16 +508,13 @@ BluetoothServiceBluedroid::GattClientReadDescriptorValueInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->ReadDescriptorValue(appUuid, aServiceId, aCharacteristicId,
|
||||
gatt->ReadDescriptorValue(aAppUuid, aServiceId, aCharacteristicId,
|
||||
aDescriptorId, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattClientWriteDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -605,17 +528,14 @@ BluetoothServiceBluedroid::GattClientWriteDescriptorValueInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->WriteDescriptorValue(appUuid, aServiceId, aCharacteristicId,
|
||||
gatt->WriteDescriptorValue(aAppUuid, aServiceId, aCharacteristicId,
|
||||
aDescriptorId, aValue, aRunnable);
|
||||
}
|
||||
|
||||
// GATT Server
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid, const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -625,21 +545,12 @@ BluetoothServiceBluedroid::GattServerConnectPeripheralInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
BluetoothAddress address;
|
||||
if (NS_FAILED(StringToAddress(aAddress, address))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->ConnectPeripheral(appUuid, address, aRunnable);
|
||||
gatt->ConnectPeripheral(aAppUuid, aAddress, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid, const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -649,16 +560,7 @@ BluetoothServiceBluedroid::GattServerDisconnectPeripheralInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
BluetoothAddress address;
|
||||
if (NS_FAILED(StringToAddress(aAddress, address))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->DisconnectPeripheral(appUuid, address, aRunnable);
|
||||
gatt->DisconnectPeripheral(aAppUuid, aAddress, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
@ -677,7 +579,7 @@ BluetoothServiceBluedroid::UnregisterGattServerInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerAddServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
uint16_t aHandleCount,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
@ -689,15 +591,12 @@ BluetoothServiceBluedroid::GattServerAddServiceInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->ServerAddService(appUuid, aServiceId, aHandleCount, aRunnable);
|
||||
gatt->ServerAddService(aAppUuid, aServiceId, aHandleCount, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerAddIncludedServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aIncludedServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
@ -709,10 +608,7 @@ BluetoothServiceBluedroid::GattServerAddIncludedServiceInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->ServerAddIncludedService(appUuid,
|
||||
gatt->ServerAddIncludedService(aAppUuid,
|
||||
aServiceHandle,
|
||||
aIncludedServiceHandle,
|
||||
aRunnable);
|
||||
@ -720,7 +616,7 @@ BluetoothServiceBluedroid::GattServerAddIncludedServiceInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerAddCharacteristicInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothUuid& aCharacteristicUuid,
|
||||
BluetoothGattAttrPerm aPermissions,
|
||||
@ -734,10 +630,7 @@ BluetoothServiceBluedroid::GattServerAddCharacteristicInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->ServerAddCharacteristic(appUuid,
|
||||
gatt->ServerAddCharacteristic(aAppUuid,
|
||||
aServiceHandle,
|
||||
aCharacteristicUuid,
|
||||
aPermissions,
|
||||
@ -747,7 +640,7 @@ BluetoothServiceBluedroid::GattServerAddCharacteristicInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerAddDescriptorInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
const BluetoothUuid& aDescriptorUuid,
|
||||
@ -761,10 +654,7 @@ BluetoothServiceBluedroid::GattServerAddDescriptorInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->ServerAddDescriptor(appUuid,
|
||||
gatt->ServerAddDescriptor(aAppUuid,
|
||||
aServiceHandle,
|
||||
aCharacteristicHandle,
|
||||
aDescriptorUuid,
|
||||
@ -774,7 +664,7 @@ BluetoothServiceBluedroid::GattServerAddDescriptorInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerRemoveServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
@ -785,15 +675,12 @@ BluetoothServiceBluedroid::GattServerRemoveServiceInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->ServerRemoveService(appUuid, aServiceHandle, aRunnable);
|
||||
gatt->ServerRemoveService(aAppUuid, aServiceHandle, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerStartServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
@ -804,15 +691,12 @@ BluetoothServiceBluedroid::GattServerStartServiceInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->ServerStartService(appUuid, aServiceHandle, aRunnable);
|
||||
gatt->ServerStartService(aAppUuid, aServiceHandle, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerStopServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
@ -823,16 +707,13 @@ BluetoothServiceBluedroid::GattServerStopServiceInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->ServerStopService(appUuid, aServiceHandle, aRunnable);
|
||||
gatt->ServerStopService(aAppUuid, aServiceHandle, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
@ -845,23 +726,14 @@ BluetoothServiceBluedroid::GattServerSendResponseInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
BluetoothAddress address;
|
||||
if (NS_FAILED(StringToAddress(aAddress, address))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->ServerSendResponse(
|
||||
appUuid, address, aStatus, aRequestId, aRsp, aRunnable);
|
||||
aAppUuid, aAddress, aStatus, aRequestId, aRsp, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
@ -874,17 +746,8 @@ BluetoothServiceBluedroid::GattServerSendIndicationInternal(
|
||||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
BluetoothAddress address;
|
||||
if (NS_FAILED(StringToAddress(aAddress, address))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->ServerSendIndication(appUuid,
|
||||
address,
|
||||
gatt->ServerSendIndication(aAppUuid,
|
||||
aAddress,
|
||||
aCharacteristicHandle,
|
||||
aConfirm,
|
||||
aValue,
|
||||
@ -1028,7 +891,8 @@ BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal(
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal(
|
||||
const nsTArray<nsString>& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
||||
const nsTArray<BluetoothAddress>& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -1044,17 +908,10 @@ BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal(
|
||||
mGetDeviceRequests.AppendElement(request);
|
||||
|
||||
for (uint8_t i = 0; i < aDeviceAddress.Length(); i++) {
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress[i], address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Retrieve all properties of devices
|
||||
sBtInterface->GetRemoteDeviceProperties(address,
|
||||
new GetRemoteDevicePropertiesResultHandler(mGetDeviceRequests, address));
|
||||
sBtInterface->GetRemoteDeviceProperties(aDeviceAddress[i],
|
||||
new GetRemoteDevicePropertiesResultHandler(mGetDeviceRequests,
|
||||
aDeviceAddress[i]));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -1100,7 +957,7 @@ BluetoothServiceBluedroid::StartDiscoveryInternal(
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::FetchUuidsInternal(
|
||||
const nsAString& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -1114,15 +971,8 @@ BluetoothServiceBluedroid::FetchUuidsInternal(
|
||||
StopDiscoveryInternal(aRunnable);
|
||||
}
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
mFetchUuidsRunnables.AppendElement(aRunnable);
|
||||
sBtInterface->GetRemoteServices(address,
|
||||
sBtInterface->GetRemoteServices(aDeviceAddress,
|
||||
new DispatchReplyErrorResultHandler(mFetchUuidsRunnables, aRunnable));
|
||||
|
||||
return NS_OK;
|
||||
@ -1358,22 +1208,15 @@ BluetoothServiceBluedroid::UpdateSdpRecords(
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::CreatePairedDeviceInternal(
|
||||
const nsAString& aDeviceAddress, int aTimeout,
|
||||
const BluetoothAddress& aDeviceAddress, int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK);
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
mCreateBondRunnables.AppendElement(aRunnable);
|
||||
sBtInterface->CreateBond(address, TRANSPORT_AUTO,
|
||||
sBtInterface->CreateBond(aDeviceAddress, TRANSPORT_AUTO,
|
||||
new DispatchReplyErrorResultHandler(mCreateBondRunnables, aRunnable));
|
||||
|
||||
return NS_OK;
|
||||
@ -1381,21 +1224,14 @@ BluetoothServiceBluedroid::CreatePairedDeviceInternal(
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::RemoveDeviceInternal(
|
||||
const nsAString& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK);
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
mRemoveBondRunnables.AppendElement(aRunnable);
|
||||
sBtInterface->RemoveBond(address,
|
||||
sBtInterface->RemoveBond(aDeviceAddress,
|
||||
new DispatchReplyErrorResultHandler(mRemoveBondRunnables, aRunnable));
|
||||
|
||||
return NS_OK;
|
||||
@ -1425,34 +1261,20 @@ private:
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::PinReplyInternal(
|
||||
const nsAString& aDeviceAddress, bool aAccept,
|
||||
const nsAString& aPinCode, BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress, bool aAccept,
|
||||
const BluetoothPinCode& aPinCode, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
BluetoothPinCode pinCode;
|
||||
rv = StringToPinCode(aPinCode, pinCode);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
sBtInterface->PinReply(address, aAccept, pinCode,
|
||||
sBtInterface->PinReply(aDeviceAddress, aAccept, aPinCode,
|
||||
new PinReplyResultHandler(aRunnable));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SetPinCodeInternal(
|
||||
const nsAString& aDeviceAddress, const nsAString& aPinCode,
|
||||
const BluetoothAddress& aDeviceAddress, const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
// Legacy method used by BlueZ only.
|
||||
@ -1460,7 +1282,7 @@ BluetoothServiceBluedroid::SetPinCodeInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SetPasskeyInternal(
|
||||
const nsAString& aDeviceAddress, uint32_t aPasskey,
|
||||
const BluetoothAddress& aDeviceAddress, uint32_t aPasskey,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
// Legacy method used by BlueZ only.
|
||||
@ -1490,27 +1312,20 @@ private:
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SspReplyInternal(
|
||||
const nsAString& aDeviceAddress, BluetoothSspVariant aVariant,
|
||||
const BluetoothAddress& aDeviceAddress, BluetoothSspVariant aVariant,
|
||||
bool aAccept, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
sBtInterface->SspReply(address, aVariant, aAccept, 0 /* passkey */,
|
||||
sBtInterface->SspReply(aDeviceAddress, aVariant, aAccept, 0 /* passkey */,
|
||||
new SspReplyResultHandler(aRunnable));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SetPairingConfirmationInternal(
|
||||
const nsAString& aDeviceAddress, bool aConfirm,
|
||||
const BluetoothAddress& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
// Legacy method used by BlueZ only.
|
||||
@ -1533,22 +1348,15 @@ BluetoothServiceBluedroid::NextBluetoothProfileController()
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::ConnectDisconnect(
|
||||
bool aConnect, const nsAString& aDeviceAddress,
|
||||
bool aConnect, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable,
|
||||
uint16_t aServiceUuid, uint32_t aCod)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aRunnable);
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
BluetoothProfileController* controller =
|
||||
new BluetoothProfileController(aConnect, address, aRunnable,
|
||||
new BluetoothProfileController(aConnect, aDeviceAddress, aRunnable,
|
||||
NextBluetoothProfileController,
|
||||
aServiceUuid, aCod);
|
||||
sControllerArray.AppendElement(controller);
|
||||
@ -1564,7 +1372,7 @@ BluetoothServiceBluedroid::ConnectDisconnect(
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::Connect(const nsAString& aDeviceAddress,
|
||||
BluetoothServiceBluedroid::Connect(const BluetoothAddress& aDeviceAddress,
|
||||
uint32_t aCod,
|
||||
uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
@ -1574,34 +1382,27 @@ BluetoothServiceBluedroid::Connect(const nsAString& aDeviceAddress,
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::Disconnect(
|
||||
const nsAString& aDeviceAddress, uint16_t aServiceUuid,
|
||||
const BluetoothAddress& aDeviceAddress, uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
ConnectDisconnect(false, aDeviceAddress, aRunnable, aServiceUuid);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SendFile(const nsAString& aDeviceAddress,
|
||||
BluetoothServiceBluedroid::SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
BlobParent* aBlobParent,
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, deviceAddress);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
// Currently we only support one device sending one file at a time,
|
||||
// so we don't need aDeviceAddress here because the target device
|
||||
// has been determined when calling 'Connect()'. Nevertheless, keep
|
||||
// it for future use.
|
||||
|
||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||
if (!opp || !opp->SendFile(deviceAddress, aBlobParent)) {
|
||||
if (!opp || !opp->SendFile(aDeviceAddress, aBlobParent)) {
|
||||
DispatchReplyError(aRunnable, NS_LITERAL_STRING("SendFile failed"));
|
||||
return;
|
||||
}
|
||||
@ -1610,26 +1411,19 @@ BluetoothServiceBluedroid::SendFile(const nsAString& aDeviceAddress,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SendFile(const nsAString& aDeviceAddress,
|
||||
BluetoothServiceBluedroid::SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
Blob* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, deviceAddress);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
// Currently we only support one device sending one file at a time,
|
||||
// so we don't need aDeviceAddress here because the target device
|
||||
// has been determined when calling 'Connect()'. Nevertheless, keep
|
||||
// it for future use.
|
||||
|
||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||
if (!opp || !opp->SendFile(deviceAddress, aBlob)) {
|
||||
if (!opp || !opp->SendFile(aDeviceAddress, aBlob)) {
|
||||
DispatchReplyError(aRunnable, NS_LITERAL_STRING("SendFile failed"));
|
||||
return;
|
||||
}
|
||||
@ -1638,8 +1432,8 @@ BluetoothServiceBluedroid::SendFile(const nsAString& aDeviceAddress,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::StopSendingFile(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
BluetoothServiceBluedroid::StopSendingFile(
|
||||
const BluetoothAddress& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -1660,7 +1454,7 @@ BluetoothServiceBluedroid::StopSendingFile(const nsAString& aDeviceAddress,
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::ConfirmReceivingFile(
|
||||
const nsAString& aDeviceAddress, bool aConfirm,
|
||||
const BluetoothAddress& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -2021,15 +1815,12 @@ BluetoothServiceBluedroid::SendMetaData(const nsAString& aTitle,
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SendPlayStatus(
|
||||
int64_t aDuration, int64_t aPosition,
|
||||
const nsAString& aPlayStatus,
|
||||
int64_t aDuration, int64_t aPosition, ControlPlayStatus aPlayStatus,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
BluetoothAvrcpManager* avrcp = BluetoothAvrcpManager::Get();
|
||||
if (avrcp) {
|
||||
ControlPlayStatus playStatus =
|
||||
PlayStatusStringToControlPlayStatus(aPlayStatus);
|
||||
avrcp->UpdatePlayStatus(aDuration, aPosition, playStatus);
|
||||
avrcp->UpdatePlayStatus(aDuration, aPosition, aPlayStatus);
|
||||
}
|
||||
DispatchReplySuccess(aRunnable);
|
||||
}
|
||||
|
@ -50,11 +50,12 @@ public:
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult
|
||||
GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
GetPairedDevicePropertiesInternal(
|
||||
const nsTArray<BluetoothAddress>& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult
|
||||
FetchUuidsInternal(const nsAString& aDeviceAddress,
|
||||
FetchUuidsInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable);
|
||||
@ -75,67 +76,67 @@ public:
|
||||
BluetoothProfileManagerBase* aManager);
|
||||
|
||||
virtual nsresult
|
||||
CreatePairedDeviceInternal(const nsAString& aDeviceAddress,
|
||||
CreatePairedDeviceInternal(const BluetoothAddress& aDeviceAddress,
|
||||
int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult
|
||||
RemoveDeviceInternal(const nsAString& aDeviceObjectPath,
|
||||
RemoveDeviceInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
PinReplyInternal(const nsAString& aDeviceAddress,
|
||||
PinReplyInternal(const BluetoothAddress& aDeviceAddress,
|
||||
bool aAccept,
|
||||
const nsAString& aPinCode,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
SspReplyInternal(const nsAString& aDeviceAddress,
|
||||
SspReplyInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothSspVariant aVariant,
|
||||
bool aAccept,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
virtual void
|
||||
SetPinCodeInternal(const nsAString& aDeviceAddress,
|
||||
const nsAString& aPinCode,
|
||||
SetPinCodeInternal(const BluetoothAddress& aDeviceAddress,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
SetPasskeyInternal(const nsAString& aDeviceAddress,
|
||||
SetPasskeyInternal(const BluetoothAddress& aDeviceAddress,
|
||||
uint32_t aPasskey,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
SetPairingConfirmationInternal(const nsAString& aDeviceAddress,
|
||||
SetPairingConfirmationInternal(const BluetoothAddress& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
Connect(const nsAString& aDeviceAddress,
|
||||
Connect(const BluetoothAddress& aDeviceAddress,
|
||||
uint32_t aCod,
|
||||
uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
Disconnect(const nsAString& aDeviceAddress, uint16_t aServiceUuid,
|
||||
Disconnect(const BluetoothAddress& aDeviceAddress, uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
BlobParent* aBlobParent,
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
Blob* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
StopSendingFile(const nsAString& aDeviceAddress,
|
||||
StopSendingFile(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
ConfirmReceivingFile(const nsAString& aDeviceAddress, bool aConfirm,
|
||||
ConfirmReceivingFile(const BluetoothAddress& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
@ -254,7 +255,7 @@ public:
|
||||
virtual void
|
||||
SendPlayStatus(int64_t aDuration,
|
||||
int64_t aPosition,
|
||||
const nsAString& aPlayStatus,
|
||||
ControlPlayStatus aPlayStatus,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
@ -274,36 +275,36 @@ public:
|
||||
// GATT Client
|
||||
//
|
||||
|
||||
virtual void StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
|
||||
virtual void StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void StopLeScanInternal(const nsAString& aScanUuid,
|
||||
virtual void StopLeScanInternal(const BluetoothUuid& aScanUuid,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
ConnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const nsAString& aDeviceAddress,
|
||||
ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
DisconnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const nsAString& aDeviceAddress,
|
||||
DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
DiscoverGattServicesInternal(const nsAString& aAppUuid,
|
||||
DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientStartNotificationsInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientStopNotificationsInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
@ -314,19 +315,19 @@ public:
|
||||
|
||||
virtual void
|
||||
GattClientReadRemoteRssiInternal(
|
||||
int aClientIf, const nsAString& aDeviceAddress,
|
||||
int aClientIf, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientReadCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientWriteCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattWriteType& aWriteType,
|
||||
@ -335,7 +336,7 @@ public:
|
||||
|
||||
virtual void
|
||||
GattClientReadDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -343,7 +344,7 @@ public:
|
||||
|
||||
virtual void
|
||||
GattClientWriteDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -352,14 +353,14 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
@ -368,21 +369,21 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerAddServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
uint16_t aHandleCount,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerAddIncludedServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aIncludedServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerAddCharacteristicInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothUuid& aCharacteristicUuid,
|
||||
BluetoothGattAttrPerm aPermissions,
|
||||
@ -391,7 +392,7 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerAddDescriptorInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
const BluetoothUuid& aDescriptorUuid,
|
||||
@ -400,26 +401,26 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerRemoveServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerStartServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerStopServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
@ -427,8 +428,8 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
@ -485,11 +486,8 @@ protected:
|
||||
static nsresult StartGonkBluetooth();
|
||||
static nsresult StopGonkBluetooth();
|
||||
|
||||
static ControlPlayStatus PlayStatusStringToControlPlayStatus(
|
||||
const nsAString& aPlayStatus);
|
||||
|
||||
static void ConnectDisconnect(bool aConnect,
|
||||
const nsAString& aDeviceAddress,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable,
|
||||
uint16_t aServiceUuid, uint32_t aCod = 0);
|
||||
static void NextBluetoothProfileController();
|
||||
|
@ -2703,7 +2703,7 @@ class BluetoothArrayOfDevicePropertiesReplyHandler : public DBusReplyHandler
|
||||
{
|
||||
public:
|
||||
BluetoothArrayOfDevicePropertiesReplyHandler(
|
||||
const nsTArray<nsString>& aDeviceAddresses,
|
||||
const nsTArray<BluetoothAddress>& aDeviceAddresses,
|
||||
const FilterFunc aFilterFunc, BluetoothReplyRunnable* aRunnable)
|
||||
: mDeviceAddresses(aDeviceAddresses)
|
||||
, mProcessedDeviceAddresses(0)
|
||||
@ -2772,8 +2772,11 @@ public:
|
||||
}
|
||||
|
||||
if (mFilterFunc(deviceProperties)) {
|
||||
nsString deviceAddressStr;
|
||||
AddressToString(mDeviceAddresses[i], deviceAddressStr);
|
||||
|
||||
mValues.get_ArrayOfBluetoothNamedValue().AppendElement(
|
||||
BluetoothNamedValue(mDeviceAddresses[i], deviceProperties));
|
||||
BluetoothNamedValue(deviceAddressStr, deviceProperties));
|
||||
}
|
||||
|
||||
ProcessRemainingDeviceAddresses();
|
||||
@ -2822,7 +2825,7 @@ protected:
|
||||
|
||||
private:
|
||||
nsString mObjectPath;
|
||||
const nsTArray<nsString> mDeviceAddresses;
|
||||
const nsTArray<BluetoothAddress> mDeviceAddresses;
|
||||
nsTArray<nsString>::size_type mProcessedDeviceAddresses;
|
||||
const FilterFunc mFilterFunc;
|
||||
RefPtr<BluetoothReplyRunnable> mRunnable;
|
||||
@ -2868,7 +2871,8 @@ BluetoothDBusService::GetConnectedDevicePropertiesInternal(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTArray<nsString> deviceAddresses;
|
||||
nsTArray<BluetoothAddress> deviceAddresses;
|
||||
|
||||
BluetoothProfileManagerBase* profile =
|
||||
BluetoothUuidHelper::GetBluetoothProfileManager(aServiceUuid);
|
||||
if (!profile) {
|
||||
@ -2880,11 +2884,7 @@ BluetoothDBusService::GetConnectedDevicePropertiesInternal(
|
||||
if (profile->IsConnected()) {
|
||||
BluetoothAddress address;
|
||||
profile->GetAddress(address);
|
||||
|
||||
nsAutoString addressStr;
|
||||
AddressToString(address, addressStr);
|
||||
|
||||
deviceAddresses.AppendElement(addressStr);
|
||||
deviceAddresses.AppendElement(address);
|
||||
}
|
||||
|
||||
BluetoothArrayOfDevicePropertiesReplyHandler* handler =
|
||||
@ -2899,8 +2899,8 @@ BluetoothDBusService::GetConnectedDevicePropertiesInternal(
|
||||
|
||||
nsresult
|
||||
BluetoothDBusService::GetPairedDevicePropertiesInternal(
|
||||
const nsTArray<nsString>& aDeviceAddresses,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
const nsTArray<BluetoothAddress>& aDeviceAddresses,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -2921,7 +2921,7 @@ BluetoothDBusService::GetPairedDevicePropertiesInternal(
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDBusService::FetchUuidsInternal(const nsAString& aDeviceAddress,
|
||||
BluetoothDBusService::FetchUuidsInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return NS_OK;
|
||||
@ -3092,14 +3092,14 @@ BluetoothDBusService::SetProperty(BluetoothObjectType aType,
|
||||
class CreatePairedDeviceInternalTask : public Task
|
||||
{
|
||||
public:
|
||||
CreatePairedDeviceInternalTask(const nsACString& aDeviceAddress,
|
||||
CreatePairedDeviceInternalTask(const BluetoothAddress& aDeviceAddress,
|
||||
int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
: mDeviceAddress(aDeviceAddress)
|
||||
, mTimeout(aTimeout)
|
||||
, mRunnable(aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(!mDeviceAddress.IsEmpty());
|
||||
MOZ_ASSERT(!mDeviceAddress.IsCleared());
|
||||
MOZ_ASSERT(mRunnable);
|
||||
}
|
||||
|
||||
@ -3109,7 +3109,11 @@ public:
|
||||
MOZ_ASSERT(sDBusConnection);
|
||||
MOZ_ASSERT(!sAdapterPath.IsEmpty());
|
||||
|
||||
const char *deviceAddress = mDeviceAddress.get();
|
||||
nsString deviceAddressStr;
|
||||
AddressToString(mDeviceAddress, deviceAddressStr);
|
||||
auto utf8DeviceAddressStr = NS_ConvertUTF16toUTF8(deviceAddressStr);
|
||||
|
||||
const char *deviceAddress = utf8DeviceAddressStr.get();
|
||||
const char *deviceAgentPath = KEY_REMOTE_AGENT;
|
||||
const char *capabilities = B2G_AGENT_CAPABILITIES;
|
||||
|
||||
@ -3145,20 +3149,20 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
const nsCString mDeviceAddress;
|
||||
BluetoothAddress mDeviceAddress;
|
||||
int mTimeout;
|
||||
RefPtr<BluetoothReplyRunnable> mRunnable;
|
||||
};
|
||||
|
||||
nsresult
|
||||
BluetoothDBusService::CreatePairedDeviceInternal(
|
||||
const nsAString& aDeviceAddress,
|
||||
int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
Task* task = new CreatePairedDeviceInternalTask(
|
||||
NS_ConvertUTF16toUTF8(aDeviceAddress),
|
||||
aTimeout, aRunnable);
|
||||
Task* task = new CreatePairedDeviceInternalTask(aDeviceAddress,
|
||||
aTimeout,
|
||||
aRunnable);
|
||||
DispatchToDBusThread(task);
|
||||
|
||||
return NS_OK;
|
||||
@ -3221,8 +3225,9 @@ private:
|
||||
};
|
||||
|
||||
nsresult
|
||||
BluetoothDBusService::RemoveDeviceInternal(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
BluetoothDBusService::RemoveDeviceInternal(
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -3232,14 +3237,7 @@ BluetoothDBusService::RemoveDeviceInternal(const nsAString& aDeviceAddress,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
auto rv = StringToAddress(aDeviceAddress, deviceAddress);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
Task* task = new RemoveDeviceTask(deviceAddress, aRunnable);
|
||||
Task* task = new RemoveDeviceTask(aDeviceAddress, aRunnable);
|
||||
DispatchToDBusThread(task);
|
||||
|
||||
return NS_OK;
|
||||
@ -3249,7 +3247,7 @@ class SetPinCodeTask : public Task
|
||||
{
|
||||
public:
|
||||
SetPinCodeTask(const BluetoothAddress& aDeviceAddress,
|
||||
const nsACString& aPinCode,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
: mDeviceAddress(aDeviceAddress)
|
||||
, mPinCode(aPinCode)
|
||||
@ -3283,7 +3281,19 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
const char* pinCode = mPinCode.get();
|
||||
nsAutoString pinCodeStr;
|
||||
if (NS_FAILED(PinCodeToString(mPinCode, pinCodeStr))) {
|
||||
BT_WARNING("%s: Cannot convert pin code to string.", __FUNCTION__);
|
||||
dbus_message_unref(msg);
|
||||
dbus_message_unref(reply);
|
||||
errorStr.AssignLiteral("Cannot convert pin code to string.");
|
||||
DispatchBluetoothReply(mRunnable, v, errorStr);
|
||||
return;
|
||||
}
|
||||
|
||||
auto utf8PinCodeStr = NS_ConvertUTF16toUTF8(pinCodeStr);
|
||||
|
||||
const char* pinCode = utf8PinCodeStr.get();
|
||||
|
||||
if (!dbus_message_append_args(reply,
|
||||
DBUS_TYPE_STRING, &pinCode,
|
||||
@ -3304,41 +3314,32 @@ public:
|
||||
|
||||
private:
|
||||
const BluetoothAddress mDeviceAddress;
|
||||
const nsCString mPinCode;
|
||||
const BluetoothPinCode mPinCode;
|
||||
RefPtr<BluetoothReplyRunnable> mRunnable;
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDBusService::PinReplyInternal(
|
||||
const nsAString& aDeviceAddress, bool aAccept,
|
||||
const nsAString& aPinCode, BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress, bool aAccept,
|
||||
const BluetoothPinCode& aPinCode, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
// Legacy interface used by Bluedroid only.
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::SspReplyInternal(
|
||||
const nsAString& aDeviceAddress, BluetoothSspVariant aVariant,
|
||||
const BluetoothAddress& aDeviceAddress, BluetoothSspVariant aVariant,
|
||||
bool aAccept, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
// Legacy interface used by Bluedroid only.
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::SetPinCodeInternal(const nsAString& aDeviceAddress,
|
||||
const nsAString& aPinCode,
|
||||
BluetoothDBusService::SetPinCodeInternal(const BluetoothAddress& aDeviceAddress,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
BluetoothAddress deviceAddress;
|
||||
auto rv = StringToAddress(aDeviceAddress, deviceAddress);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
Task* task = new SetPinCodeTask(deviceAddress,
|
||||
NS_ConvertUTF16toUTF8(aPinCode),
|
||||
aRunnable);
|
||||
Task* task = new SetPinCodeTask(aDeviceAddress, aPinCode, aRunnable);
|
||||
DispatchToDBusThread(task);
|
||||
}
|
||||
|
||||
@ -3406,17 +3407,12 @@ private:
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDBusService::SetPasskeyInternal(const nsAString& aDeviceAddress,
|
||||
uint32_t aPasskey,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
BluetoothDBusService::SetPasskeyInternal(
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
uint32_t aPasskey,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
Task* task = new SetPasskeyTask(deviceAddress,
|
||||
Task* task = new SetPasskeyTask(aDeviceAddress,
|
||||
aPasskey,
|
||||
aRunnable);
|
||||
DispatchToDBusThread(task);
|
||||
@ -3424,19 +3420,13 @@ BluetoothDBusService::SetPasskeyInternal(const nsAString& aDeviceAddress,
|
||||
|
||||
void
|
||||
BluetoothDBusService::SetPairingConfirmationInternal(
|
||||
const nsAString& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
Task* task = new SetPairingConfirmationTask(deviceAddress,
|
||||
Task* task = new SetPairingConfirmationTask(aDeviceAddress,
|
||||
aConfirm,
|
||||
aRunnable);
|
||||
DispatchToDBusThread(task);
|
||||
@ -3457,22 +3447,15 @@ NextBluetoothProfileController()
|
||||
}
|
||||
|
||||
static void
|
||||
ConnectDisconnect(bool aConnect, const nsAString& aDeviceAddress,
|
||||
ConnectDisconnect(bool aConnect, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable,
|
||||
uint16_t aServiceUuid, uint32_t aCod = 0)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aRunnable);
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, deviceAddress);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
BluetoothProfileController* controller =
|
||||
new BluetoothProfileController(aConnect, deviceAddress, aRunnable,
|
||||
new BluetoothProfileController(aConnect, aDeviceAddress, aRunnable,
|
||||
NextBluetoothProfileController,
|
||||
aServiceUuid, aCod);
|
||||
sControllerArray.AppendElement(controller);
|
||||
@ -3488,7 +3471,7 @@ ConnectDisconnect(bool aConnect, const nsAString& aDeviceAddress,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::Connect(const nsAString& aDeviceAddress,
|
||||
BluetoothDBusService::Connect(const BluetoothAddress& aDeviceAddress,
|
||||
uint32_t aCod,
|
||||
uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
@ -3497,7 +3480,7 @@ BluetoothDBusService::Connect(const nsAString& aDeviceAddress,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::Disconnect(const nsAString& aDeviceAddress,
|
||||
BluetoothDBusService::Disconnect(const BluetoothAddress& aDeviceAddress,
|
||||
uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
@ -3542,16 +3525,13 @@ BluetoothDBusService::ToggleCalls(BluetoothReplyRunnable* aRunnable)
|
||||
class OnUpdateSdpRecordsRunnable : public nsRunnable
|
||||
{
|
||||
public:
|
||||
OnUpdateSdpRecordsRunnable(const nsAString& aObjectPath,
|
||||
OnUpdateSdpRecordsRunnable(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothProfileManagerBase* aManager)
|
||||
: mManager(aManager)
|
||||
: mDeviceAddress(aDeviceAddress)
|
||||
, mManager(aManager)
|
||||
{
|
||||
MOZ_ASSERT(!aObjectPath.IsEmpty());
|
||||
MOZ_ASSERT(aManager);
|
||||
|
||||
const nsString deviceAddressStr = GetAddressFromObjectPath(aObjectPath);
|
||||
|
||||
StringToAddress(deviceAddressStr, mDeviceAddress);
|
||||
MOZ_ASSERT(!mDeviceAddress.IsCleared());
|
||||
MOZ_ASSERT(mManager);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -3758,7 +3738,7 @@ public:
|
||||
// I choose to use raw pointer here because this is going to be passed as an
|
||||
// argument into SendWithReply() at once.
|
||||
OnUpdateSdpRecordsRunnable* callbackRunnable =
|
||||
new OnUpdateSdpRecordsRunnable(objectPath, mBluetoothProfileManager);
|
||||
new OnUpdateSdpRecordsRunnable(mDeviceAddress, mBluetoothProfileManager);
|
||||
|
||||
sDBusConnection->SendWithReply(DiscoverServicesCallback,
|
||||
(void*)callbackRunnable, -1,
|
||||
@ -3798,26 +3778,20 @@ BluetoothDBusService::UpdateSdpRecords(const BluetoothAddress& aDeviceAddress,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::SendFile(const nsAString& aDeviceAddress,
|
||||
BluetoothDBusService::SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
BlobParent* aBlobParent,
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
// Currently we only support one device sending one file at a time,
|
||||
// so we don't need aDeviceAddress here because the target device
|
||||
// has been determined when calling 'Connect()'. Nevertheless, keep
|
||||
// it for future use.
|
||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||
nsAutoString errorStr;
|
||||
if (!opp || !opp->SendFile(deviceAddress, aBlobParent)) {
|
||||
if (!opp || !opp->SendFile(aDeviceAddress, aBlobParent)) {
|
||||
errorStr.AssignLiteral("Calling SendFile() failed");
|
||||
}
|
||||
|
||||
@ -3825,25 +3799,19 @@ BluetoothDBusService::SendFile(const nsAString& aDeviceAddress,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::SendFile(const nsAString& aDeviceAddress,
|
||||
BluetoothDBusService::SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
Blob* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
// Currently we only support one device sending one file at a time,
|
||||
// so we don't need aDeviceAddress here because the target device
|
||||
// has been determined when calling 'Connect()'. Nevertheless, keep
|
||||
// it for future use.
|
||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||
nsAutoString errorStr;
|
||||
if (!opp || !opp->SendFile(deviceAddress, aBlob)) {
|
||||
if (!opp || !opp->SendFile(aDeviceAddress, aBlob)) {
|
||||
errorStr.AssignLiteral("Calling SendFile() failed");
|
||||
}
|
||||
|
||||
@ -3851,7 +3819,7 @@ BluetoothDBusService::SendFile(const nsAString& aDeviceAddress,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::StopSendingFile(const nsAString& aDeviceAddress,
|
||||
BluetoothDBusService::StopSendingFile(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -3870,9 +3838,10 @@ BluetoothDBusService::StopSendingFile(const nsAString& aDeviceAddress,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::ConfirmReceivingFile(const nsAString& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
BluetoothDBusService::ConfirmReceivingFile(
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Must be called from main thread!");
|
||||
|
||||
@ -4075,27 +4044,6 @@ BluetoothDBusService::SendMetaData(const nsAString& aTitle,
|
||||
aMediaNumber, aTotalMediaCount, aDuration);
|
||||
}
|
||||
|
||||
static ControlPlayStatus
|
||||
PlayStatusStringToControlPlayStatus(const nsAString& aPlayStatus)
|
||||
{
|
||||
ControlPlayStatus playStatus = ControlPlayStatus::PLAYSTATUS_UNKNOWN;
|
||||
if (aPlayStatus.EqualsLiteral("STOPPED")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_STOPPED;
|
||||
} else if (aPlayStatus.EqualsLiteral("PLAYING")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_PLAYING;
|
||||
} else if (aPlayStatus.EqualsLiteral("PAUSED")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_PAUSED;
|
||||
} else if (aPlayStatus.EqualsLiteral("FWD_SEEK")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_FWD_SEEK;
|
||||
} else if (aPlayStatus.EqualsLiteral("REV_SEEK")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_REV_SEEK;
|
||||
} else if (aPlayStatus.EqualsLiteral("ERROR")) {
|
||||
playStatus = ControlPlayStatus::PLAYSTATUS_ERROR;
|
||||
}
|
||||
|
||||
return playStatus;
|
||||
}
|
||||
|
||||
class SendPlayStatusTask : public Task
|
||||
{
|
||||
public:
|
||||
@ -4150,7 +4098,7 @@ private:
|
||||
void
|
||||
BluetoothDBusService::SendPlayStatus(int64_t aDuration,
|
||||
int64_t aPosition,
|
||||
const nsAString& aPlayStatus,
|
||||
ControlPlayStatus aPlayStatus,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -4161,9 +4109,7 @@ BluetoothDBusService::SendPlayStatus(int64_t aDuration,
|
||||
return;
|
||||
}
|
||||
|
||||
ControlPlayStatus playStatus =
|
||||
PlayStatusStringToControlPlayStatus(aPlayStatus);
|
||||
if (playStatus == ControlPlayStatus::PLAYSTATUS_UNKNOWN) {
|
||||
if (aPlayStatus == ControlPlayStatus::PLAYSTATUS_UNKNOWN) {
|
||||
DispatchBluetoothReply(aRunnable, BluetoothValue(),
|
||||
NS_LITERAL_STRING("Invalid play status"));
|
||||
return;
|
||||
@ -4186,9 +4132,9 @@ BluetoothDBusService::SendPlayStatus(int64_t aDuration,
|
||||
return;
|
||||
}
|
||||
|
||||
if (playStatus != avrcp->GetPlayStatus()) {
|
||||
if (aPlayStatus != avrcp->GetPlayStatus()) {
|
||||
UpdateNotification(ControlEventId::EVENT_PLAYBACK_STATUS_CHANGED,
|
||||
playStatus);
|
||||
aPlayStatus);
|
||||
} else if (aPosition != avrcp->GetPosition()) {
|
||||
UpdateNotification(ControlEventId::EVENT_PLAYBACK_POS_CHANGED, aPosition);
|
||||
}
|
||||
@ -4199,11 +4145,11 @@ BluetoothDBusService::SendPlayStatus(int64_t aDuration,
|
||||
Task* task = new SendPlayStatusTask(deviceAddress,
|
||||
aDuration,
|
||||
aPosition,
|
||||
playStatus,
|
||||
aPlayStatus,
|
||||
aRunnable);
|
||||
DispatchToDBusThread(task);
|
||||
|
||||
avrcp->UpdatePlayStatus(aDuration, aPosition, playStatus);
|
||||
avrcp->UpdatePlayStatus(aDuration, aPosition, aPlayStatus);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -4349,48 +4295,48 @@ BluetoothDBusService::UpdateNotification(ControlEventId aEventId,
|
||||
|
||||
void
|
||||
BluetoothDBusService::StartLeScanInternal(
|
||||
const nsTArray<nsString>& aServiceUuids,
|
||||
const nsTArray<BluetoothUuid>& aServiceUuids,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::StopLeScanInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::ConnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::DisconnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::DiscoverGattServicesInternal(
|
||||
const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothUuid& aAppUuid, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattClientStartNotificationsInternal(
|
||||
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattClientStopNotificationsInternal(
|
||||
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
@ -4403,14 +4349,14 @@ BluetoothDBusService::UnregisterGattClientInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattClientReadRemoteRssiInternal(
|
||||
int aClientIf, const nsAString& aDeviceAddress,
|
||||
int aClientIf, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattClientReadCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
@ -4419,7 +4365,7 @@ BluetoothDBusService::GattClientReadCharacteristicValueInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattClientWriteCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattWriteType& aWriteType,
|
||||
@ -4430,7 +4376,7 @@ BluetoothDBusService::GattClientWriteCharacteristicValueInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattClientReadDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -4440,7 +4386,7 @@ BluetoothDBusService::GattClientReadDescriptorValueInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattClientWriteDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -4575,14 +4521,14 @@ BluetoothDBusService::ReplyToMapMessageUpdate(long aMasId, bool aStatus,
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid, const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid, const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
@ -4595,7 +4541,7 @@ BluetoothDBusService::UnregisterGattServerInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerAddServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
uint16_t aHandleCount,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
@ -4604,7 +4550,7 @@ BluetoothDBusService::GattServerAddServiceInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerAddIncludedServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aIncludedServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
@ -4613,7 +4559,7 @@ BluetoothDBusService::GattServerAddIncludedServiceInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerAddCharacteristicInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothUuid& aCharacteristicUuid,
|
||||
BluetoothGattAttrPerm aPermissions,
|
||||
@ -4624,7 +4570,7 @@ BluetoothDBusService::GattServerAddCharacteristicInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerAddDescriptorInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
const BluetoothUuid& aDescriptorUuid,
|
||||
@ -4635,7 +4581,7 @@ BluetoothDBusService::GattServerAddDescriptorInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerRemoveServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
@ -4643,7 +4589,7 @@ BluetoothDBusService::GattServerRemoveServiceInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerStartServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
@ -4651,7 +4597,7 @@ BluetoothDBusService::GattServerStartServiceInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerStopServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
@ -4659,8 +4605,8 @@ BluetoothDBusService::GattServerStopServiceInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
@ -4670,8 +4616,8 @@ BluetoothDBusService::GattServerSendIndicationInternal(
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
|
@ -59,11 +59,12 @@ public:
|
||||
uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult
|
||||
GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
GetPairedDevicePropertiesInternal(
|
||||
const nsTArray<BluetoothAddress>& aDeviceAddresses,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult
|
||||
FetchUuidsInternal(const nsAString& aDeviceAddress,
|
||||
FetchUuidsInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
@ -87,65 +88,67 @@ public:
|
||||
BluetoothProfileManagerBase* aManager) override;
|
||||
|
||||
virtual nsresult
|
||||
CreatePairedDeviceInternal(const nsAString& aDeviceAddress,
|
||||
CreatePairedDeviceInternal(const BluetoothAddress& aDeviceAddress,
|
||||
int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult
|
||||
RemoveDeviceInternal(const nsAString& aDeviceObjectPath,
|
||||
RemoveDeviceInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
PinReplyInternal(const nsAString& aDeviceAddress,
|
||||
PinReplyInternal(const BluetoothAddress& aDeviceAddress,
|
||||
bool aAccept,
|
||||
const nsAString& aPinCode,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
SspReplyInternal(const nsAString& aDeviceAddress,
|
||||
SspReplyInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothSspVariant aVariant,
|
||||
bool aAccept,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
SetPinCodeInternal(const nsAString& aDeviceAddress, const nsAString& aPinCode,
|
||||
SetPinCodeInternal(const BluetoothAddress& aDeviceAddress,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
SetPasskeyInternal(const nsAString& aDeviceAddress, uint32_t aPasskey,
|
||||
SetPasskeyInternal(const BluetoothAddress& aDeviceAddress, uint32_t aPasskey,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
SetPairingConfirmationInternal(const nsAString& aDeviceAddress, bool aConfirm,
|
||||
SetPairingConfirmationInternal(const BluetoothAddress& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
Connect(const nsAString& aDeviceAddress,
|
||||
Connect(const BluetoothAddress& aDeviceAddress,
|
||||
uint32_t aCod,
|
||||
uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
Disconnect(const nsAString& aDeviceAddress, uint16_t aServiceUuid,
|
||||
Disconnect(const BluetoothAddress& aDeviceAddress, uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
BlobParent* aBlobParent,
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
Blob* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
StopSendingFile(const nsAString& aDeviceAddress,
|
||||
StopSendingFile(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
ConfirmReceivingFile(const nsAString& aDeviceAddress, bool aConfirm,
|
||||
ConfirmReceivingFile(const BluetoothAddress& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
@ -265,7 +268,7 @@ public:
|
||||
virtual void
|
||||
SendPlayStatus(int64_t aDuration,
|
||||
int64_t aPosition,
|
||||
const nsAString& aPlayStatus,
|
||||
ControlPlayStatus aPlayStatus,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
@ -282,37 +285,37 @@ public:
|
||||
const nsAString& aMessage) override;
|
||||
|
||||
virtual void
|
||||
StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
|
||||
StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
StopLeScanInternal(const nsAString& aAppUuid,
|
||||
StopLeScanInternal(const BluetoothUuid& aAppUuid,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
ConnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const nsAString& aDeviceAddress,
|
||||
ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
DisconnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const nsAString& aDeviceAddress,
|
||||
DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
DiscoverGattServicesInternal(const nsAString& aAppUuid,
|
||||
DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientStartNotificationsInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientStopNotificationsInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
@ -323,19 +326,19 @@ public:
|
||||
|
||||
virtual void
|
||||
GattClientReadRemoteRssiInternal(
|
||||
int aClientIf, const nsAString& aDeviceAddress,
|
||||
int aClientIf, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientReadCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientWriteCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattWriteType& aWriteType,
|
||||
@ -344,7 +347,7 @@ public:
|
||||
|
||||
virtual void
|
||||
GattClientReadDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -352,7 +355,7 @@ public:
|
||||
|
||||
virtual void
|
||||
GattClientWriteDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -361,14 +364,14 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
@ -377,21 +380,21 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerAddServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
uint16_t aHandleCount,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerAddIncludedServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aIncludedServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerAddCharacteristicInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothUuid& aCharacteristicUuid,
|
||||
BluetoothGattAttrPerm aPermissions,
|
||||
@ -400,7 +403,7 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerAddDescriptorInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
const BluetoothUuid& aDescriptorUuid,
|
||||
@ -409,26 +412,26 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerRemoveServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerStartServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerStopServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
@ -436,8 +439,8 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
|
@ -6,6 +6,10 @@
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
|
||||
// FIXME: Bug 1224171: This variable needs to be cleaned up and
|
||||
// remove from global namespace.
|
||||
bool gBluetoothDebugFlag = false;
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
//
|
||||
|
@ -674,6 +674,24 @@ struct BluetoothUuid {
|
||||
struct BluetoothPinCode {
|
||||
uint8_t mPinCode[16]; /* not \0-terminated */
|
||||
uint8_t mLength;
|
||||
|
||||
BluetoothPinCode()
|
||||
: mLength(0)
|
||||
{
|
||||
std::fill(mPinCode, mPinCode + MOZ_ARRAY_LENGTH(mPinCode), 0);
|
||||
}
|
||||
|
||||
bool operator==(const BluetoothPinCode& aRhs) const
|
||||
{
|
||||
MOZ_ASSERT(mLength <= MOZ_ARRAY_LENGTH(mPinCode));
|
||||
return (mLength == aRhs.mLength) &&
|
||||
std::equal(aRhs.mPinCode, aRhs.mPinCode + aRhs.mLength, mPinCode);
|
||||
}
|
||||
|
||||
bool operator!=(const BluetoothPinCode& aRhs) const
|
||||
{
|
||||
return !operator==(aRhs);
|
||||
}
|
||||
};
|
||||
|
||||
struct BluetoothServiceName {
|
||||
|
@ -165,6 +165,12 @@ MobileConnectionListener::NotifyNetworkSelectionModeChanged()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyDeviceIdentitiesChanged()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
MobileConnectionListener::Listen(bool aStart)
|
||||
{
|
||||
|
@ -69,8 +69,6 @@
|
||||
|
||||
#define DEFAULT_SHUTDOWN_TIMER_MS 5000
|
||||
|
||||
bool gBluetoothDebugFlag = false;
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
@ -149,8 +149,9 @@ public:
|
||||
* @return NS_OK on success, NS_ERROR_FAILURE otherwise
|
||||
*/
|
||||
virtual nsresult
|
||||
GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
GetPairedDevicePropertiesInternal(
|
||||
const nsTArray<BluetoothAddress>& aDeviceAddresses,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
* Returns the properties of connected devices regarding to specific profile,
|
||||
@ -169,7 +170,7 @@ public:
|
||||
* @return NS_OK on success, NS_ERROR_FAILURE otherwise
|
||||
*/
|
||||
virtual nsresult
|
||||
FetchUuidsInternal(const nsAString& aDeviceAddress,
|
||||
FetchUuidsInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
@ -188,14 +189,14 @@ public:
|
||||
* Stops an ongoing Bluetooth LE device scan.
|
||||
*/
|
||||
virtual void
|
||||
StopLeScanInternal(const nsAString& aScanUuid,
|
||||
StopLeScanInternal(const BluetoothUuid& aScanUuid,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
* Starts a Bluetooth LE device scan.
|
||||
*/
|
||||
virtual void
|
||||
StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
|
||||
StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
@ -213,12 +214,12 @@ public:
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual nsresult
|
||||
CreatePairedDeviceInternal(const nsAString& aAddress,
|
||||
CreatePairedDeviceInternal(const BluetoothAddress& aDeviceAddress,
|
||||
int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual nsresult
|
||||
RemoveDeviceInternal(const nsAString& aObjectPath,
|
||||
RemoveDeviceInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
@ -241,13 +242,13 @@ public:
|
||||
BluetoothProfileManagerBase* aManager) = 0;
|
||||
|
||||
virtual void
|
||||
PinReplyInternal(const nsAString& aDeviceAddress,
|
||||
PinReplyInternal(const BluetoothAddress& aDeviceAddress,
|
||||
bool aAccept,
|
||||
const nsAString& aPinCode,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
SspReplyInternal(const nsAString& aDeviceAddress,
|
||||
SspReplyInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothSspVariant aVariant,
|
||||
bool aAccept,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
@ -256,49 +257,51 @@ public:
|
||||
* Legacy method used by bluez only to reply pincode request.
|
||||
*/
|
||||
virtual void
|
||||
SetPinCodeInternal(const nsAString& aDeviceAddress,
|
||||
const nsAString& aPinCode,
|
||||
SetPinCodeInternal(const BluetoothAddress& aDeviceAddress,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
* Legacy method used by bluez only to reply passkey entry request.
|
||||
*/
|
||||
virtual void
|
||||
SetPasskeyInternal(const nsAString& aDeviceAddress, uint32_t aPasskey,
|
||||
SetPasskeyInternal(const BluetoothAddress& aDeviceAddress, uint32_t aPasskey,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
* Legacy method used by bluez only to reply pairing confirmation request.
|
||||
*/
|
||||
virtual void
|
||||
SetPairingConfirmationInternal(const nsAString& aDeviceAddress, bool aConfirm,
|
||||
SetPairingConfirmationInternal(const BluetoothAddress& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
Connect(const nsAString& aDeviceAddress, uint32_t aCod, uint16_t aServiceUuid,
|
||||
Connect(const BluetoothAddress& aDeviceAddress,
|
||||
uint32_t aCod, uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
Disconnect(const nsAString& aDeviceAddress, uint16_t aServiceUuid,
|
||||
Disconnect(const BluetoothAddress& aDeviceAddress, uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
BlobParent* aBlobParent,
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
Blob* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
StopSendingFile(const nsAString& aDeviceAddress,
|
||||
StopSendingFile(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
ConfirmReceivingFile(const nsAString& aDeviceAddress, bool aConfirm,
|
||||
ConfirmReceivingFile(const BluetoothAddress& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
@ -418,7 +421,7 @@ public:
|
||||
virtual void
|
||||
SendPlayStatus(int64_t aDuration,
|
||||
int64_t aPosition,
|
||||
const nsAString& aPlayStatus,
|
||||
ControlPlayStatus aPlayStatus,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
@ -438,8 +441,8 @@ public:
|
||||
* Connect to a remote GATT server. (platform specific implementation)
|
||||
*/
|
||||
virtual void
|
||||
ConnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const nsAString& aDeviceAddress,
|
||||
ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
@ -447,8 +450,8 @@ public:
|
||||
* (platform specific implementation)
|
||||
*/
|
||||
virtual void
|
||||
DisconnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const nsAString& aDeviceAddress,
|
||||
DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
@ -456,7 +459,7 @@ public:
|
||||
* server. (platform specific implementation)
|
||||
*/
|
||||
virtual void
|
||||
DiscoverGattServicesInternal(const nsAString& aAppUuid,
|
||||
DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
@ -464,7 +467,7 @@ public:
|
||||
* (platform specific implementation)
|
||||
*/
|
||||
virtual void
|
||||
GattClientStartNotificationsInternal(const nsAString& aAppUuid,
|
||||
GattClientStartNotificationsInternal(const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
@ -474,7 +477,7 @@ public:
|
||||
* (platform specific implementation)
|
||||
*/
|
||||
virtual void
|
||||
GattClientStopNotificationsInternal(const nsAString& aAppUuid,
|
||||
GattClientStopNotificationsInternal(const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
@ -491,7 +494,7 @@ public:
|
||||
*/
|
||||
virtual void
|
||||
GattClientReadRemoteRssiInternal(int aClientIf,
|
||||
const nsAString& aDeviceAddress,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
@ -500,7 +503,7 @@ public:
|
||||
*/
|
||||
virtual void
|
||||
GattClientReadCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
@ -511,7 +514,7 @@ public:
|
||||
*/
|
||||
virtual void
|
||||
GattClientWriteCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattWriteType& aWriteType,
|
||||
@ -524,7 +527,7 @@ public:
|
||||
*/
|
||||
virtual void
|
||||
GattClientReadDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -536,7 +539,7 @@ public:
|
||||
*/
|
||||
virtual void
|
||||
GattClientWriteDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -545,14 +548,14 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
@ -564,21 +567,21 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerAddServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
uint16_t aHandleCount,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
GattServerAddIncludedServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aIncludedServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
GattServerAddCharacteristicInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothUuid& aCharacteristicUuid,
|
||||
BluetoothGattAttrPerm aPermissions,
|
||||
@ -587,7 +590,7 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerAddDescriptorInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
const BluetoothUuid& aDescriptorUuid,
|
||||
@ -596,26 +599,26 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerRemoveServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
GattServerStartServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
GattServerStopServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
@ -623,8 +626,8 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
|
@ -61,6 +61,21 @@ StringToAddress(const nsAString& aString, BluetoothAddress& aAddress)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
PinCodeToString(const BluetoothPinCode& aPinCode, nsAString& aString)
|
||||
{
|
||||
if (aPinCode.mLength > sizeof(aPinCode.mPinCode)) {
|
||||
BT_LOGR("Pin-code string too long");
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
aString = NS_ConvertUTF8toUTF16(
|
||||
nsCString(reinterpret_cast<const char*>(aPinCode.mPinCode),
|
||||
aPinCode.mLength));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
StringToPinCode(const nsAString& aString, BluetoothPinCode& aPinCode)
|
||||
{
|
||||
@ -69,7 +84,7 @@ StringToPinCode(const nsAString& aString, BluetoothPinCode& aPinCode)
|
||||
auto len = stringUTF8.Length();
|
||||
|
||||
if (len > sizeof(aPinCode.mPinCode)) {
|
||||
BT_LOGR("Service-name string too long");
|
||||
BT_LOGR("Pin-code string too long");
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
@ -82,6 +97,31 @@ StringToPinCode(const nsAString& aString, BluetoothPinCode& aPinCode)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
StringToControlPlayStatus(const nsAString& aString,
|
||||
ControlPlayStatus& aPlayStatus)
|
||||
{
|
||||
if (aString.EqualsLiteral("STOPPED")) {
|
||||
aPlayStatus = ControlPlayStatus::PLAYSTATUS_STOPPED;
|
||||
} else if (aString.EqualsLiteral("PLAYING")) {
|
||||
aPlayStatus = ControlPlayStatus::PLAYSTATUS_PLAYING;
|
||||
} else if (aString.EqualsLiteral("PAUSED")) {
|
||||
aPlayStatus = ControlPlayStatus::PLAYSTATUS_PAUSED;
|
||||
} else if (aString.EqualsLiteral("FWD_SEEK")) {
|
||||
aPlayStatus = ControlPlayStatus::PLAYSTATUS_FWD_SEEK;
|
||||
} else if (aString.EqualsLiteral("REV_SEEK")) {
|
||||
aPlayStatus = ControlPlayStatus::PLAYSTATUS_REV_SEEK;
|
||||
} else if (aString.EqualsLiteral("ERROR")) {
|
||||
aPlayStatus = ControlPlayStatus::PLAYSTATUS_ERROR;
|
||||
} else {
|
||||
BT_LOGR("Invalid play status: %s", NS_ConvertUTF16toUTF8(aString).get());
|
||||
aPlayStatus = ControlPlayStatus::PLAYSTATUS_UNKNOWN;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
StringToPropertyType(const nsAString& aString, BluetoothPropertyType& aType)
|
||||
{
|
||||
@ -205,15 +245,18 @@ UuidToString(const BluetoothUuid& aUuid, nsAString& aString)
|
||||
aString.AssignLiteral(uuidStr);
|
||||
}
|
||||
|
||||
void
|
||||
nsresult
|
||||
StringToUuid(const nsAString& aString, BluetoothUuid& aUuid)
|
||||
{
|
||||
uint32_t uuid0, uuid4;
|
||||
uint16_t uuid1, uuid2, uuid3, uuid5;
|
||||
|
||||
sscanf(NS_ConvertUTF16toUTF8(aString).get(),
|
||||
"%08x-%04hx-%04hx-%04hx-%08x%04hx",
|
||||
&uuid0, &uuid1, &uuid2, &uuid3, &uuid4, &uuid5);
|
||||
auto res = sscanf(NS_ConvertUTF16toUTF8(aString).get(),
|
||||
"%08x-%04hx-%04hx-%04hx-%08x%04hx",
|
||||
&uuid0, &uuid1, &uuid2, &uuid3, &uuid4, &uuid5);
|
||||
if (res == EOF || res < 6) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
uuid0 = htonl(uuid0);
|
||||
uuid1 = htons(uuid1);
|
||||
@ -228,6 +271,8 @@ StringToUuid(const nsAString& aString, BluetoothUuid& aUuid)
|
||||
memcpy(&aUuid.mUuid[8], &uuid3, sizeof(uint16_t));
|
||||
memcpy(&aUuid.mUuid[10], &uuid4, sizeof(uint32_t));
|
||||
memcpy(&aUuid.mUuid[14], &uuid5, sizeof(uint16_t));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -37,9 +37,20 @@ StringToAddress(const nsAString& aString, BluetoothAddress& aAddress);
|
||||
// Pin code/string conversion
|
||||
//
|
||||
|
||||
nsresult
|
||||
PinCodeToString(const BluetoothPinCode& aPinCode, nsAString& aString);
|
||||
|
||||
nsresult
|
||||
StringToPinCode(const nsAString& aString, BluetoothPinCode& aPinCode);
|
||||
|
||||
//
|
||||
// Play status/string conversion
|
||||
//
|
||||
|
||||
nsresult
|
||||
StringToControlPlayStatus(const nsAString& aString,
|
||||
ControlPlayStatus& aPlayStatus);
|
||||
|
||||
//
|
||||
// Property type/string conversion
|
||||
//
|
||||
@ -89,7 +100,7 @@ UuidToString(const BluetoothUuid& aUuid, nsAString& aString);
|
||||
* Note: This utility function is used by gecko internal only to convert uuid
|
||||
* string created by gecko back to BluetoothUuid representation.
|
||||
*/
|
||||
void
|
||||
nsresult
|
||||
StringToUuid(const nsAString& aString, BluetoothUuid& aUuid);
|
||||
|
||||
/**
|
||||
|
@ -366,12 +366,16 @@ BluetoothAdapter::Cleanup()
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
NS_ENSURE_TRUE_VOID(bs);
|
||||
|
||||
nsString uuid;
|
||||
nsString uuidStr;
|
||||
for (uint32_t i = 0; i < mLeScanHandleArray.Length(); ++i) {
|
||||
mLeScanHandleArray[i]->GetLeScanUuid(uuid);
|
||||
mLeScanHandleArray[i]->GetLeScanUuid(uuidStr);
|
||||
RefPtr<BluetoothVoidReplyRunnable> results =
|
||||
new BluetoothVoidReplyRunnable(nullptr);
|
||||
bs->StopLeScanInternal(uuid, results);
|
||||
|
||||
BluetoothUuid uuid;
|
||||
if (NS_SUCCEEDED(StringToUuid(uuidStr, uuid))) {
|
||||
bs->StopLeScanInternal(uuid, results);
|
||||
}
|
||||
}
|
||||
mLeScanHandleArray.Clear();
|
||||
}
|
||||
@ -405,13 +409,24 @@ BluetoothAdapter::GetPairedDeviceProperties(
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
NS_ENSURE_TRUE_VOID(bs);
|
||||
|
||||
nsTArray<BluetoothAddress> deviceAddresses;
|
||||
deviceAddresses.SetLength(aDeviceAddresses.Length());
|
||||
|
||||
for (size_t i = 0; i < deviceAddresses.Length(); ++i) {
|
||||
auto rv = StringToAddress(aDeviceAddresses[i], deviceAddresses[i]);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("GetPairedDeviceProperties failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<BluetoothVoidReplyRunnable> results =
|
||||
new BluetoothVoidReplyRunnable(nullptr);
|
||||
|
||||
nsresult rv =
|
||||
bs->GetPairedDevicePropertiesInternal(aDeviceAddresses, results);
|
||||
auto rv = bs->GetPairedDevicePropertiesInternal(deviceAddresses, results);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("GetPairedDeviceProperties failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -671,6 +686,16 @@ BluetoothAdapter::StartLeScan(const nsTArray<nsString>& aServiceUuids,
|
||||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
nsTArray<BluetoothUuid> serviceUuids;
|
||||
serviceUuids.SetLength(aServiceUuids.Length());
|
||||
|
||||
for (size_t i = 0; i < serviceUuids.Length(); ++i) {
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(aServiceUuids[i],
|
||||
serviceUuids[i])),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
}
|
||||
|
||||
BT_ENSURE_TRUE_REJECT(mState == BluetoothAdapterState::Enabled,
|
||||
promise,
|
||||
NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
@ -680,7 +705,7 @@ BluetoothAdapter::StartLeScan(const nsTArray<nsString>& aServiceUuids,
|
||||
|
||||
RefPtr<BluetoothReplyRunnable> result =
|
||||
new StartLeScanTask(this, promise, aServiceUuids);
|
||||
bs->StartLeScanInternal(aServiceUuids, result);
|
||||
bs->StartLeScanInternal(serviceUuids, result);
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
@ -710,10 +735,16 @@ BluetoothAdapter::StopLeScan(BluetoothDiscoveryHandle& aDiscoveryHandle,
|
||||
promise,
|
||||
NS_ERROR_DOM_BLUETOOTH_DONE);
|
||||
|
||||
nsString scanUuid;
|
||||
aDiscoveryHandle.GetLeScanUuid(scanUuid);
|
||||
nsString scanUuidStr;
|
||||
aDiscoveryHandle.GetLeScanUuid(scanUuidStr);
|
||||
|
||||
BluetoothUuid scanUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(scanUuidStr, scanUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
RefPtr<BluetoothReplyRunnable> result =
|
||||
new StopLeScanTask(this, promise, scanUuid);
|
||||
new StopLeScanTask(this, promise, scanUuidStr);
|
||||
bs->StopLeScanInternal(scanUuid, result);
|
||||
|
||||
return promise.forget();
|
||||
@ -851,11 +882,13 @@ BluetoothAdapter::PairUnpair(bool aPair, const nsAString& aDeviceAddress,
|
||||
|
||||
/**
|
||||
* Ensure
|
||||
* - device address is not empty,
|
||||
* - device address is valid,
|
||||
* - adapter is already enabled, and
|
||||
* - BluetoothService is available.
|
||||
*/
|
||||
BT_ENSURE_TRUE_REJECT(!aDeviceAddress.IsEmpty(),
|
||||
BluetoothAddress deviceAddress;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToAddress(aDeviceAddress,
|
||||
deviceAddress)),
|
||||
promise,
|
||||
NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
BT_ENSURE_TRUE_REJECT(mState == BluetoothAdapterState::Enabled,
|
||||
@ -867,10 +900,10 @@ BluetoothAdapter::PairUnpair(bool aPair, const nsAString& aDeviceAddress,
|
||||
nsresult rv;
|
||||
if (aPair) {
|
||||
rv = bs->CreatePairedDeviceInternal(
|
||||
aDeviceAddress, kCreatePairedDeviceTimeout,
|
||||
deviceAddress, kCreatePairedDeviceTimeout,
|
||||
new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
} else {
|
||||
rv = bs->RemoveDeviceInternal(aDeviceAddress,
|
||||
rv = bs->RemoveDeviceInternal(deviceAddress,
|
||||
new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
}
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(rv), promise, NS_ERROR_DOM_OPERATION_ERR);
|
||||
@ -1660,6 +1693,12 @@ BluetoothAdapter::Connect(BluetoothDevice& aDevice,
|
||||
|
||||
nsAutoString address;
|
||||
aDevice.GetAddress(address);
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(address, deviceAddress))) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t deviceClass = aDevice.Cod()->ToUint32();
|
||||
uint16_t serviceUuid = 0;
|
||||
if (aServiceUuid.WasPassed()) {
|
||||
@ -1671,7 +1710,7 @@ BluetoothAdapter::Connect(BluetoothDevice& aDevice,
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
bs->Connect(address, deviceClass, serviceUuid, results);
|
||||
bs->Connect(deviceAddress, deviceClass, serviceUuid, results);
|
||||
|
||||
return request.forget();
|
||||
}
|
||||
@ -1693,6 +1732,12 @@ BluetoothAdapter::Disconnect(BluetoothDevice& aDevice,
|
||||
|
||||
nsAutoString address;
|
||||
aDevice.GetAddress(address);
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(address, deviceAddress))) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint16_t serviceUuid = 0;
|
||||
if (aServiceUuid.WasPassed()) {
|
||||
serviceUuid = aServiceUuid.Value();
|
||||
@ -1703,7 +1748,7 @@ BluetoothAdapter::Disconnect(BluetoothDevice& aDevice,
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
bs->Disconnect(address, serviceUuid, results);
|
||||
bs->Disconnect(deviceAddress, serviceUuid, results);
|
||||
|
||||
return request.forget();
|
||||
}
|
||||
@ -1722,6 +1767,13 @@ BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
|
||||
RefPtr<BluetoothVoidReplyRunnable> results =
|
||||
new BluetoothVoidReplyRunnable(request);
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
auto rv = StringToAddress(aDeviceAddress, deviceAddress);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
@ -1730,7 +1782,7 @@ BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
// In-process transfer
|
||||
bs->SendFile(aDeviceAddress, &aBlob, results);
|
||||
bs->SendFile(deviceAddress, &aBlob, results);
|
||||
} else {
|
||||
ContentChild *cc = ContentChild::GetSingleton();
|
||||
if (!cc) {
|
||||
@ -1744,7 +1796,7 @@ BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bs->SendFile(aDeviceAddress, nullptr, actor, results);
|
||||
bs->SendFile(deviceAddress, nullptr, actor, results);
|
||||
}
|
||||
|
||||
return request.forget();
|
||||
@ -1764,12 +1816,19 @@ BluetoothAdapter::StopSendingFile(
|
||||
RefPtr<BluetoothVoidReplyRunnable> results =
|
||||
new BluetoothVoidReplyRunnable(request);
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
auto rv = StringToAddress(aDeviceAddress, deviceAddress);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
bs->StopSendingFile(aDeviceAddress, results);
|
||||
bs->StopSendingFile(deviceAddress, results);
|
||||
|
||||
return request.forget();
|
||||
}
|
||||
@ -1788,12 +1847,19 @@ BluetoothAdapter::ConfirmReceivingFile(const nsAString& aDeviceAddress,
|
||||
RefPtr<BluetoothVoidReplyRunnable> results =
|
||||
new BluetoothVoidReplyRunnable(request);
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
auto rv = StringToAddress(aDeviceAddress, deviceAddress);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
bs->ConfirmReceivingFile(aDeviceAddress, aConfirmation, results);
|
||||
bs->ConfirmReceivingFile(deviceAddress, aConfirmation, results);
|
||||
|
||||
return request.forget();
|
||||
}
|
||||
@ -1991,6 +2057,13 @@ BluetoothAdapter::SendMediaPlayStatus(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ControlPlayStatus playStatus;
|
||||
auto rv = StringToControlPlayStatus(aMediaPlayStatus.mPlayStatus, playStatus);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<DOMRequest> request = new DOMRequest(win);
|
||||
RefPtr<BluetoothReplyRunnable> results =
|
||||
new BluetoothVoidReplyRunnable(request);
|
||||
@ -2002,7 +2075,7 @@ BluetoothAdapter::SendMediaPlayStatus(
|
||||
}
|
||||
bs->SendPlayStatus(aMediaPlayStatus.mDuration,
|
||||
aMediaPlayStatus.mPosition,
|
||||
aMediaPlayStatus.mPlayStatus,
|
||||
playStatus,
|
||||
results);
|
||||
|
||||
return request.forget();
|
||||
|
@ -187,10 +187,13 @@ BluetoothDevice::FetchUuids(ErrorResult& aRv)
|
||||
// Ensure BluetoothService is available
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothAddress address;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToAddress(mAddress, address)),
|
||||
promise,
|
||||
NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(
|
||||
bs->FetchUuidsInternal(mAddress, new FetchUuidsTask(promise, this))),
|
||||
bs->FetchUuidsInternal(address, new FetchUuidsTask(promise, this))),
|
||||
promise, NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
return promise.forget();
|
||||
|
@ -112,6 +112,17 @@ BluetoothGatt::Connect(ErrorResult& aRv)
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
BluetoothAddress deviceAddr;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
if (mAppUuid.IsEmpty()) {
|
||||
nsresult rv = GenerateUuid(mAppUuid);
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(rv) && !mAppUuid.IsEmpty(),
|
||||
@ -122,7 +133,7 @@ BluetoothGatt::Connect(ErrorResult& aRv)
|
||||
|
||||
UpdateConnectionState(BluetoothConnectionState::Connecting);
|
||||
bs->ConnectGattClientInternal(
|
||||
mAppUuid, mDeviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
appUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
@ -147,9 +158,20 @@ BluetoothGatt::Disconnect(ErrorResult& aRv)
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
BluetoothAddress deviceAddr;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
UpdateConnectionState(BluetoothConnectionState::Disconnecting);
|
||||
bs->DisconnectGattClientInternal(
|
||||
mAppUuid, mDeviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
appUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
@ -196,8 +218,14 @@ BluetoothGatt::ReadRemoteRssi(ErrorResult& aRv)
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothAddress deviceAddr;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
bs->GattClientReadRemoteRssiInternal(
|
||||
mClientIf, mDeviceAddr, new ReadRemoteRssiTask(promise));
|
||||
mClientIf, deviceAddr, new ReadRemoteRssiTask(promise));
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
@ -214,6 +242,11 @@ BluetoothGatt::DiscoverServices(ErrorResult& aRv)
|
||||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
mConnectionState == BluetoothConnectionState::Connected &&
|
||||
!mDiscoveringServices,
|
||||
@ -228,7 +261,7 @@ BluetoothGatt::DiscoverServices(ErrorResult& aRv)
|
||||
BluetoothGattBinding::ClearCachedServicesValue(this);
|
||||
|
||||
bs->DiscoverGattServicesInternal(
|
||||
mAppUuid, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
appUuid, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
|
@ -154,8 +154,14 @@ BluetoothGattCharacteristic::StartNotifications(ErrorResult& aRv)
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
BT_ENSURE_TRUE_REJECT(mService, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
|
||||
appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
bs->GattClientStartNotificationsInternal(
|
||||
mService->GetAppUuid(), mService->GetServiceId(), mCharId,
|
||||
appUuid, mService->GetServiceId(), mCharId,
|
||||
new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
@ -181,8 +187,14 @@ BluetoothGattCharacteristic::StopNotifications(ErrorResult& aRv)
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
BT_ENSURE_TRUE_REJECT(mService, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
|
||||
appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
bs->GattClientStopNotificationsInternal(
|
||||
mService->GetAppUuid(), mService->GetServiceId(), mCharId,
|
||||
appUuid, mService->GetServiceId(), mCharId,
|
||||
new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
@ -362,8 +374,14 @@ BluetoothGattCharacteristic::ReadValue(ErrorResult& aRv)
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
|
||||
appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
bs->GattClientReadCharacteristicValueInternal(
|
||||
mService->GetAppUuid(), mService->GetServiceId(), mCharId,
|
||||
appUuid, mService->GetServiceId(), mCharId,
|
||||
new ReadValueTask(this, promise));
|
||||
|
||||
return promise.forget();
|
||||
@ -405,9 +423,14 @@ BluetoothGattCharacteristic::WriteValue(const ArrayBuffer& aValue,
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
|
||||
appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
bs->GattClientWriteCharacteristicValueInternal(
|
||||
mService->GetAppUuid(), mService->GetServiceId(),
|
||||
mCharId, mWriteType, value,
|
||||
appUuid, mService->GetServiceId(), mCharId, mWriteType, value,
|
||||
new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
|
@ -232,6 +232,12 @@ BluetoothGattDescriptor::ReadValue(ErrorResult& aRv)
|
||||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(
|
||||
mCharacteristic->Service()->GetAppUuid(), appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
if (mAttRole == ATT_SERVER_ROLE) {
|
||||
promise->MaybeResolve(mValue);
|
||||
return promise.forget();
|
||||
@ -241,7 +247,7 @@ BluetoothGattDescriptor::ReadValue(ErrorResult& aRv)
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bs->GattClientReadDescriptorValueInternal(
|
||||
mCharacteristic->Service()->GetAppUuid(),
|
||||
appUuid,
|
||||
mCharacteristic->Service()->GetServiceId(),
|
||||
mCharacteristic->GetCharacteristicId(),
|
||||
mDescriptorId,
|
||||
@ -263,6 +269,12 @@ BluetoothGattDescriptor::WriteValue(
|
||||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(
|
||||
mCharacteristic->Service()->GetAppUuid(), appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
aValue.ComputeLengthAndData();
|
||||
|
||||
if (mAttRole == ATT_SERVER_ROLE) {
|
||||
@ -280,7 +292,7 @@ BluetoothGattDescriptor::WriteValue(
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bs->GattClientWriteDescriptorValueInternal(
|
||||
mCharacteristic->Service()->GetAppUuid(),
|
||||
appUuid,
|
||||
mCharacteristic->Service()->GetServiceId(),
|
||||
mCharacteristic->GetCharacteristicId(),
|
||||
mDescriptorId,
|
||||
|
@ -319,12 +319,23 @@ BluetoothGattServer::Connect(const nsAString& aAddress, ErrorResult& aRv)
|
||||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
BluetoothAddress address;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(aAddress, address)),
|
||||
promise,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bs->GattServerConnectPeripheralInternal(
|
||||
mAppUuid, aAddress, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
appUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
@ -341,12 +352,23 @@ BluetoothGattServer::Disconnect(const nsAString& aAddress, ErrorResult& aRv)
|
||||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
BluetoothAddress address;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(aAddress, address)),
|
||||
promise,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bs->GattServerDisconnectPeripheralInternal(
|
||||
mAppUuid, aAddress, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
appUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
@ -372,8 +394,13 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bs->GattServerAddIncludedServiceInternal(
|
||||
mServer->mAppUuid,
|
||||
appUuid,
|
||||
mService->GetServiceHandle(),
|
||||
mIncludedService->GetServiceHandle(),
|
||||
GetReply());
|
||||
@ -408,10 +435,15 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BluetoothUuid uuid;
|
||||
mCharacteristic->GetUuid(uuid);
|
||||
bs->GattServerAddCharacteristicInternal(
|
||||
mServer->mAppUuid,
|
||||
appUuid,
|
||||
mService->GetServiceHandle(),
|
||||
uuid,
|
||||
mCharacteristic->GetPermissions(),
|
||||
@ -450,10 +482,15 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BluetoothUuid uuid;
|
||||
mDescriptor->GetUuid(uuid);
|
||||
bs->GattServerAddDescriptorInternal(
|
||||
mServer->mAppUuid,
|
||||
appUuid,
|
||||
mService->GetServiceHandle(),
|
||||
mCharacteristic->GetCharacteristicHandle(),
|
||||
uuid,
|
||||
@ -489,8 +526,13 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bs->GattServerStartServiceInternal(
|
||||
mServer->mAppUuid,
|
||||
appUuid,
|
||||
mService->GetServiceHandle(),
|
||||
GetReply());
|
||||
|
||||
@ -616,8 +658,14 @@ private:
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT_VOID(bs, mPromise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT_VOID(NS_SUCCEEDED(StringToUuid(mServer->mAppUuid,
|
||||
appUuid)),
|
||||
mPromise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
bs->GattServerRemoveServiceInternal(
|
||||
mServer->mAppUuid,
|
||||
appUuid,
|
||||
mService->GetServiceHandle(),
|
||||
new CancelAddServiceTask(mServer, mService, mPromise));
|
||||
}
|
||||
@ -704,7 +752,12 @@ BluetoothGattServer::AddService(BluetoothGattService& aService,
|
||||
|
||||
mPendingService = &aService;
|
||||
|
||||
bs->GattServerAddServiceInternal(mAppUuid,
|
||||
BluetoothUuid appUuid;
|
||||
if (NS_FAILED(StringToUuid(mAppUuid, appUuid))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bs->GattServerAddServiceInternal(appUuid,
|
||||
mPendingService->GetServiceId(),
|
||||
mPendingService->GetHandleCount(),
|
||||
new AddServiceTask(this,
|
||||
@ -772,8 +825,13 @@ BluetoothGattServer::RemoveService(BluetoothGattService& aService,
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
bs->GattServerRemoveServiceInternal(
|
||||
mAppUuid, aService.GetServiceHandle(), new RemoveServiceTask(this,
|
||||
appUuid, aService.GetServiceHandle(), new RemoveServiceTask(this,
|
||||
&aService,
|
||||
promise));
|
||||
|
||||
@ -798,6 +856,17 @@ BluetoothGattServer::NotifyCharacteristicChanged(
|
||||
|
||||
BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
BluetoothAddress address;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(aAddress, address)),
|
||||
promise,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
@ -808,7 +877,7 @@ BluetoothGattServer::NotifyCharacteristicChanged(
|
||||
NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bs->GattServerSendIndicationInternal(
|
||||
mAppUuid, aAddress, aCharacteristic.GetCharacteristicHandle(), aConfirm,
|
||||
appUuid, address, aCharacteristic.GetCharacteristicHandle(), aConfirm,
|
||||
aCharacteristic.GetValue(),
|
||||
new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
@ -830,6 +899,17 @@ BluetoothGattServer::SendResponse(const nsAString& aAddress,
|
||||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
BluetoothAddress address;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(aAddress, address)),
|
||||
promise,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
RequestData* requestData;
|
||||
@ -861,8 +941,8 @@ BluetoothGattServer::SendResponse(const nsAString& aAddress,
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bs->GattServerSendResponseInternal(
|
||||
mAppUuid,
|
||||
aAddress,
|
||||
appUuid,
|
||||
address,
|
||||
aStatus,
|
||||
aRequestId,
|
||||
response,
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "BluetoothPairingHandle.h"
|
||||
#include "BluetoothReplyRunnable.h"
|
||||
#include "BluetoothService.h"
|
||||
#include "BluetoothUtils.h"
|
||||
|
||||
#include "mozilla/dom/BluetoothPairingHandleBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
@ -79,10 +80,21 @@ BluetoothPairingHandle::SetPinCode(const nsAString& aPinCode, ErrorResult& aRv)
|
||||
promise,
|
||||
NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToAddress(mDeviceAddress,
|
||||
deviceAddress)),
|
||||
promise,
|
||||
NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
|
||||
BluetoothPinCode pinCode;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToPinCode(aPinCode, pinCode)),
|
||||
promise,
|
||||
NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bs->PinReplyInternal(mDeviceAddress, true /* accept */, aPinCode,
|
||||
bs->PinReplyInternal(deviceAddress, true /* accept */, pinCode,
|
||||
new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
@ -108,12 +120,18 @@ BluetoothPairingHandle::Accept(ErrorResult& aRv)
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToAddress(mDeviceAddress,
|
||||
deviceAddress)),
|
||||
promise,
|
||||
NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
|
||||
BluetoothSspVariant variant;
|
||||
BT_ENSURE_TRUE_REJECT(GetSspVariant(variant),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
bs->SspReplyInternal(mDeviceAddress, variant, true /* aAccept */,
|
||||
bs->SspReplyInternal(deviceAddress, variant, true /* aAccept */,
|
||||
new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
@ -131,11 +149,18 @@ BluetoothPairingHandle::Reject(ErrorResult& aRv)
|
||||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
BluetoothAddress deviceAddress;
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToAddress(mDeviceAddress,
|
||||
deviceAddress)),
|
||||
promise,
|
||||
NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
if (mType.EqualsLiteral(PAIRING_REQ_TYPE_ENTERPINCODE)) { // Pin request
|
||||
bs->PinReplyInternal(mDeviceAddress, false /* aAccept */, EmptyString(),
|
||||
bs->PinReplyInternal(deviceAddress, false /* aAccept */,
|
||||
BluetoothPinCode(),
|
||||
new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
} else { // Ssp request
|
||||
BluetoothSspVariant variant;
|
||||
@ -143,7 +168,7 @@ BluetoothPairingHandle::Reject(ErrorResult& aRv)
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
bs->SspReplyInternal(mDeviceAddress, variant, false /* aAccept */,
|
||||
bs->SspReplyInternal(deviceAddress, variant, false /* aAccept */,
|
||||
new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,29 @@
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::bluetooth::BluetoothAddress>
|
||||
{
|
||||
typedef mozilla::dom::bluetooth::BluetoothAddress paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
for (size_t i = 0; i < MOZ_ARRAY_LENGTH(aParam.mAddr); ++i) {
|
||||
WriteParam(aMsg, aParam.mAddr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
for (size_t i = 0; i < MOZ_ARRAY_LENGTH(aResult->mAddr); ++i) {
|
||||
if (!ReadParam(aMsg, aIter, aResult->mAddr + i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::bluetooth::BluetoothObjectType>
|
||||
: public ContiguousEnumSerializer<
|
||||
@ -20,6 +43,42 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothObjectType>
|
||||
mozilla::dom::bluetooth::NUM_TYPE>
|
||||
{ };
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::bluetooth::BluetoothPinCode>
|
||||
{
|
||||
typedef mozilla::dom::bluetooth::BluetoothPinCode paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mLength);
|
||||
for (uint8_t i = 0; i < aParam.mLength; ++i) {
|
||||
WriteParam(aMsg, aParam.mPinCode[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mLength)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto maxLength = MOZ_ARRAY_LENGTH(aResult->mPinCode);
|
||||
|
||||
if (aResult->mLength > maxLength) {
|
||||
return false;
|
||||
}
|
||||
for (uint8_t i = 0; i < aResult->mLength; ++i) {
|
||||
if (!ReadParam(aMsg, aIter, aResult->mPinCode + i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (uint8_t i = aResult->mLength; i < maxLength; ++i) {
|
||||
aResult->mPinCode[i] = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::bluetooth::BluetoothSspVariant>
|
||||
: public ContiguousEnumSerializer<
|
||||
@ -198,6 +257,42 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothGattResponse>
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::bluetooth::ControlPlayStatus>
|
||||
{
|
||||
typedef mozilla::dom::bluetooth::ControlPlayStatus paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<uint8_t>(aParam));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
uint8_t value;
|
||||
if (!ReadParam(aMsg, aIter, &value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mozilla::dom::bluetooth::ControlPlayStatus result =
|
||||
static_cast<mozilla::dom::bluetooth::ControlPlayStatus>(value);
|
||||
|
||||
switch (result) {
|
||||
case mozilla::dom::bluetooth::ControlPlayStatus::PLAYSTATUS_STOPPED:
|
||||
case mozilla::dom::bluetooth::ControlPlayStatus::PLAYSTATUS_PLAYING:
|
||||
case mozilla::dom::bluetooth::ControlPlayStatus::PLAYSTATUS_PAUSED:
|
||||
case mozilla::dom::bluetooth::ControlPlayStatus::PLAYSTATUS_FWD_SEEK:
|
||||
case mozilla::dom::bluetooth::ControlPlayStatus::PLAYSTATUS_REV_SEEK:
|
||||
case mozilla::dom::bluetooth::ControlPlayStatus::PLAYSTATUS_ERROR:
|
||||
*aResult = result;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // mozilla_dom_bluetooth_ipc_BluetoothMessageUtils_h
|
||||
|
@ -599,7 +599,7 @@ BluetoothRequestParent::DoRequest(const SetPinCodeRequest& aRequest)
|
||||
MOZ_ASSERT(mService);
|
||||
MOZ_ASSERT(mRequestType == Request::TSetPinCodeRequest);
|
||||
|
||||
mService->SetPinCodeInternal(aRequest.path(),
|
||||
mService->SetPinCodeInternal(aRequest.address(),
|
||||
aRequest.pincode(),
|
||||
mReplyRunnable.get());
|
||||
|
||||
@ -612,7 +612,7 @@ BluetoothRequestParent::DoRequest(const SetPasskeyRequest& aRequest)
|
||||
MOZ_ASSERT(mService);
|
||||
MOZ_ASSERT(mRequestType == Request::TSetPasskeyRequest);
|
||||
|
||||
mService->SetPasskeyInternal(aRequest.path(),
|
||||
mService->SetPasskeyInternal(aRequest.address(),
|
||||
aRequest.passkey(),
|
||||
mReplyRunnable.get());
|
||||
|
||||
@ -626,7 +626,7 @@ BluetoothRequestParent::DoRequest(const ConfirmPairingConfirmationRequest&
|
||||
MOZ_ASSERT(mService);
|
||||
MOZ_ASSERT(mRequestType == Request::TConfirmPairingConfirmationRequest);
|
||||
|
||||
mService->SetPairingConfirmationInternal(aRequest.path(),
|
||||
mService->SetPairingConfirmationInternal(aRequest.address(),
|
||||
true,
|
||||
mReplyRunnable.get());
|
||||
|
||||
@ -640,7 +640,7 @@ BluetoothRequestParent::DoRequest(const DenyPairingConfirmationRequest&
|
||||
MOZ_ASSERT(mService);
|
||||
MOZ_ASSERT(mRequestType == Request::TDenyPairingConfirmationRequest);
|
||||
|
||||
mService->SetPairingConfirmationInternal(aRequest.path(),
|
||||
mService->SetPairingConfirmationInternal(aRequest.address(),
|
||||
false,
|
||||
mReplyRunnable.get());
|
||||
|
||||
@ -680,7 +680,7 @@ BluetoothRequestParent::DoRequest(const SendFileRequest& aRequest)
|
||||
MOZ_ASSERT(mService);
|
||||
MOZ_ASSERT(mRequestType == Request::TSendFileRequest);
|
||||
|
||||
mService->SendFile(aRequest.devicePath(),
|
||||
mService->SendFile(aRequest.address(),
|
||||
(BlobParent*)aRequest.blobParent(),
|
||||
(BlobChild*)aRequest.blobChild(),
|
||||
mReplyRunnable.get());
|
||||
@ -694,7 +694,7 @@ BluetoothRequestParent::DoRequest(const StopSendingFileRequest& aRequest)
|
||||
MOZ_ASSERT(mService);
|
||||
MOZ_ASSERT(mRequestType == Request::TStopSendingFileRequest);
|
||||
|
||||
mService->StopSendingFile(aRequest.devicePath(),
|
||||
mService->StopSendingFile(aRequest.address(),
|
||||
mReplyRunnable.get());
|
||||
|
||||
return true;
|
||||
@ -706,7 +706,7 @@ BluetoothRequestParent::DoRequest(const ConfirmReceivingFileRequest& aRequest)
|
||||
MOZ_ASSERT(mService);
|
||||
MOZ_ASSERT(mRequestType == Request::TConfirmReceivingFileRequest);
|
||||
|
||||
mService->ConfirmReceivingFile(aRequest.devicePath(),
|
||||
mService->ConfirmReceivingFile(aRequest.address(),
|
||||
true,
|
||||
mReplyRunnable.get());
|
||||
return true;
|
||||
@ -718,7 +718,7 @@ BluetoothRequestParent::DoRequest(const DenyReceivingFileRequest& aRequest)
|
||||
MOZ_ASSERT(mService);
|
||||
MOZ_ASSERT(mRequestType == Request::TDenyReceivingFileRequest);
|
||||
|
||||
mService->ConfirmReceivingFile(aRequest.devicePath(),
|
||||
mService->ConfirmReceivingFile(aRequest.address(),
|
||||
false,
|
||||
mReplyRunnable.get());
|
||||
return true;
|
||||
|
@ -129,8 +129,8 @@ BluetoothServiceChildProcess::GetConnectedDevicePropertiesInternal(
|
||||
|
||||
nsresult
|
||||
BluetoothServiceChildProcess::GetPairedDevicePropertiesInternal(
|
||||
const nsTArray<nsString>& aDeviceAddresses,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
const nsTArray<BluetoothAddress>& aDeviceAddresses,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
PairedDevicePropertiesRequest request;
|
||||
request.addresses().AppendElements(aDeviceAddresses);
|
||||
@ -141,9 +141,9 @@ BluetoothServiceChildProcess::GetPairedDevicePropertiesInternal(
|
||||
|
||||
nsresult
|
||||
BluetoothServiceChildProcess::FetchUuidsInternal(
|
||||
const nsAString& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable, FetchUuidsRequest(nsString(aDeviceAddress)));
|
||||
SendRequest(aRunnable, FetchUuidsRequest(aDeviceAddress));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -163,15 +163,15 @@ BluetoothServiceChildProcess::StartDiscoveryInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::StopLeScanInternal(
|
||||
const nsAString& aScanUuid,
|
||||
const BluetoothUuid& aScanUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable, StopLeScanRequest(nsString(aScanUuid)));
|
||||
SendRequest(aRunnable, StopLeScanRequest(aScanUuid));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::StartLeScanInternal(
|
||||
const nsTArray<nsString>& aServiceUuids,
|
||||
const nsTArray<BluetoothUuid>& aServiceUuids,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable, StartLeScanRequest(aServiceUuids));
|
||||
@ -188,22 +188,18 @@ BluetoothServiceChildProcess::SetProperty(BluetoothObjectType aType,
|
||||
|
||||
nsresult
|
||||
BluetoothServiceChildProcess::CreatePairedDeviceInternal(
|
||||
const nsAString& aAddress,
|
||||
int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress, int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
PairRequest(nsString(aAddress), aTimeout));
|
||||
SendRequest(aRunnable, PairRequest(aDeviceAddress, aTimeout));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceChildProcess::RemoveDeviceInternal(
|
||||
const nsAString& aObjectPath,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
UnpairRequest(nsString(aObjectPath)));
|
||||
SendRequest(aRunnable, UnpairRequest(aDeviceAddress));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -224,98 +220,83 @@ BluetoothServiceChildProcess::UpdateSdpRecords(const BluetoothAddress& aDeviceAd
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::PinReplyInternal(
|
||||
const nsAString& aDeviceAddress, bool aAccept,
|
||||
const nsAString& aPinCode, BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress, bool aAccept,
|
||||
const BluetoothPinCode& aPinCode, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
PinReplyRequest(nsString(aDeviceAddress),
|
||||
aAccept,
|
||||
nsString(aPinCode)));
|
||||
SendRequest(aRunnable, PinReplyRequest(aDeviceAddress, aAccept, aPinCode));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::SspReplyInternal(
|
||||
const nsAString& aDeviceAddress, BluetoothSspVariant aVariant,
|
||||
bool aAccept, BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothSspVariant aVariant, bool aAccept,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
SspReplyRequest(nsString(aDeviceAddress),
|
||||
aVariant,
|
||||
aAccept));
|
||||
SendRequest(aRunnable, SspReplyRequest(aDeviceAddress, aVariant, aAccept));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::SetPinCodeInternal(
|
||||
const nsAString& aDeviceAddress,
|
||||
const nsAString& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
SetPinCodeRequest(nsString(aDeviceAddress), nsString(aPinCode)));
|
||||
SendRequest(aRunnable, SetPinCodeRequest(aDeviceAddress, aPinCode));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::SetPasskeyInternal(
|
||||
const nsAString& aDeviceAddress,
|
||||
uint32_t aPasskey,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
uint32_t aPasskey,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
SetPasskeyRequest(nsString(aDeviceAddress), aPasskey));
|
||||
SendRequest(aRunnable, SetPasskeyRequest(aDeviceAddress, aPasskey));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::SetPairingConfirmationInternal(
|
||||
const nsAString& aDeviceAddress,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
if(aConfirm) {
|
||||
SendRequest(aRunnable,
|
||||
ConfirmPairingConfirmationRequest(nsString(aDeviceAddress)));
|
||||
if (aConfirm) {
|
||||
SendRequest(aRunnable, ConfirmPairingConfirmationRequest(aDeviceAddress));
|
||||
} else {
|
||||
SendRequest(aRunnable,
|
||||
DenyPairingConfirmationRequest(nsString(aDeviceAddress)));
|
||||
SendRequest(aRunnable, DenyPairingConfirmationRequest(aDeviceAddress));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::Connect(
|
||||
const nsAString& aDeviceAddress,
|
||||
uint32_t aCod,
|
||||
uint16_t aServiceUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
uint32_t aCod, uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
ConnectRequest(nsString(aDeviceAddress),
|
||||
aCod,
|
||||
aServiceUuid));
|
||||
SendRequest(aRunnable, ConnectRequest(aDeviceAddress, aCod, aServiceUuid));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::Disconnect(
|
||||
const nsAString& aDeviceAddress,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
DisconnectRequest(nsString(aDeviceAddress), aServiceUuid));
|
||||
SendRequest(aRunnable, DisconnectRequest(aDeviceAddress, aServiceUuid));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::SendFile(
|
||||
const nsAString& aDeviceAddress,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BlobParent* aBlobParent,
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
SendFileRequest(nsString(aDeviceAddress), nullptr, aBlobChild));
|
||||
SendRequest(aRunnable, SendFileRequest(aDeviceAddress, nullptr, aBlobChild));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::SendFile(
|
||||
const nsAString& aDeviceAddress,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
Blob* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
@ -325,27 +306,23 @@ BluetoothServiceChildProcess::SendFile(
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::StopSendingFile(
|
||||
const nsAString& aDeviceAddress,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
StopSendingFileRequest(nsString(aDeviceAddress)));
|
||||
SendRequest(aRunnable, StopSendingFileRequest(aDeviceAddress));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::ConfirmReceivingFile(
|
||||
const nsAString& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
const BluetoothAddress& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
if(aConfirm) {
|
||||
SendRequest(aRunnable,
|
||||
ConfirmReceivingFileRequest(nsString(aDeviceAddress)));
|
||||
SendRequest(aRunnable, ConfirmReceivingFileRequest(aDeviceAddress));
|
||||
return;
|
||||
}
|
||||
|
||||
SendRequest(aRunnable,
|
||||
DenyReceivingFileRequest(nsString(aDeviceAddress)));
|
||||
SendRequest(aRunnable, DenyReceivingFileRequest(aDeviceAddress));
|
||||
}
|
||||
|
||||
void
|
||||
@ -564,56 +541,53 @@ BluetoothServiceChildProcess::SendMetaData(const nsAString& aTitle,
|
||||
void
|
||||
BluetoothServiceChildProcess::SendPlayStatus(int64_t aDuration,
|
||||
int64_t aPosition,
|
||||
const nsAString& aPlayStatus,
|
||||
ControlPlayStatus aPlayStatus,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
SendPlayStatusRequest(aDuration, aPosition,
|
||||
nsString(aPlayStatus)));
|
||||
SendPlayStatusRequest(aDuration, aPosition, aPlayStatus));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::ConnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable, ConnectGattClientRequest(nsString(aAppUuid),
|
||||
nsString(aDeviceAddress)));
|
||||
SendRequest(aRunnable, ConnectGattClientRequest(aAppUuid, aDeviceAddress));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::DisconnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
DisconnectGattClientRequest(nsString(aAppUuid), nsString(aDeviceAddress)));
|
||||
DisconnectGattClientRequest(aAppUuid, aDeviceAddress));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::DiscoverGattServicesInternal(
|
||||
const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
|
||||
const BluetoothUuid& aAppUuid, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
DiscoverGattServicesRequest(nsString(aAppUuid)));
|
||||
SendRequest(aRunnable, DiscoverGattServicesRequest(aAppUuid));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattClientStartNotificationsInternal(
|
||||
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattClientStartNotificationsRequest(nsString(aAppUuid), aServId, aCharId));
|
||||
GattClientStartNotificationsRequest(aAppUuid, aServId, aCharId));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattClientStopNotificationsInternal(
|
||||
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattClientStopNotificationsRequest(nsString(aAppUuid), aServId, aCharId));
|
||||
GattClientStopNotificationsRequest(aAppUuid, aServId, aCharId));
|
||||
}
|
||||
|
||||
void
|
||||
@ -625,30 +599,29 @@ BluetoothServiceChildProcess::UnregisterGattClientInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattClientReadRemoteRssiInternal(
|
||||
int aClientIf, const nsAString& aDeviceAddress,
|
||||
int aClientIf, const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattClientReadRemoteRssiRequest(aClientIf,
|
||||
nsString(aDeviceAddress)));
|
||||
GattClientReadRemoteRssiRequest(aClientIf, aDeviceAddress));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattClientReadCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattClientReadCharacteristicValueRequest(nsString(aAppUuid),
|
||||
GattClientReadCharacteristicValueRequest(aAppUuid,
|
||||
aServiceId,
|
||||
aCharacteristicId));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattClientWriteCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattWriteType& aWriteType,
|
||||
@ -656,7 +629,7 @@ BluetoothServiceChildProcess::GattClientWriteCharacteristicValueInternal(
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattClientWriteCharacteristicValueRequest(nsString(aAppUuid),
|
||||
GattClientWriteCharacteristicValueRequest(aAppUuid,
|
||||
aServiceId,
|
||||
aCharacteristicId,
|
||||
aWriteType,
|
||||
@ -665,14 +638,14 @@ BluetoothServiceChildProcess::GattClientWriteCharacteristicValueInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattClientReadDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattClientReadDescriptorValueRequest(nsString(aAppUuid),
|
||||
GattClientReadDescriptorValueRequest(aAppUuid,
|
||||
aServiceId,
|
||||
aCharacteristicId,
|
||||
aDescriptorId));
|
||||
@ -680,7 +653,7 @@ BluetoothServiceChildProcess::GattClientReadDescriptorValueInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattClientWriteDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -688,7 +661,7 @@ BluetoothServiceChildProcess::GattClientWriteDescriptorValueInternal(
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattClientWriteDescriptorValueRequest(nsString(aAppUuid),
|
||||
GattClientWriteDescriptorValueRequest(aAppUuid,
|
||||
aServiceId,
|
||||
aCharacteristicId,
|
||||
aDescriptorId,
|
||||
@ -697,24 +670,22 @@ BluetoothServiceChildProcess::GattClientWriteDescriptorValueInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerConnectPeripheralRequest(nsString(aAppUuid),
|
||||
nsString(aAddress)));
|
||||
GattServerConnectPeripheralRequest(aAppUuid, aAddress));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerDisconnectPeripheralRequest(nsString(aAppUuid),
|
||||
nsString(aAddress)));
|
||||
GattServerDisconnectPeripheralRequest(aAppUuid, aAddress));
|
||||
}
|
||||
|
||||
void
|
||||
@ -726,31 +697,31 @@ BluetoothServiceChildProcess::UnregisterGattServerInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerAddServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
uint16_t aHandleCount,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerAddServiceRequest(nsString(aAppUuid), aServiceId, aHandleCount));
|
||||
GattServerAddServiceRequest(aAppUuid, aServiceId, aHandleCount));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerAddIncludedServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aIncludedServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerAddIncludedServiceRequest(nsString(aAppUuid),
|
||||
GattServerAddIncludedServiceRequest(aAppUuid,
|
||||
aServiceHandle,
|
||||
aIncludedServiceHandle));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerAddCharacteristicInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothUuid& aCharacteristicUuid,
|
||||
BluetoothGattAttrPerm aPermissions,
|
||||
@ -758,7 +729,7 @@ BluetoothServiceChildProcess::GattServerAddCharacteristicInternal(
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerAddCharacteristicRequest(nsString(aAppUuid),
|
||||
GattServerAddCharacteristicRequest(aAppUuid,
|
||||
aServiceHandle,
|
||||
aCharacteristicUuid,
|
||||
aPermissions,
|
||||
@ -767,7 +738,7 @@ BluetoothServiceChildProcess::GattServerAddCharacteristicInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerAddDescriptorInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
const BluetoothUuid& aDescriptorUuid,
|
||||
@ -775,7 +746,7 @@ BluetoothServiceChildProcess::GattServerAddDescriptorInternal(
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerAddDescriptorRequest(nsString(aAppUuid),
|
||||
GattServerAddDescriptorRequest(aAppUuid,
|
||||
aServiceHandle,
|
||||
aCharacteristicHandle,
|
||||
aDescriptorUuid,
|
||||
@ -784,60 +755,63 @@ BluetoothServiceChildProcess::GattServerAddDescriptorInternal(
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerRemoveServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerRemoveServiceRequest(nsString(aAppUuid), aServiceHandle));
|
||||
GattServerRemoveServiceRequest(aAppUuid, aServiceHandle));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerStartServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerStartServiceRequest(nsString(aAppUuid), aServiceHandle));
|
||||
GattServerStartServiceRequest(aAppUuid, aServiceHandle));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerStopServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerStopServiceRequest(nsString(aAppUuid), aServiceHandle));
|
||||
GattServerStopServiceRequest(aAppUuid, aServiceHandle));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerSendResponseRequest(
|
||||
nsString(aAppUuid), nsString(aAddress), aStatus, aRequestId, aRsp));
|
||||
GattServerSendResponseRequest(aAppUuid,
|
||||
aAddress,
|
||||
aStatus,
|
||||
aRequestId,
|
||||
aRsp));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerSendIndicationRequest(nsString(aAppUuid),
|
||||
nsString(aAddress),
|
||||
GattServerSendIndicationRequest(aAppUuid,
|
||||
aAddress,
|
||||
aCharacteristicHandle,
|
||||
aConfirm,
|
||||
aValue));
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
StopInternal(BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult
|
||||
GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses,
|
||||
GetPairedDevicePropertiesInternal(const nsTArray<BluetoothAddress>& aDeviceAddresses,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
override;
|
||||
|
||||
@ -50,7 +50,7 @@ public:
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
override;
|
||||
virtual nsresult
|
||||
FetchUuidsInternal(const nsAString& aDeviceAddress,
|
||||
FetchUuidsInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
@ -60,11 +60,11 @@ public:
|
||||
StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
StopLeScanInternal(const nsAString& aScanUuid,
|
||||
StopLeScanInternal(const BluetoothUuid& aScanUuid,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
|
||||
StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult
|
||||
@ -73,12 +73,12 @@ public:
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult
|
||||
CreatePairedDeviceInternal(const nsAString& aAddress,
|
||||
CreatePairedDeviceInternal(const BluetoothAddress& aDeviceAddress,
|
||||
int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult
|
||||
RemoveDeviceInternal(const nsAString& aObjectPath,
|
||||
RemoveDeviceInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult
|
||||
@ -91,61 +91,61 @@ public:
|
||||
BluetoothProfileManagerBase* aManager) override;
|
||||
|
||||
virtual void
|
||||
SetPinCodeInternal(const nsAString& aDeviceAddress,
|
||||
const nsAString& aPinCode,
|
||||
SetPinCodeInternal(const BluetoothAddress& aDeviceAddress,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
SetPasskeyInternal(const nsAString& aDeviceAddress,
|
||||
SetPasskeyInternal(const BluetoothAddress& aDeviceAddress,
|
||||
uint32_t aPasskey,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
SetPairingConfirmationInternal(const nsAString& aDeviceAddress,
|
||||
SetPairingConfirmationInternal(const BluetoothAddress& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
override;
|
||||
|
||||
virtual void
|
||||
PinReplyInternal(const nsAString& aDeviceAddress,
|
||||
PinReplyInternal(const BluetoothAddress& aDeviceAddress,
|
||||
bool aAccept,
|
||||
const nsAString& aPinCode,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
SspReplyInternal(const nsAString& aDeviceAddress,
|
||||
SspReplyInternal(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothSspVariant aVariant,
|
||||
bool aAccept,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
Connect(const nsAString& aDeviceAddress,
|
||||
Connect(const BluetoothAddress& aDeviceAddress,
|
||||
uint32_t aCod,
|
||||
uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
Disconnect(const nsAString& aDeviceAddress,
|
||||
Disconnect(const BluetoothAddress& aDeviceAddress,
|
||||
uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
BlobParent* aBlobParent,
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
SendFile(const BluetoothAddress& aDeviceAddress,
|
||||
Blob* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
StopSendingFile(const nsAString& aDeviceAddress,
|
||||
StopSendingFile(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
ConfirmReceivingFile(const nsAString& aDeviceAddress,
|
||||
ConfirmReceivingFile(const BluetoothAddress& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
@ -267,7 +267,7 @@ public:
|
||||
virtual void
|
||||
SendPlayStatus(int64_t aDuration,
|
||||
int64_t aPosition,
|
||||
const nsAString& aPlayStatus,
|
||||
ControlPlayStatus aPlayStatus,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
@ -284,29 +284,29 @@ public:
|
||||
const nsAString& aMessage) override;
|
||||
|
||||
virtual void
|
||||
ConnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const nsAString& aDeviceAddress,
|
||||
ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
DisconnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const nsAString& aDeviceAddress,
|
||||
DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
DiscoverGattServicesInternal(const nsAString& aAppUuid,
|
||||
DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientStartNotificationsInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientStopNotificationsInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServId,
|
||||
const BluetoothGattId& aCharId,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
@ -317,19 +317,19 @@ public:
|
||||
|
||||
virtual void
|
||||
GattClientReadRemoteRssiInternal(int aClientIf,
|
||||
const nsAString& aDeviceAddress,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientReadCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattClientWriteCharacteristicValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattWriteType& aWriteType,
|
||||
@ -338,7 +338,7 @@ public:
|
||||
|
||||
virtual void
|
||||
GattClientReadDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -346,7 +346,7 @@ public:
|
||||
|
||||
virtual void
|
||||
GattClientWriteDescriptorValueInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
const BluetoothGattId& aCharacteristicId,
|
||||
const BluetoothGattId& aDescriptorId,
|
||||
@ -355,14 +355,14 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
@ -371,21 +371,21 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerAddServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
uint16_t aHandleCount,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerAddIncludedServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aIncludedServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerAddCharacteristicInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothUuid& aCharacteristicUuid,
|
||||
BluetoothGattAttrPerm aPermissions,
|
||||
@ -394,7 +394,7 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerAddDescriptorInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
const BluetoothUuid& aDescriptorUuid,
|
||||
@ -403,26 +403,26 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerRemoveServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerStartServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerStopServiceInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAttributeHandle& aServiceHandle,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
@ -430,8 +430,8 @@ public:
|
||||
|
||||
virtual void
|
||||
GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothUuid& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
|
@ -12,7 +12,14 @@ include BluetoothTypes;
|
||||
|
||||
include "mozilla/dom/bluetooth/ipc/BluetoothMessageUtils.h";
|
||||
|
||||
using mozilla::dom::bluetooth::BluetoothObjectType from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
||||
using mozilla::dom::bluetooth::BluetoothAddress
|
||||
from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
||||
using mozilla::dom::bluetooth::BluetoothObjectType
|
||||
from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
||||
using mozilla::dom::bluetooth::BluetoothPinCode
|
||||
from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
||||
using mozilla::dom::bluetooth::ControlPlayStatus
|
||||
from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -42,7 +49,7 @@ struct SetPropertyRequest
|
||||
struct GetPropertyRequest
|
||||
{
|
||||
BluetoothObjectType type;
|
||||
nsString path;
|
||||
BluetoothAddress address;
|
||||
};
|
||||
|
||||
struct StartDiscoveryRequest
|
||||
@ -55,64 +62,64 @@ struct StopDiscoveryRequest
|
||||
|
||||
struct StartLeScanRequest
|
||||
{
|
||||
nsString[] serviceUuids;
|
||||
BluetoothUuid[] serviceUuids;
|
||||
};
|
||||
|
||||
struct StopLeScanRequest
|
||||
{
|
||||
nsString scanUuid;
|
||||
BluetoothUuid scanUuid;
|
||||
};
|
||||
|
||||
struct PairRequest
|
||||
{
|
||||
nsString address;
|
||||
BluetoothAddress address;
|
||||
uint32_t timeoutMS;
|
||||
};
|
||||
|
||||
struct UnpairRequest
|
||||
{
|
||||
nsString address;
|
||||
BluetoothAddress address;
|
||||
};
|
||||
|
||||
struct PinReplyRequest
|
||||
{
|
||||
nsString address;
|
||||
BluetoothAddress address;
|
||||
bool accept;
|
||||
nsString pinCode;
|
||||
BluetoothPinCode pinCode;
|
||||
};
|
||||
|
||||
struct SspReplyRequest
|
||||
{
|
||||
nsString address;
|
||||
BluetoothAddress address;
|
||||
BluetoothSspVariant variant;
|
||||
bool accept;
|
||||
};
|
||||
|
||||
struct SetPinCodeRequest
|
||||
{
|
||||
nsString path;
|
||||
nsString pincode;
|
||||
BluetoothAddress address;
|
||||
BluetoothPinCode pincode;
|
||||
};
|
||||
|
||||
struct SetPasskeyRequest
|
||||
{
|
||||
nsString path;
|
||||
BluetoothAddress address;
|
||||
uint32_t passkey;
|
||||
};
|
||||
|
||||
struct ConfirmPairingConfirmationRequest
|
||||
{
|
||||
nsString path;
|
||||
BluetoothAddress address;
|
||||
};
|
||||
|
||||
struct DenyPairingConfirmationRequest
|
||||
{
|
||||
nsString path;
|
||||
BluetoothAddress address;
|
||||
};
|
||||
|
||||
struct PairedDevicePropertiesRequest
|
||||
{
|
||||
nsString[] addresses;
|
||||
BluetoothAddress[] addresses;
|
||||
};
|
||||
|
||||
struct ConnectedDevicePropertiesRequest
|
||||
@ -122,41 +129,41 @@ struct ConnectedDevicePropertiesRequest
|
||||
|
||||
struct FetchUuidsRequest
|
||||
{
|
||||
nsString address;
|
||||
BluetoothAddress address;
|
||||
};
|
||||
|
||||
struct ConnectRequest
|
||||
{
|
||||
nsString address;
|
||||
BluetoothAddress address;
|
||||
uint32_t cod;
|
||||
uint16_t serviceUuid;
|
||||
};
|
||||
|
||||
struct DisconnectRequest
|
||||
{
|
||||
nsString address;
|
||||
BluetoothAddress address;
|
||||
uint16_t serviceUuid;
|
||||
};
|
||||
|
||||
struct SendFileRequest
|
||||
{
|
||||
nsString devicePath;
|
||||
BluetoothAddress address;
|
||||
PBlob blob;
|
||||
};
|
||||
|
||||
struct StopSendingFileRequest
|
||||
{
|
||||
nsString devicePath;
|
||||
BluetoothAddress address;
|
||||
};
|
||||
|
||||
struct ConfirmReceivingFileRequest
|
||||
{
|
||||
nsString devicePath;
|
||||
BluetoothAddress address;
|
||||
};
|
||||
|
||||
struct DenyReceivingFileRequest
|
||||
{
|
||||
nsString devicePath;
|
||||
BluetoothAddress address;
|
||||
};
|
||||
|
||||
struct ConnectScoRequest
|
||||
@ -263,36 +270,36 @@ struct SendPlayStatusRequest
|
||||
{
|
||||
int64_t duration;
|
||||
int64_t position;
|
||||
nsString playStatus;
|
||||
ControlPlayStatus playStatus;
|
||||
};
|
||||
|
||||
struct ConnectGattClientRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
nsString deviceAddress;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAddress deviceAddress;
|
||||
};
|
||||
|
||||
struct DisconnectGattClientRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
nsString deviceAddress;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAddress deviceAddress;
|
||||
};
|
||||
|
||||
struct DiscoverGattServicesRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
};
|
||||
|
||||
struct GattClientStartNotificationsRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothGattServiceId servId;
|
||||
BluetoothGattId charId;
|
||||
};
|
||||
|
||||
struct GattClientStopNotificationsRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothGattServiceId servId;
|
||||
BluetoothGattId charId;
|
||||
};
|
||||
@ -305,19 +312,19 @@ struct UnregisterGattClientRequest
|
||||
struct GattClientReadRemoteRssiRequest
|
||||
{
|
||||
int clientIf;
|
||||
nsString deviceAddress;
|
||||
BluetoothAddress deviceAddress;
|
||||
};
|
||||
|
||||
struct GattClientReadCharacteristicValueRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothGattServiceId serviceId;
|
||||
BluetoothGattId charId;
|
||||
};
|
||||
|
||||
struct GattClientWriteCharacteristicValueRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothGattServiceId serviceId;
|
||||
BluetoothGattId charId;
|
||||
BluetoothGattWriteType writeType;
|
||||
@ -326,7 +333,7 @@ struct GattClientWriteCharacteristicValueRequest
|
||||
|
||||
struct GattClientReadDescriptorValueRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothGattServiceId serviceId;
|
||||
BluetoothGattId charId;
|
||||
BluetoothGattId descId;
|
||||
@ -334,7 +341,7 @@ struct GattClientReadDescriptorValueRequest
|
||||
|
||||
struct GattClientWriteDescriptorValueRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothGattServiceId serviceId;
|
||||
BluetoothGattId charId;
|
||||
BluetoothGattId descId;
|
||||
@ -343,14 +350,14 @@ struct GattClientWriteDescriptorValueRequest
|
||||
|
||||
struct GattServerConnectPeripheralRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
nsString address;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAddress address;
|
||||
};
|
||||
|
||||
struct GattServerDisconnectPeripheralRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
nsString address;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAddress address;
|
||||
};
|
||||
|
||||
struct UnregisterGattServerRequest
|
||||
@ -360,21 +367,21 @@ struct UnregisterGattServerRequest
|
||||
|
||||
struct GattServerAddServiceRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothGattServiceId serviceId;
|
||||
uint16_t handleCount;
|
||||
};
|
||||
|
||||
struct GattServerAddIncludedServiceRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAttributeHandle serviceHandle;
|
||||
BluetoothAttributeHandle includedServiceHandle;
|
||||
};
|
||||
|
||||
struct GattServerAddCharacteristicRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAttributeHandle serviceHandle;
|
||||
BluetoothUuid characteristicUuid;
|
||||
BluetoothGattAttrPerm permissions;
|
||||
@ -383,7 +390,7 @@ struct GattServerAddCharacteristicRequest
|
||||
|
||||
struct GattServerAddDescriptorRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAttributeHandle serviceHandle;
|
||||
BluetoothAttributeHandle characteristicHandle;
|
||||
BluetoothUuid descriptorUuid;
|
||||
@ -392,26 +399,26 @@ struct GattServerAddDescriptorRequest
|
||||
|
||||
struct GattServerRemoveServiceRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAttributeHandle serviceHandle;
|
||||
};
|
||||
|
||||
struct GattServerStartServiceRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAttributeHandle serviceHandle;
|
||||
};
|
||||
|
||||
struct GattServerStopServiceRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAttributeHandle serviceHandle;
|
||||
};
|
||||
|
||||
struct GattServerSendResponseRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
nsString address;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAddress address;
|
||||
uint16_t status;
|
||||
int32_t requestId;
|
||||
BluetoothGattResponse response;
|
||||
@ -419,8 +426,8 @@ struct GattServerSendResponseRequest
|
||||
|
||||
struct GattServerSendIndicationRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
nsString address;
|
||||
BluetoothUuid appUuid;
|
||||
BluetoothAddress address;
|
||||
BluetoothAttributeHandle characteristicHandle;
|
||||
bool confirm;
|
||||
uint8_t[] value;
|
||||
|
@ -16,7 +16,6 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'common/BluetoothCommon.cpp',
|
||||
'common/BluetoothHidManager.cpp',
|
||||
'common/BluetoothInterface.cpp',
|
||||
'common/BluetoothProfileController.cpp',
|
||||
@ -130,8 +129,6 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
DEFINES['MOZ_BLUETOOTH_DBUS'] = True
|
||||
DEFINES['HAVE_PTHREADS'] = True
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
#
|
||||
# Exported interfaces
|
||||
#
|
||||
@ -160,6 +157,11 @@ EXPORTS.mozilla.dom.bluetooth += [
|
||||
'common/webapi/BluetoothPairingListener.h',
|
||||
'common/webapi/BluetoothPbapRequestHandle.h'
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'common/BluetoothCommon.cpp',
|
||||
]
|
||||
|
||||
IPDL_SOURCES += [
|
||||
'ipc/BluetoothTypes.ipdlh',
|
||||
'ipc/PBluetooth.ipdl',
|
||||
@ -173,3 +175,5 @@ LOCAL_INCLUDES += [
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
@ -68,6 +68,10 @@ BrowserElementAudioChannel::Create(nsPIDOMWindow* aWindow,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
|
||||
("BrowserElementAudioChannel, Create, channel = %p, type = %d\n",
|
||||
ac.get(), aAudioChannel));
|
||||
|
||||
return ac.forget();
|
||||
}
|
||||
|
||||
@ -199,7 +203,9 @@ public:
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
MOZ_ASSERT(service);
|
||||
if (!service) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
if (!jsapi.Init(mParentWindow)) {
|
||||
@ -396,9 +402,9 @@ BrowserElementAudioChannel::SetVolume(float aVolume, ErrorResult& aRv)
|
||||
}
|
||||
|
||||
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
MOZ_ASSERT(service);
|
||||
|
||||
service->SetAudioChannelVolume(mFrameWindow, mAudioChannel, aVolume);
|
||||
if (service) {
|
||||
service->SetAudioChannelVolume(mFrameWindow, mAudioChannel, aVolume);
|
||||
}
|
||||
|
||||
RefPtr<DOMRequest> domRequest = new DOMRequest(GetOwner());
|
||||
nsCOMPtr<nsIRunnable> runnable = new FireSuccessRunnable(GetOwner(),
|
||||
@ -455,9 +461,9 @@ BrowserElementAudioChannel::SetMuted(bool aMuted, ErrorResult& aRv)
|
||||
}
|
||||
|
||||
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
MOZ_ASSERT(service);
|
||||
|
||||
service->SetAudioChannelMuted(mFrameWindow, mAudioChannel, aMuted);
|
||||
if (service) {
|
||||
service->SetAudioChannelMuted(mFrameWindow, mAudioChannel, aMuted);
|
||||
}
|
||||
|
||||
RefPtr<DOMRequest> domRequest = new DOMRequest(GetOwner());
|
||||
nsCOMPtr<nsIRunnable> runnable = new FireSuccessRunnable(GetOwner(),
|
||||
@ -608,6 +614,10 @@ BrowserElementAudioChannel::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
void
|
||||
BrowserElementAudioChannel::ProcessStateChanged(const char16_t* aData)
|
||||
{
|
||||
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
|
||||
("BrowserElementAudioChannel, ProcessStateChanged, this = %p, "
|
||||
"type = %d\n", this, mAudioChannel));
|
||||
|
||||
nsAutoString value(aData);
|
||||
mState = value.EqualsASCII("active") ? eStateActive : eStateInactive;
|
||||
DispatchTrustedEvent(NS_LITERAL_STRING("activestatechanged"));
|
||||
|
@ -71,6 +71,10 @@ public:
|
||||
|
||||
HTMLCanvasElement* GetCanvas() const
|
||||
{
|
||||
if (mCanvasElement->IsInNativeAnonymousSubtree()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// corresponds to changes to the old bindings made in bug 745025
|
||||
return mCanvasElement->GetOriginalCanvas();
|
||||
}
|
||||
|
@ -1235,7 +1235,12 @@ WebGLContext::GetCanvas(Nullable<dom::OwningHTMLCanvasElementOrOffscreenCanvas>&
|
||||
{
|
||||
if (mCanvasElement) {
|
||||
MOZ_RELEASE_ASSERT(!mOffscreenCanvas);
|
||||
retval.SetValue().SetAsHTMLCanvasElement() = mCanvasElement;
|
||||
|
||||
if (mCanvasElement->IsInNativeAnonymousSubtree()) {
|
||||
retval.SetNull();
|
||||
} else {
|
||||
retval.SetValue().SetAsHTMLCanvasElement() = mCanvasElement;
|
||||
}
|
||||
} else if (mOffscreenCanvas) {
|
||||
retval.SetValue().SetAsOffscreenCanvas() = mOffscreenCanvas;
|
||||
} else {
|
||||
|
2
dom/contacts/tests/contacts_chromescript.js
Normal file
2
dom/contacts/tests/contacts_chromescript.js
Normal file
@ -0,0 +1,2 @@
|
||||
// Ensure the contacts service is running in the parent.
|
||||
Components.utils.import("resource://gre/modules/ContactService.jsm");
|
@ -1,6 +1,5 @@
|
||||
[DEFAULT]
|
||||
skip-if = e10s
|
||||
support-files = shared.js
|
||||
support-files = shared.js contacts_chromescript.js
|
||||
|
||||
[test_contacts_basics.html]
|
||||
skip-if = (toolkit == 'gonk' && debug) #debug-only failure
|
||||
|
@ -3,6 +3,8 @@
|
||||
// Fix the environment to run Contacts tests
|
||||
if (SpecialPowers.isMainProcess()) {
|
||||
SpecialPowers.Cu.import("resource://gre/modules/ContactService.jsm");
|
||||
} else {
|
||||
SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('contacts_chromescript.js'));
|
||||
}
|
||||
|
||||
// Some helpful global vars
|
||||
|
@ -162,7 +162,7 @@ GetNotifyIMEMessageName(IMEMessage aMessage)
|
||||
|
||||
StaticRefPtr<nsIContent> IMEStateManager::sContent;
|
||||
nsPresContext* IMEStateManager::sPresContext = nullptr;
|
||||
StaticRefPtr<nsIWidget> IMEStateManager::sFocusedIMEWidget;
|
||||
nsIWidget* IMEStateManager::sFocusedIMEWidget;
|
||||
StaticRefPtr<TabParent> IMEStateManager::sActiveTabParent;
|
||||
StaticRefPtr<IMEContentObserver> IMEStateManager::sActiveIMEContentObserver;
|
||||
TextCompositionArray* IMEStateManager::sTextCompositions = nullptr;
|
||||
@ -217,6 +217,15 @@ IMEStateManager::OnTabParentDestroying(TabParent* aTabParent)
|
||||
// disable IME.
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::WidgetDestroyed(nsIWidget* aWidget)
|
||||
{
|
||||
if (sFocusedIMEWidget == aWidget) {
|
||||
sFocusedIMEWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::StopIMEStateManagement()
|
||||
@ -1316,7 +1325,7 @@ IMEStateManager::NotifyIME(const IMENotification& aNotification,
|
||||
"aWidget=0x%p, aOriginIsRemote=%s), sFocusedIMEWidget=0x%p, "
|
||||
"sRemoteHasFocus=%s",
|
||||
GetNotifyIMEMessageName(aNotification.mMessage), aWidget,
|
||||
GetBoolName(aOriginIsRemote), sFocusedIMEWidget.get(),
|
||||
GetBoolName(aOriginIsRemote), sFocusedIMEWidget,
|
||||
GetBoolName(sRemoteHasFocus)));
|
||||
|
||||
if (NS_WARN_IF(!aWidget)) {
|
||||
|
@ -64,6 +64,11 @@ public:
|
||||
*/
|
||||
static void OnTabParentDestroying(TabParent* aTabParent);
|
||||
|
||||
/**
|
||||
* Called when aWidget is being deleted.
|
||||
*/
|
||||
static void WidgetDestroyed(nsIWidget* aWidget);
|
||||
|
||||
/**
|
||||
* SetIMEContextForChildProcess() is called when aTabParent receives
|
||||
* SetInputContext() from the remote process.
|
||||
@ -225,7 +230,7 @@ protected:
|
||||
|
||||
static StaticRefPtr<nsIContent> sContent;
|
||||
static nsPresContext* sPresContext;
|
||||
static StaticRefPtr<nsIWidget> sFocusedIMEWidget;
|
||||
static nsIWidget* sFocusedIMEWidget;
|
||||
static StaticRefPtr<TabParent> sActiveTabParent;
|
||||
// sActiveIMEContentObserver points to the currently active
|
||||
// IMEContentObserver. This is null if there is no focused editor.
|
||||
|
@ -2773,7 +2773,9 @@ nsresult HTMLMediaElement::InitializeDecoderAsClone(MediaDecoder* aOriginal)
|
||||
|
||||
decoder->SetMediaSeekable(aOriginal->IsMediaSeekable());
|
||||
|
||||
RefPtr<MediaResource> resource = originalResource->CloneData(decoder);
|
||||
RefPtr<MediaResource> resource =
|
||||
originalResource->CloneData(decoder->GetResourceCallback());
|
||||
|
||||
if (!resource) {
|
||||
LOG(LogLevel::Debug, ("%p Failed to cloned stream for decoder %p", this, decoder.get()));
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -2805,7 +2807,9 @@ nsresult HTMLMediaElement::InitializeDecoderForChannel(nsIChannel* aChannel,
|
||||
|
||||
LOG(LogLevel::Debug, ("%p Created decoder %p for type %s", this, decoder.get(), mimeType.get()));
|
||||
|
||||
RefPtr<MediaResource> resource = MediaResource::Create(decoder, aChannel);
|
||||
RefPtr<MediaResource> resource =
|
||||
MediaResource::Create(decoder->GetResourceCallback(), aChannel);
|
||||
|
||||
if (!resource)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -563,6 +563,9 @@ nsBrowserElement::GetAllowedAudioChannels(
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
|
||||
("nsBrowserElement, GetAllowedAudioChannels, this = %p\n", this));
|
||||
|
||||
GenerateAllowedAudioChannels(window, frameLoader, mBrowserElementAPI,
|
||||
manifestURL, mBrowserElementAudioChannels,
|
||||
aRv);
|
||||
|
@ -59,7 +59,7 @@ interface nsIServiceWorkerManagerListener : nsISupports
|
||||
void onUnregister(in nsIServiceWorkerRegistrationInfo aInfo);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(2f61820a-1e9a-4c16-bf1c-ce182c5f5d6d)]
|
||||
[scriptable, builtinclass, uuid(c945e2e6-30c2-48e6-a282-e69de0c7ebb1)]
|
||||
interface nsIServiceWorkerManager : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -174,6 +174,8 @@ interface nsIServiceWorkerManager : nsISupports
|
||||
void addListener(in nsIServiceWorkerManagerListener aListener);
|
||||
|
||||
void removeListener(in nsIServiceWorkerManagerListener aListener);
|
||||
|
||||
bool shouldReportToWindow(in nsIDOMWindow aWindow, in ACString aScope);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
|
@ -1108,7 +1108,7 @@ ParticularProcessPriorityManager::ComputePriority()
|
||||
}
|
||||
|
||||
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
if (service->ProcessContentOrNormalChannelIsActive(ChildID())) {
|
||||
if (service && service->ProcessContentOrNormalChannelIsActive(ChildID())) {
|
||||
return PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE;
|
||||
}
|
||||
|
||||
|
@ -693,6 +693,9 @@ TabChild::Observe(nsISupports *aSubject,
|
||||
// In theory a tabChild should contain just 1 top window, but let's double
|
||||
// check it comparing the windowID.
|
||||
if (window->WindowID() != windowID) {
|
||||
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
|
||||
("TabChild, Observe, different windowID, owner ID = %lld, "
|
||||
"ID from wrapper = %lld", window->WindowID(), windowID));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -830,6 +833,7 @@ TabChild::NotifyTabContextUpdated()
|
||||
} else {
|
||||
docShell->SetIsApp(OwnAppId());
|
||||
}
|
||||
docShell->SetIsSignedPackage(OriginAttributesRef().mSignedPkg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace mozilla {
|
||||
#undef LOG
|
||||
#endif
|
||||
|
||||
PRLogModuleInfo* gAudioStreamLog = nullptr;
|
||||
LazyLogModule gAudioStreamLog("AudioStream");
|
||||
// For simple logs
|
||||
#define LOG(x) MOZ_LOG(gAudioStreamLog, mozilla::LogLevel::Debug, x)
|
||||
|
||||
|
@ -40,7 +40,7 @@ uint32_t sPreferredSampleRate;
|
||||
|
||||
} // namespace
|
||||
|
||||
extern PRLogModuleInfo* gAudioStreamLog;
|
||||
extern LazyLogModule gAudioStreamLog;
|
||||
|
||||
static const uint32_t CUBEB_NORMAL_LATENCY_MS = 100;
|
||||
|
||||
@ -126,7 +126,6 @@ bool CubebLatencyPrefSet()
|
||||
|
||||
void InitLibrary()
|
||||
{
|
||||
gAudioStreamLog = PR_NewLogModule("AudioStream");
|
||||
PrefChanged(PREF_VOLUME_SCALE, nullptr);
|
||||
Preferences::RegisterCallback(PrefChanged, PREF_VOLUME_SCALE);
|
||||
PrefChanged(PREF_CUBEB_LATENCY, nullptr);
|
||||
|
@ -27,13 +27,13 @@
|
||||
#undef LOG
|
||||
#endif
|
||||
|
||||
static PRLogModuleInfo* gMediaStreamLog;
|
||||
#define LOG(type, msg) MOZ_LOG(gMediaStreamLog, type, msg)
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
static LazyLogModule gMediaStreamLog("MediaStream");
|
||||
#define LOG(type, msg) MOZ_LOG(gMediaStreamLog, type, msg)
|
||||
|
||||
const TrackID TRACK_VIDEO_PRIMARY = 1;
|
||||
|
||||
|
||||
@ -318,10 +318,6 @@ DOMMediaStream::DOMMediaStream()
|
||||
nsCOMPtr<nsIUUIDGenerator> uuidgen =
|
||||
do_GetService("@mozilla.org/uuid-generator;1", &rv);
|
||||
|
||||
if (!gMediaStreamLog) {
|
||||
gMediaStreamLog = PR_NewLogModule("MediaStream");
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && uuidgen) {
|
||||
nsID uuid;
|
||||
memset(&uuid, 0, sizeof(uuid));
|
||||
|
@ -136,7 +136,7 @@ public:
|
||||
}
|
||||
|
||||
bool Contains(int32_t aValue) {
|
||||
for (int32_t i = 0; i < GetSize(); ++i) {
|
||||
for (size_t i = 0; i < GetSize(); ++i) {
|
||||
if (ObjectAt(i) == aValue) {
|
||||
return true;
|
||||
}
|
||||
@ -149,7 +149,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
int32_t ObjectAt(int32_t aIndex) {
|
||||
int32_t ObjectAt(size_t aIndex) {
|
||||
void* v = nsDeque::ObjectAt(aIndex);
|
||||
return reinterpret_cast<uintptr_t>(v);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
extern PRLogModuleInfo* gMediaStreamGraphLog;
|
||||
extern mozilla::LazyLogModule gMediaStreamGraphLog;
|
||||
#define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg)
|
||||
|
||||
// We don't use NSPR log here because we want this interleaved with adb logcat
|
||||
|
@ -37,17 +37,13 @@ const char* LatencyLogIndex2Strings[] = {
|
||||
|
||||
static StaticRefPtr<AsyncLatencyLogger> gAsyncLogger;
|
||||
|
||||
PRLogModuleInfo*
|
||||
LogModule*
|
||||
GetLatencyLog()
|
||||
{
|
||||
static PRLogModuleInfo* sLog;
|
||||
if (!sLog) {
|
||||
sLog = PR_NewLogModule("MediaLatency");
|
||||
}
|
||||
static LazyLogModule sLog("MediaLatency");
|
||||
return sLog;
|
||||
}
|
||||
|
||||
|
||||
class LogEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
@ -111,6 +107,8 @@ void LogLatency(uint32_t aIndex, uint64_t aID, int64_t aValue)
|
||||
void AsyncLatencyLogger::InitializeStatics()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Main thread only");
|
||||
|
||||
//Make sure that the underlying logger is allocated.
|
||||
GetLatencyLog();
|
||||
gAsyncLogger = new AsyncLatencyLogger();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
class AsyncLatencyLogger;
|
||||
|
||||
PRLogModuleInfo* GetLatencyLog();
|
||||
mozilla::LogModule* GetLatencyLog();
|
||||
|
||||
// This class is a singleton. It is refcounted.
|
||||
class AsyncLatencyLogger : public nsIObserver
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "prenv.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo* gMP3DemuxerLog;
|
||||
mozilla::LazyLogModule gMP3DemuxerLog("MP3Demuxer");
|
||||
#define MP3LOG(msg, ...) \
|
||||
MOZ_LOG(gMP3DemuxerLog, LogLevel::Debug, ("MP3Demuxer " msg, ##__VA_ARGS__))
|
||||
#define MP3LOGV(msg, ...) \
|
||||
@ -112,12 +112,6 @@ MP3TrackDemuxer::MP3TrackDemuxer(MediaResource* aSource)
|
||||
, mChannels(0)
|
||||
{
|
||||
Reset();
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (!gMP3DemuxerLog) {
|
||||
gMP3DemuxerLog = PR_NewLogModule("MP3Demuxer");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
PRLogModuleInfo* gMediaCacheLog;
|
||||
LazyLogModule gMediaCacheLog("MediaCache");
|
||||
#define CACHE_LOG(type, msg) MOZ_LOG(gMediaCacheLog, type, msg)
|
||||
|
||||
// Readahead blocks for non-seekable streams will be limited to this
|
||||
@ -580,10 +580,6 @@ MediaCache::Init()
|
||||
rv = mFileCache->Open(fileDesc);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (!gMediaCacheLog) {
|
||||
gMediaCacheLog = PR_NewLogModule("MediaCache");
|
||||
}
|
||||
|
||||
MediaCacheFlusher::Init();
|
||||
|
||||
return NS_OK;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user