mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to fx-team. a=merge
This commit is contained in:
commit
ca7eb1e9fb
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d663b1f7d63e4d3d69c181a58f21b38145044b2"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="77ef35f5429bc3dfe9ca192b9aacc3c0bf8857de"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0fcf2e913d737e341f7a03f6e1951a5e13bd9d59"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0f7792c39ad26aedecf457117c21b16cc1aee879"/>
|
||||
<!-- 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"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
@ -19,13 +19,13 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d663b1f7d63e4d3d69c181a58f21b38145044b2"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="77ef35f5429bc3dfe9ca192b9aacc3c0bf8857de"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0fcf2e913d737e341f7a03f6e1951a5e13bd9d59"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0f7792c39ad26aedecf457117c21b16cc1aee879"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
|
||||
@ -97,7 +97,7 @@
|
||||
<project name="platform/system/netd" path="system/netd" revision="3d298fde142bee3fc4f07f63f16f2d8ce42339c0"/>
|
||||
<project name="platform/system/vold" path="system/vold" revision="919829940468066a32f403980b43f6ebfee5d314"/>
|
||||
<!-- Emulator specific things -->
|
||||
<project name="android-development" path="development" remote="b2g" revision="9abf0ab68376afae3e1c7beefa3e9cbee2fde202"/>
|
||||
<project name="android-development" path="development" remote="b2g" revision="c99e41d49f0b98eade30814e52c1de9e818def68"/>
|
||||
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="0d5c43228006bae775c4cb57a6d3908484d41718"/>
|
||||
<project name="platform/external/iproute2" path="external/iproute2" revision="c66c5716d5335e450f7a7b71ccc6a604fb2f41d2"/>
|
||||
<project 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="d2685281e2e54ca14d1df304867aa82c37b27162"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d663b1f7d63e4d3d69c181a58f21b38145044b2"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="77ef35f5429bc3dfe9ca192b9aacc3c0bf8857de"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0fcf2e913d737e341f7a03f6e1951a5e13bd9d59"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0f7792c39ad26aedecf457117c21b16cc1aee879"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d663b1f7d63e4d3d69c181a58f21b38145044b2"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="77ef35f5429bc3dfe9ca192b9aacc3c0bf8857de"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0fcf2e913d737e341f7a03f6e1951a5e13bd9d59"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0f7792c39ad26aedecf457117c21b16cc1aee879"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
@ -19,13 +19,13 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d663b1f7d63e4d3d69c181a58f21b38145044b2"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="77ef35f5429bc3dfe9ca192b9aacc3c0bf8857de"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0fcf2e913d737e341f7a03f6e1951a5e13bd9d59"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0f7792c39ad26aedecf457117c21b16cc1aee879"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
|
||||
@ -97,7 +97,7 @@
|
||||
<project name="platform/system/netd" path="system/netd" revision="3d298fde142bee3fc4f07f63f16f2d8ce42339c0"/>
|
||||
<project name="platform/system/vold" path="system/vold" revision="919829940468066a32f403980b43f6ebfee5d314"/>
|
||||
<!-- Emulator specific things -->
|
||||
<project name="android-development" path="development" remote="b2g" revision="9abf0ab68376afae3e1c7beefa3e9cbee2fde202"/>
|
||||
<project name="android-development" path="development" remote="b2g" revision="c99e41d49f0b98eade30814e52c1de9e818def68"/>
|
||||
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="0d5c43228006bae775c4cb57a6d3908484d41718"/>
|
||||
<project name="platform/external/iproute2" path="external/iproute2" revision="c66c5716d5335e450f7a7b71ccc6a604fb2f41d2"/>
|
||||
<project 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="d2685281e2e54ca14d1df304867aa82c37b27162"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d663b1f7d63e4d3d69c181a58f21b38145044b2"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="77ef35f5429bc3dfe9ca192b9aacc3c0bf8857de"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0fcf2e913d737e341f7a03f6e1951a5e13bd9d59"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0f7792c39ad26aedecf457117c21b16cc1aee879"/>
|
||||
<!-- 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"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d663b1f7d63e4d3d69c181a58f21b38145044b2"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="77ef35f5429bc3dfe9ca192b9aacc3c0bf8857de"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0fcf2e913d737e341f7a03f6e1951a5e13bd9d59"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0f7792c39ad26aedecf457117c21b16cc1aee879"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -4,6 +4,6 @@
|
||||
"remote": "",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "4c52c3164207370c4b9180608f73970dcc6bdb78",
|
||||
"revision": "fb5a4aa15e266e9aa0e44281241ad081b528c75b",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,12 +17,12 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d663b1f7d63e4d3d69c181a58f21b38145044b2"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="77ef35f5429bc3dfe9ca192b9aacc3c0bf8857de"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0fcf2e913d737e341f7a03f6e1951a5e13bd9d59"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0f7792c39ad26aedecf457117c21b16cc1aee879"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d663b1f7d63e4d3d69c181a58f21b38145044b2"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="77ef35f5429bc3dfe9ca192b9aacc3c0bf8857de"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d663b1f7d63e4d3d69c181a58f21b38145044b2"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="77ef35f5429bc3dfe9ca192b9aacc3c0bf8857de"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0fcf2e913d737e341f7a03f6e1951a5e13bd9d59"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0f7792c39ad26aedecf457117c21b16cc1aee879"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -17,12 +17,12 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d663b1f7d63e4d3d69c181a58f21b38145044b2"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="77ef35f5429bc3dfe9ca192b9aacc3c0bf8857de"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0fcf2e913d737e341f7a03f6e1951a5e13bd9d59"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0f7792c39ad26aedecf457117c21b16cc1aee879"/>
|
||||
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
|
@ -162,7 +162,6 @@
|
||||
#endif
|
||||
#ifdef MOZ_B2G_RIL
|
||||
@BINPATH@/components/dom_icc.xpt
|
||||
@BINPATH@/components/dom_cellbroadcast.xpt
|
||||
@BINPATH@/components/dom_wappush.xpt
|
||||
@BINPATH@/components/dom_mobileconnection.xpt
|
||||
#endif
|
||||
@ -194,6 +193,7 @@
|
||||
@BINPATH@/components/dom_settings.xpt
|
||||
@BINPATH@/components/dom_permissionsettings.xpt
|
||||
@BINPATH@/components/dom_sidebar.xpt
|
||||
@BINPATH@/components/dom_cellbroadcast.xpt
|
||||
@BINPATH@/components/dom_mobilemessage.xpt
|
||||
@BINPATH@/components/dom_storage.xpt
|
||||
@BINPATH@/components/dom_stylesheets.xpt
|
||||
@ -439,6 +439,8 @@
|
||||
|
||||
; RIL
|
||||
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
|
||||
@BINPATH@/components/CellBroadcastService.js
|
||||
@BINPATH@/components/CellBroadcastService.manifest
|
||||
@BINPATH@/components/MmsService.js
|
||||
@BINPATH@/components/MmsService.manifest
|
||||
@BINPATH@/components/MobileConnectionService.js
|
||||
|
@ -228,6 +228,7 @@
|
||||
@BINPATH@/components/dom_settings.xpt
|
||||
@BINPATH@/components/dom_permissionsettings.xpt
|
||||
@BINPATH@/components/dom_sidebar.xpt
|
||||
@BINPATH@/components/dom_cellbroadcast.xpt
|
||||
@BINPATH@/components/dom_mobilemessage.xpt
|
||||
@BINPATH@/components/dom_storage.xpt
|
||||
@BINPATH@/components/dom_stylesheets.xpt
|
||||
|
@ -5897,7 +5897,7 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
|
||||
JSAutoCompartment ac(aCx, global);
|
||||
|
||||
JS::Handle<JSObject*> htmlProto(
|
||||
HTMLElementBinding::GetProtoObject(aCx, global));
|
||||
HTMLElementBinding::GetProtoObjectHandle(aCx, global));
|
||||
if (!htmlProto) {
|
||||
rv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
@ -5943,7 +5943,7 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
|
||||
}
|
||||
|
||||
JS::Handle<JSObject*> svgProto(
|
||||
SVGElementBinding::GetProtoObject(aCx, global));
|
||||
SVGElementBinding::GetProtoObjectHandle(aCx, global));
|
||||
if (!svgProto) {
|
||||
rv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "mozilla/CycleCollectedJSRuntime.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/nsIContentParent.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
@ -1432,8 +1433,8 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL,
|
||||
return;
|
||||
}
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
JS::Rooted<JSScript*> script(cx);
|
||||
JSRuntime* rt = CycleCollectedJSRuntime::Get()->Runtime();
|
||||
JS::Rooted<JSScript*> script(rt);
|
||||
|
||||
nsFrameScriptObjectExecutorHolder* holder = sCachedScripts->Get(aURL);
|
||||
if (holder && holder->WillRunInGlobalScope() == aRunInGlobalScope) {
|
||||
@ -1446,26 +1447,23 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL,
|
||||
shouldCache, &script);
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> global(cx, mGlobal->GetJSObject());
|
||||
JS::Rooted<JSObject*> global(rt, mGlobal->GetJSObject());
|
||||
if (global) {
|
||||
JSAutoCompartment ac(cx, global);
|
||||
bool ok = true;
|
||||
AutoEntryScript aes(xpc::NativeGlobal(global));
|
||||
aes.TakeOwnershipOfErrorReporting();
|
||||
JSContext* cx = aes.cx();
|
||||
if (script) {
|
||||
if (aRunInGlobalScope) {
|
||||
ok = JS::CloneAndExecuteScript(cx, global, script);
|
||||
JS::CloneAndExecuteScript(cx, global, script);
|
||||
} else {
|
||||
JS::Rooted<JSObject*> scope(cx);
|
||||
ok = js::ExecuteInGlobalAndReturnScope(cx, global, script, &scope);
|
||||
if (ok){
|
||||
bool ok = js::ExecuteInGlobalAndReturnScope(cx, global, script, &scope);
|
||||
if (ok) {
|
||||
// Force the scope to stay alive.
|
||||
mAnonymousGlobalScopes.AppendElement(scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
nsJSUtils::ReportPendingException(cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1057,7 +1057,9 @@ nsScriptLoader::FillCompileOptionsForRequest(const AutoJSAPI &jsapi,
|
||||
aOptions->setSourceMapURL(aRequest->mSourceMapURL.get());
|
||||
}
|
||||
if (aRequest->mOriginPrincipal) {
|
||||
aOptions->setOriginPrincipals(nsJSPrincipals::get(aRequest->mOriginPrincipal));
|
||||
nsIPrincipal* scriptPrin = nsContentUtils::ObjectPrincipal(aScopeChain);
|
||||
bool subsumes = scriptPrin->Subsumes(aRequest->mOriginPrincipal);
|
||||
aOptions->setMutedErrors(!subsumes);
|
||||
}
|
||||
|
||||
JSContext* cx = jsapi.cx();
|
||||
|
@ -141,6 +141,7 @@ AudioStream::AudioStream()
|
||||
, mNeedsStart(false)
|
||||
, mShouldDropFrames(false)
|
||||
, mPendingAudioInitTask(false)
|
||||
, mLastGoodPosition(0)
|
||||
{
|
||||
// keep a ref in case we shut down later than nsLayoutStatics
|
||||
mLatencyLog = AsyncLatencyLogger::Get(true);
|
||||
@ -856,7 +857,12 @@ AudioStream::GetPositionInFramesUnlocked()
|
||||
}
|
||||
}
|
||||
|
||||
return std::min<uint64_t>(position, INT64_MAX);
|
||||
MOZ_ASSERT(position >= mLastGoodPosition, "cubeb position shouldn't go backward");
|
||||
// This error handling/recovery keeps us in good shape in release build.
|
||||
if (position >= mLastGoodPosition) {
|
||||
mLastGoodPosition = position;
|
||||
}
|
||||
return std::min<uint64_t>(mLastGoodPosition, INT64_MAX);
|
||||
}
|
||||
|
||||
int64_t
|
||||
|
@ -402,6 +402,9 @@ private:
|
||||
// True if there is a pending AudioInitTask. Shutdown() will wait until the
|
||||
// pending AudioInitTask is finished.
|
||||
bool mPendingAudioInitTask;
|
||||
// The last good position returned by cubeb_stream_get_position(). Used to
|
||||
// check if the cubeb position is going backward.
|
||||
uint64_t mLastGoodPosition;
|
||||
};
|
||||
|
||||
class AudioInitTask : public nsRunnable
|
||||
|
@ -2726,7 +2726,7 @@ MediaStreamGraphImpl::MediaStreamGraphImpl(bool aRealtime,
|
||||
, mNonRealtimeProcessing(false)
|
||||
, mStreamOrderDirty(false)
|
||||
, mLatencyLog(AsyncLatencyLogger::Get())
|
||||
#ifdef MOZ_WEBRTCj
|
||||
#ifdef MOZ_WEBRTC
|
||||
, mFarendObserverRef(nullptr)
|
||||
#endif
|
||||
, mMemoryReportMonitor("MSGIMemory")
|
||||
|
@ -97,10 +97,7 @@ void
|
||||
SVGEllipseElement::ConstructPath(gfxContext *aCtx)
|
||||
{
|
||||
RefPtr<DrawTarget> dt = aCtx->GetDrawTarget();
|
||||
FillRule fillRule =
|
||||
aCtx->CurrentFillRule() == gfxContext::FILL_RULE_WINDING ?
|
||||
FillRule::FILL_WINDING : FillRule::FILL_EVEN_ODD;
|
||||
RefPtr<PathBuilder> builder = dt->CreatePathBuilder(fillRule);
|
||||
RefPtr<PathBuilder> builder = dt->CreatePathBuilder(aCtx->CurrentFillRule());
|
||||
RefPtr<Path> path = BuildPath(builder);
|
||||
if (path) {
|
||||
aCtx->SetPath(path);
|
||||
|
@ -57,6 +57,7 @@ function doNavigationTest(testNumber, initialHref, f) {
|
||||
var iframe = document.getElementById("iframe" + testNumber);
|
||||
var a = iframe.contentDocument.getElementById("a");
|
||||
ok(endsWith(iframe.contentWindow.location, initialHref), "Initial href of test " + testNumber);
|
||||
is("pointer", window.getComputedStyle(a).getPropertyValue("cursor"), "expected pointer cursor");
|
||||
iframe.onload = function() {
|
||||
ok(endsWith(iframe.contentWindow.location, "a_href_destination.svg"), "Final href of test " + testNumber);
|
||||
if (++navigationCount == testCount) {
|
||||
|
@ -32,8 +32,6 @@ support-files =
|
||||
file_bug670318.html
|
||||
file_bug852909.pdf
|
||||
file_bug852909.png
|
||||
file_bug941562-child.html
|
||||
file_bug941562.html
|
||||
file_bug1046022.html
|
||||
print_postdata.sjs
|
||||
test-form_sjis.html
|
||||
@ -87,8 +85,6 @@ skip-if = e10s # Bug ?????? - test touches content (adds event listener to conte
|
||||
[browser_bug852909.js]
|
||||
skip-if = e10s # Bug ?????? - event handler checks event.target is the content document and test e10s-utils doesn't do that.
|
||||
[browser_bug92473.js]
|
||||
skip-if = e10s # Bug ?????? - BrowserSetForcedCharacterSet() in browser.js references docShell
|
||||
[browser_bug941562.js]
|
||||
skip-if = e10s # Bug ?????? - event handler checks event.target is the content document and test e10s-utils doesn't do that.
|
||||
[browser_uriFixupIntegration.js]
|
||||
skip-if = e10s
|
||||
|
@ -1,39 +0,0 @@
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
var rootDir = "http://mochi.test:8888/browser/docshell/test/browser/";
|
||||
gBrowser.selectedTab = gBrowser.addTab(rootDir + "file_bug941562.html");
|
||||
gBrowser.selectedBrowser.addEventListener("load", afterOpen, true);
|
||||
}
|
||||
|
||||
function afterOpen(event) {
|
||||
if (event.target != gBrowser.contentDocument) {
|
||||
return;
|
||||
}
|
||||
|
||||
gBrowser.selectedBrowser.removeEventListener("load", afterOpen, true);
|
||||
gBrowser.selectedBrowser.addEventListener("load", afterChangeCharset, true);
|
||||
|
||||
is(gBrowser.contentDocument.documentElement.textContent.indexOf('\u20AC'), 140, "Parent doc should be windows-1252 initially");
|
||||
|
||||
is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.documentElement.textContent.indexOf('\u4E2D'), 77, "Child doc should be HZ-GB-2312 initially");
|
||||
|
||||
BrowserSetForcedCharacterSet("windows-1251");
|
||||
}
|
||||
|
||||
function afterChangeCharset(event) {
|
||||
if (event.target != gBrowser.contentDocument) {
|
||||
return;
|
||||
}
|
||||
|
||||
gBrowser.selectedBrowser.removeEventListener("load", afterChangeCharset, true);
|
||||
|
||||
is(gBrowser.contentDocument.documentElement.textContent.indexOf('\u0402'), 140, "Parent doc should decode as windows-1251 subsequently");
|
||||
is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.documentElement.textContent.indexOf('\u4E2D'), 77, "Child doc should decode as HZ-GB-2312 subsequently");
|
||||
|
||||
is(gBrowser.contentDocument.characterSet, "windows-1251", "Parent doc should report windows-1251 subsequently");
|
||||
is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.characterSet, "HZ-GB-2312", "Child doc should report HZ-GB-2312 subsequently");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="hz-gb-2312">
|
||||
<meta content="width=device-width, initial-scale=1" name="viewport">
|
||||
<title>meta declaration in parent and meta HZ in child</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>China if decoded as HZ: ~{VP~}</p>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,18 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="windows-1252">
|
||||
<meta content="width=device-width, initial-scale=1" name="viewport">
|
||||
<title>meta declaration in parent and meta HZ in child</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>meta declaration in parent and meta HZ in child</h1>
|
||||
|
||||
<p>Euro sign if decoded as Windows-1252: €</p>
|
||||
<p>a with diaeresis if decoded as Windows-1252: ä</p>
|
||||
|
||||
<iframe src="file_bug941562-child.html"></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "mozilla/dom/PowerManager.h"
|
||||
#include "mozilla/dom/WakeLock.h"
|
||||
#include "mozilla/dom/power/PowerManagerService.h"
|
||||
#include "mozilla/dom/CellBroadcast.h"
|
||||
#include "mozilla/dom/MobileMessageManager.h"
|
||||
#include "mozilla/dom/ServiceWorkerContainer.h"
|
||||
#include "mozilla/dom/Telephony.h"
|
||||
@ -49,7 +50,6 @@
|
||||
#endif
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "mozilla/dom/IccManager.h"
|
||||
#include "mozilla/dom/CellBroadcast.h"
|
||||
#include "mozilla/dom/MobileConnectionArray.h"
|
||||
#endif
|
||||
#include "nsIIdleObserver.h"
|
||||
@ -173,13 +173,13 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotification)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPowerManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCellBroadcast)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMobileMessageManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTelephony)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVoicemail)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConnection)
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMobileConnections)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCellBroadcast)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIccManager)
|
||||
#endif
|
||||
#ifdef MOZ_B2G_BT
|
||||
@ -242,6 +242,10 @@ Navigator::Invalidate()
|
||||
mPowerManager = nullptr;
|
||||
}
|
||||
|
||||
if (mCellBroadcast) {
|
||||
mCellBroadcast = nullptr;
|
||||
}
|
||||
|
||||
if (mMobileMessageManager) {
|
||||
mMobileMessageManager->Shutdown();
|
||||
mMobileMessageManager = nullptr;
|
||||
@ -266,10 +270,6 @@ Navigator::Invalidate()
|
||||
mMobileConnections = nullptr;
|
||||
}
|
||||
|
||||
if (mCellBroadcast) {
|
||||
mCellBroadcast = nullptr;
|
||||
}
|
||||
|
||||
if (mIccManager) {
|
||||
mIccManager->Shutdown();
|
||||
mIccManager = nullptr;
|
||||
@ -1495,7 +1495,7 @@ Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv)
|
||||
p->MaybeResolve(true);
|
||||
return p.forget();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (featureName.EqualsLiteral("XMLHttpRequest.mozSystem")) {
|
||||
p->MaybeResolve(true);
|
||||
@ -1638,6 +1638,8 @@ Navigator::GetMozMobileConnections(ErrorResult& aRv)
|
||||
return mMobileConnections;
|
||||
}
|
||||
|
||||
#endif // MOZ_B2G_RIL
|
||||
|
||||
CellBroadcast*
|
||||
Navigator::GetMozCellBroadcast(ErrorResult& aRv)
|
||||
{
|
||||
@ -1652,8 +1654,6 @@ Navigator::GetMozCellBroadcast(ErrorResult& aRv)
|
||||
return mCellBroadcast;
|
||||
}
|
||||
|
||||
#endif // MOZ_B2G_RIL
|
||||
|
||||
Voicemail*
|
||||
Navigator::GetMozVoicemail(ErrorResult& aRv)
|
||||
{
|
||||
|
@ -85,12 +85,12 @@ class BluetoothManager;
|
||||
#endif // MOZ_B2G_BT
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
class CellBroadcast;
|
||||
class IccManager;
|
||||
class MobileConnectionArray;
|
||||
#endif
|
||||
|
||||
class PowerManager;
|
||||
class CellBroadcast;
|
||||
class Telephony;
|
||||
class Voicemail;
|
||||
|
||||
@ -219,6 +219,7 @@ public:
|
||||
nsTArray<nsRefPtr<nsDOMDeviceStorage> >& aStores,
|
||||
ErrorResult& aRv);
|
||||
DesktopNotificationCenter* GetMozNotification(ErrorResult& aRv);
|
||||
CellBroadcast* GetMozCellBroadcast(ErrorResult& aRv);
|
||||
MobileMessageManager* GetMozMobileMessage();
|
||||
Telephony* GetMozTelephony(ErrorResult& aRv);
|
||||
Voicemail* GetMozVoicemail(ErrorResult& aRv);
|
||||
@ -234,7 +235,6 @@ public:
|
||||
#endif
|
||||
#ifdef MOZ_B2G_RIL
|
||||
MobileConnectionArray* GetMozMobileConnections(ErrorResult& aRv);
|
||||
CellBroadcast* GetMozCellBroadcast(ErrorResult& aRv);
|
||||
IccManager* GetMozIccManager(ErrorResult& aRv);
|
||||
#endif // MOZ_B2G_RIL
|
||||
#ifdef MOZ_GAMEPAD
|
||||
@ -329,13 +329,13 @@ private:
|
||||
nsRefPtr<FMRadio> mFMRadio;
|
||||
#endif
|
||||
nsRefPtr<PowerManager> mPowerManager;
|
||||
nsRefPtr<CellBroadcast> mCellBroadcast;
|
||||
nsRefPtr<MobileMessageManager> mMobileMessageManager;
|
||||
nsRefPtr<Telephony> mTelephony;
|
||||
nsRefPtr<Voicemail> mVoicemail;
|
||||
nsRefPtr<network::Connection> mConnection;
|
||||
#ifdef MOZ_B2G_RIL
|
||||
nsRefPtr<MobileConnectionArray> mMobileConnections;
|
||||
nsRefPtr<CellBroadcast> mCellBroadcast;
|
||||
nsRefPtr<IccManager> mIccManager;
|
||||
#endif
|
||||
#ifdef MOZ_B2G_BT
|
||||
|
@ -234,9 +234,53 @@ FindJSContext(nsIGlobalObject* aGlobalObject)
|
||||
|
||||
AutoJSAPI::AutoJSAPI()
|
||||
: mCx(nullptr)
|
||||
, mOwnErrorReporting(false)
|
||||
, mOldDontReportUncaught(false)
|
||||
{
|
||||
}
|
||||
|
||||
AutoJSAPI::~AutoJSAPI()
|
||||
{
|
||||
if (mOwnErrorReporting) {
|
||||
MOZ_ASSERT(NS_IsMainThread(), "See corresponding assertion in TakeOwnershipOfErrorReporting()");
|
||||
JS::ContextOptionsRef(cx()).setDontReportUncaught(mOldDontReportUncaught);
|
||||
|
||||
if (HasException()) {
|
||||
|
||||
// AutoJSAPI uses a JSAutoNullableCompartment, and may be in a null
|
||||
// compartment when the destructor is called. However, the JS engine
|
||||
// requires us to be in a compartment when we fetch the pending exception.
|
||||
// In this case, we enter the privileged junk scope and don't dispatch any
|
||||
// error events.
|
||||
JS::Rooted<JSObject*> errorGlobal(cx(), JS::CurrentGlobalOrNull(cx()));
|
||||
if (!errorGlobal)
|
||||
errorGlobal = xpc::PrivilegedJunkScope();
|
||||
JSAutoCompartment ac(cx(), errorGlobal);
|
||||
nsCOMPtr<nsPIDOMWindow> win = xpc::WindowGlobalOrNull(errorGlobal);
|
||||
const char *category = nsContentUtils::IsCallerChrome() ? "chrome javascript"
|
||||
: "content javascript";
|
||||
JS::Rooted<JS::Value> exn(cx());
|
||||
js::ErrorReport jsReport(cx());
|
||||
if (StealException(&exn) && jsReport.init(cx(), exn)) {
|
||||
nsRefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
|
||||
xpcReport->Init(jsReport.report(), jsReport.message(), category,
|
||||
win ? win->WindowID() : 0);
|
||||
if (win) {
|
||||
DispatchScriptErrorEvent(win, JS_GetRuntime(cx()), xpcReport, exn);
|
||||
} else {
|
||||
xpcReport->LogToConsole();
|
||||
}
|
||||
} else {
|
||||
NS_WARNING("OOMed while acquiring uncaught exception from JSAPI");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mOldErrorReporter.isSome()) {
|
||||
JS_SetErrorReporter(JS_GetRuntime(cx()), mOldErrorReporter.value());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AutoJSAPI::InitInternal(JSObject* aGlobal, JSContext* aCx, bool aIsMainThread)
|
||||
{
|
||||
@ -253,11 +297,19 @@ AutoJSAPI::InitInternal(JSObject* aGlobal, JSContext* aCx, bool aIsMainThread)
|
||||
} else {
|
||||
mAutoNullableCompartment.emplace(mCx, aGlobal);
|
||||
}
|
||||
|
||||
if (aIsMainThread) {
|
||||
JSRuntime* rt = JS_GetRuntime(aCx);
|
||||
mOldErrorReporter.emplace(JS_GetErrorReporter(rt));
|
||||
JS_SetErrorReporter(rt, xpc::SystemErrorReporter);
|
||||
}
|
||||
}
|
||||
|
||||
AutoJSAPI::AutoJSAPI(nsIGlobalObject* aGlobalObject,
|
||||
bool aIsMainThread,
|
||||
JSContext* aCx)
|
||||
: mOwnErrorReporting(false)
|
||||
, mOldDontReportUncaught(false)
|
||||
{
|
||||
MOZ_ASSERT(aGlobalObject);
|
||||
MOZ_ASSERT(aGlobalObject->GetGlobalJSObject(), "Must have a JS global");
|
||||
@ -352,6 +404,49 @@ AutoJSAPI::InitWithLegacyErrorReporting(nsGlobalWindow* aWindow)
|
||||
return InitWithLegacyErrorReporting(static_cast<nsIGlobalObject*>(aWindow));
|
||||
}
|
||||
|
||||
// Even with dontReportUncaught, the JS engine still sends warning reports
|
||||
// to the JSErrorReporter as soon as they are generated. These go directly to
|
||||
// the console, so we can handle them easily here.
|
||||
//
|
||||
// Eventually, SpiderMonkey will have a special-purpose callback for warnings only.
|
||||
void
|
||||
WarningOnlyErrorReporter(JSContext* aCx, const char* aMessage, JSErrorReport* aRep)
|
||||
{
|
||||
MOZ_ASSERT(JSREPORT_IS_WARNING(aRep->flags));
|
||||
nsRefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
|
||||
const char* category = nsContentUtils::IsCallerChrome() ? "chrome javascript"
|
||||
: "content javascript";
|
||||
nsPIDOMWindow* win = xpc::WindowGlobalOrNull(JS::CurrentGlobalOrNull(aCx));
|
||||
xpcReport->Init(aRep, aMessage, category, win ? win->WindowID() : 0);
|
||||
xpcReport->LogToConsole();
|
||||
}
|
||||
|
||||
void
|
||||
AutoJSAPI::TakeOwnershipOfErrorReporting()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Can't own error reporting off-main-thread yet");
|
||||
MOZ_ASSERT(!mOwnErrorReporting);
|
||||
mOwnErrorReporting = true;
|
||||
|
||||
JSRuntime *rt = JS_GetRuntime(cx());
|
||||
mOldDontReportUncaught = JS::ContextOptionsRef(cx()).dontReportUncaught();
|
||||
JS::ContextOptionsRef(cx()).setDontReportUncaught(true);
|
||||
JS_SetErrorReporter(rt, WarningOnlyErrorReporter);
|
||||
}
|
||||
|
||||
bool
|
||||
AutoJSAPI::StealException(JS::MutableHandle<JS::Value> aVal)
|
||||
{
|
||||
MOZ_ASSERT(CxPusherIsStackTop());
|
||||
MOZ_ASSERT(HasException());
|
||||
MOZ_ASSERT(js::GetContextCompartment(cx()));
|
||||
if (!JS_GetPendingException(cx(), aVal)) {
|
||||
return false;
|
||||
}
|
||||
JS_ClearPendingException(cx());
|
||||
return true;
|
||||
}
|
||||
|
||||
AutoEntryScript::AutoEntryScript(nsIGlobalObject* aGlobalObject,
|
||||
bool aIsMainThread,
|
||||
JSContext* aCx)
|
||||
|
@ -203,6 +203,8 @@ public:
|
||||
// accessing the JSContext through cx().
|
||||
AutoJSAPI();
|
||||
|
||||
~AutoJSAPI();
|
||||
|
||||
// This uses the SafeJSContext (or worker equivalent), and enters a null
|
||||
// compartment, so that the consumer is forced to select a compartment to
|
||||
// enter before manipulating objects.
|
||||
@ -253,6 +255,31 @@ public:
|
||||
|
||||
bool CxPusherIsStackTop() const { return mCxPusher->IsStackTop(); }
|
||||
|
||||
// We're moving towards a world where the AutoJSAPI always handles
|
||||
// exceptions that bubble up from the JS engine. In order to make this
|
||||
// process incremental, we allow consumers to opt-in to the new behavior
|
||||
// while keeping the old behavior as the default.
|
||||
void TakeOwnershipOfErrorReporting();
|
||||
bool OwnsErrorReporting() { return mOwnErrorReporting; }
|
||||
|
||||
bool HasException() const {
|
||||
MOZ_ASSERT(CxPusherIsStackTop());
|
||||
return JS_IsExceptionPending(cx());
|
||||
};
|
||||
|
||||
// Transfers ownership of the current exception from the JS engine to the
|
||||
// caller. Callers must ensure that HasException() is true, and that cx()
|
||||
// is in a non-null compartment.
|
||||
//
|
||||
// Note that this fails if and only if we OOM while wrapping the exception
|
||||
// into the current compartment.
|
||||
bool StealException(JS::MutableHandle<JS::Value> aVal);
|
||||
|
||||
void ClearException() {
|
||||
MOZ_ASSERT(CxPusherIsStackTop());
|
||||
JS_ClearPendingException(cx());
|
||||
}
|
||||
|
||||
protected:
|
||||
// Protected constructor, allowing subclasses to specify a particular cx to
|
||||
// be used. This constructor initialises the AutoJSAPI, so Init must NOT be
|
||||
@ -266,7 +293,15 @@ private:
|
||||
mozilla::Maybe<JSAutoNullableCompartment> mAutoNullableCompartment;
|
||||
JSContext *mCx;
|
||||
|
||||
// Track state between the old and new error reporting modes.
|
||||
bool mOwnErrorReporting;
|
||||
bool mOldDontReportUncaught;
|
||||
Maybe<JSErrorReporter> mOldErrorReporter;
|
||||
|
||||
void InitInternal(JSObject* aGlobal, JSContext* aCx, bool aIsMainThread);
|
||||
|
||||
AutoJSAPI(const AutoJSAPI&) MOZ_DELETE;
|
||||
AutoJSAPI& operator= (const AutoJSAPI&) MOZ_DELETE;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "WindowNamedPropertiesHandler.h"
|
||||
#include "mozilla/dom/EventTargetBinding.h"
|
||||
#include "mozilla/dom/WindowBinding.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
@ -206,33 +207,74 @@ WindowNamedPropertiesHandler::delete_(JSContext* aCx,
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
WindowNamedPropertiesHandler::Install(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aProto)
|
||||
static bool
|
||||
ResolveWindowNamedProperty(JSContext* aCx, JS::Handle<JSObject*> aWrapper,
|
||||
JS::Handle<JSObject*> aObj, JS::Handle<jsid> aId,
|
||||
JS::MutableHandle<JSPropertyDescriptor> aDesc)
|
||||
{
|
||||
JS::Rooted<JSObject*> protoProto(aCx);
|
||||
if (!::JS_GetPrototype(aCx, aProto, &protoProto)) {
|
||||
return;
|
||||
{
|
||||
JSAutoCompartment ac(aCx, aObj);
|
||||
if (!js::GetProxyHandler(aObj)->getOwnPropertyDescriptor(aCx, aObj, aId,
|
||||
aDesc)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (aDesc.object()) {
|
||||
aDesc.object().set(aWrapper);
|
||||
|
||||
return JS_WrapPropertyDescriptor(aCx, aDesc);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
EnumerateWindowNamedProperties(JSContext* aCx, JS::Handle<JSObject*> aWrapper,
|
||||
JS::Handle<JSObject*> aObj,
|
||||
JS::AutoIdVector& aProps)
|
||||
{
|
||||
JSAutoCompartment ac(aCx, aObj);
|
||||
return js::GetProxyHandler(aObj)->getOwnPropertyNames(aCx, aObj, aProps);
|
||||
}
|
||||
|
||||
const NativePropertyHooks sWindowNamedPropertiesNativePropertyHooks[] = { {
|
||||
ResolveWindowNamedProperty,
|
||||
EnumerateWindowNamedProperties,
|
||||
{ nullptr, nullptr },
|
||||
prototypes::id::_ID_Count,
|
||||
constructors::id::_ID_Count,
|
||||
nullptr
|
||||
} };
|
||||
|
||||
static const DOMIfaceAndProtoJSClass WindowNamedPropertiesClass = {
|
||||
PROXY_CLASS_DEF("WindowProperties",
|
||||
DOM_INTERFACE_PROTO_SLOTS_BASE, /* extra slots */
|
||||
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS),
|
||||
eNamedPropertiesObject,
|
||||
sWindowNamedPropertiesNativePropertyHooks,
|
||||
"[object WindowProperties]",
|
||||
prototypes::id::_ID_Count,
|
||||
0,
|
||||
EventTargetBinding::GetProtoObject
|
||||
};
|
||||
|
||||
// static
|
||||
JSObject*
|
||||
WindowNamedPropertiesHandler::Create(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aProto)
|
||||
{
|
||||
// Note: since the scope polluter proxy lives on the window's prototype
|
||||
// chain, it needs a singleton type to avoid polluting type information
|
||||
// for properties on the window.
|
||||
JS::Rooted<JSObject*> gsp(aCx);
|
||||
js::ProxyOptions options;
|
||||
options.setSingleton(true);
|
||||
gsp = js::NewProxyObject(aCx, WindowNamedPropertiesHandler::getInstance(),
|
||||
JS::NullHandleValue, protoProto,
|
||||
js::GetGlobalForObjectCrossCompartment(aProto),
|
||||
options);
|
||||
if (!gsp) {
|
||||
return;
|
||||
}
|
||||
|
||||
// And then set the prototype of the interface prototype object to be the
|
||||
// global scope polluter.
|
||||
::JS_SplicePrototype(aCx, aProto, gsp);
|
||||
options.setClass(&WindowNamedPropertiesClass.mBase);
|
||||
return js::NewProxyObject(aCx, WindowNamedPropertiesHandler::getInstance(),
|
||||
JS::NullHandleValue, aProto,
|
||||
js::GetGlobalForObjectCrossCompartment(aProto),
|
||||
options);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
@ -63,9 +63,10 @@ public:
|
||||
return &instance;
|
||||
}
|
||||
|
||||
// For Install, aProto is the proto of the Window we're associated with.
|
||||
static void
|
||||
Install(JSContext *aCx, JS::Handle<JSObject*> aProto);
|
||||
// For Create, aProto is the parent of the interface prototype object of the
|
||||
// Window we're associated with.
|
||||
static JSObject*
|
||||
Create(JSContext *aCx, JS::Handle<JSObject*> aProto);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -2590,15 +2590,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
bool allow = GetDocShell()->GetCanExecuteScripts();
|
||||
xpc::Scriptability::Get(GetWrapperPreserveColor()).SetDocShellAllowsScript(allow);
|
||||
|
||||
// If we created a new inner window above, we need to do the last little bit
|
||||
// of initialization now that the dust has settled.
|
||||
if (createdInnerWindow) {
|
||||
JS::Rooted<JSObject*> global(cx, newInnerGlobal);
|
||||
JS::Rooted<JSObject*> proto(cx);
|
||||
JS_GetPrototype(cx, global, &proto);
|
||||
WindowNamedPropertiesHandler::Install(cx, proto);
|
||||
}
|
||||
|
||||
if (!aState) {
|
||||
JS::Rooted<JSObject*> rootedWrapper(cx, GetWrapperPreserveColor());
|
||||
if (!JS_DefineProperty(cx, newInnerGlobal, "window", rootedWrapper,
|
||||
@ -13975,6 +13966,14 @@ nsGlobalWindow::ClearDocumentDependentSlots(JSContext* aCx)
|
||||
WindowBinding::ClearCachedPerformanceValue(aCx, this);
|
||||
}
|
||||
|
||||
/* static */
|
||||
JSObject*
|
||||
nsGlobalWindow::CreateNamedPropertiesObject(JSContext *aCx,
|
||||
JS::Handle<JSObject*> aProto)
|
||||
{
|
||||
return WindowNamedPropertiesHandler::Create(aCx, aProto);
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
void
|
||||
nsGlobalWindow::EnableNetworkEvent(uint32_t aType)
|
||||
|
@ -785,6 +785,9 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static JSObject*
|
||||
CreateNamedPropertiesObject(JSContext *aCx, JS::Handle<JSObject*> aProto);
|
||||
|
||||
nsIDOMWindow* GetWindow(mozilla::ErrorResult& aError);
|
||||
nsIDOMWindow* GetSelf(mozilla::ErrorResult& aError);
|
||||
nsIDocument* GetDocument()
|
||||
|
@ -351,28 +351,23 @@ NS_HandleScriptError(nsIScriptGlobalObject *aScriptGlobal,
|
||||
class ScriptErrorEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
ScriptErrorEvent(JSRuntime* aRuntime,
|
||||
ScriptErrorEvent(nsPIDOMWindow* aWindow,
|
||||
JSRuntime* aRuntime,
|
||||
xpc::ErrorReport* aReport,
|
||||
nsIPrincipal* aScriptOriginPrincipal,
|
||||
JS::Handle<JS::Value> aError,
|
||||
bool aDispatchEvent)
|
||||
: mReport(aReport)
|
||||
, mOriginPrincipal(aScriptOriginPrincipal)
|
||||
, mDispatchEvent(aDispatchEvent)
|
||||
JS::Handle<JS::Value> aError)
|
||||
: mWindow(aWindow)
|
||||
, mReport(aReport)
|
||||
, mError(aRuntime, aError)
|
||||
{}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsPIDOMWindow* win = mReport->mWindow;
|
||||
nsPIDOMWindow* win = mWindow;
|
||||
MOZ_ASSERT(win);
|
||||
// First, notify the DOM that we have a script error, but only if
|
||||
// our window is still the current inner.
|
||||
if (mDispatchEvent && win->IsCurrentInnerWindow() &&
|
||||
win->GetDocShell() && !JSREPORT_IS_WARNING(mReport->mFlags) &&
|
||||
!sHandlingScriptError)
|
||||
{
|
||||
if (win->IsCurrentInnerWindow() && win->GetDocShell() && !sHandlingScriptError) {
|
||||
AutoRestore<bool> recursionGuard(sHandlingScriptError);
|
||||
sHandlingScriptError = true;
|
||||
|
||||
@ -385,21 +380,8 @@ public:
|
||||
init.mFilename = mReport->mFileName;
|
||||
init.mBubbles = true;
|
||||
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sop(do_QueryInterface(win));
|
||||
NS_ENSURE_STATE(sop);
|
||||
nsIPrincipal* p = sop->GetPrincipal();
|
||||
NS_ENSURE_STATE(p);
|
||||
|
||||
bool sameOrigin = !mOriginPrincipal;
|
||||
|
||||
if (p && !sameOrigin) {
|
||||
if (NS_FAILED(p->Subsumes(mOriginPrincipal, &sameOrigin))) {
|
||||
sameOrigin = false;
|
||||
}
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(xoriginMsg, "Script error.");
|
||||
if (sameOrigin) {
|
||||
if (!mReport->mIsMuted) {
|
||||
init.mMessage = mReport->mErrorMsg;
|
||||
init.mLineno = mReport->mLineNumber;
|
||||
init.mColno = mReport->mColumn;
|
||||
@ -427,9 +409,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsRefPtr<xpc::ErrorReport> mReport;
|
||||
nsCOMPtr<nsIPrincipal> mOriginPrincipal;
|
||||
bool mDispatchEvent;
|
||||
JS::PersistentRootedValue mError;
|
||||
|
||||
static bool sHandlingScriptError;
|
||||
@ -489,33 +470,33 @@ SystemErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
|
||||
|
||||
if (globalObject) {
|
||||
nsRefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
|
||||
xpcReport->Init(report, message, globalObject);
|
||||
bool isChrome = nsContentUtils::IsSystemPrincipal(globalObject->PrincipalOrNull());
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(globalObject);
|
||||
xpcReport->Init(report, message, isChrome, win ? win->WindowID() : 0);
|
||||
|
||||
// If there's no window to fire an event at, report it to the console
|
||||
// directly.
|
||||
if (!xpcReport->mWindow) {
|
||||
// If we can't dispatch an event to a window, report it to the console
|
||||
// directly. This includes the case where the error was an OOM, because
|
||||
// triggering a scripted event handler is likely to generate further OOMs.
|
||||
if (!win || JSREPORT_IS_WARNING(xpcReport->mFlags) ||
|
||||
report->errorNumber == JSMSG_OUT_OF_MEMORY)
|
||||
{
|
||||
xpcReport->LogToConsole();
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, we need to asynchronously invoke onerror before we can decide
|
||||
// whether or not to report the error to the console.
|
||||
nsContentUtils::AddScriptRunner(
|
||||
new ScriptErrorEvent(JS_GetRuntime(cx),
|
||||
xpcReport,
|
||||
nsJSPrincipals::get(report->originPrincipals),
|
||||
exception,
|
||||
/* We do not try to report Out Of Memory via a dom
|
||||
* event because the dom event handler would
|
||||
* encounter an OOM exception trying to process the
|
||||
* event, and then we'd need to generate a new OOM
|
||||
* event for that new OOM instance -- this isn't
|
||||
* pretty.
|
||||
*/
|
||||
report->errorNumber != JSMSG_OUT_OF_MEMORY));
|
||||
DispatchScriptErrorEvent(win, JS_GetRuntime(cx), xpcReport, exception);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DispatchScriptErrorEvent(nsPIDOMWindow *win, JSRuntime *rt, xpc::ErrorReport *xpcReport,
|
||||
JS::Handle<JS::Value> exception)
|
||||
{
|
||||
nsContentUtils::AddScriptRunner(new ScriptErrorEvent(win, rt, xpcReport, exception));
|
||||
}
|
||||
|
||||
} /* namespace xpc */
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -28,6 +28,10 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
bool
|
||||
nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename,
|
||||
uint32_t* aLineno)
|
||||
@ -120,7 +124,7 @@ nsJSUtils::ReportPendingException(JSContext *aContext)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJSUtils::CompileFunction(JSContext* aCx,
|
||||
nsJSUtils::CompileFunction(AutoJSAPI& jsapi,
|
||||
JS::Handle<JSObject*> aTarget,
|
||||
JS::CompileOptions& aOptions,
|
||||
const nsACString& aName,
|
||||
@ -129,10 +133,12 @@ nsJSUtils::CompileFunction(JSContext* aCx,
|
||||
const nsAString& aBody,
|
||||
JSObject** aFunctionObject)
|
||||
{
|
||||
MOZ_ASSERT(js::GetEnterCompartmentDepth(aCx) > 0);
|
||||
MOZ_ASSERT_IF(aTarget, js::IsObjectInContextCompartment(aTarget, aCx));
|
||||
MOZ_ASSERT(jsapi.OwnsErrorReporting());
|
||||
JSContext* cx = jsapi.cx();
|
||||
MOZ_ASSERT(js::GetEnterCompartmentDepth(cx) > 0);
|
||||
MOZ_ASSERT_IF(aTarget, js::IsObjectInContextCompartment(aTarget, cx));
|
||||
MOZ_ASSERT_IF(aOptions.versionSet, aOptions.version != JSVERSION_UNKNOWN);
|
||||
mozilla::DebugOnly<nsIScriptContext*> ctx = GetScriptContextFromJSContext(aCx);
|
||||
mozilla::DebugOnly<nsIScriptContext*> ctx = GetScriptContextFromJSContext(cx);
|
||||
MOZ_ASSERT_IF(ctx, ctx->IsContextInitialized());
|
||||
|
||||
// Do the junk Gecko is supposed to do before calling into JSAPI.
|
||||
@ -141,14 +147,13 @@ nsJSUtils::CompileFunction(JSContext* aCx,
|
||||
}
|
||||
|
||||
// Compile.
|
||||
JS::Rooted<JSFunction*> fun(aCx);
|
||||
if (!JS::CompileFunction(aCx, aTarget, aOptions,
|
||||
JS::Rooted<JSFunction*> fun(cx);
|
||||
if (!JS::CompileFunction(cx, aTarget, aOptions,
|
||||
PromiseFlatCString(aName).get(),
|
||||
aArgCount, aArgArray,
|
||||
PromiseFlatString(aBody).get(),
|
||||
aBody.Length(), &fun))
|
||||
{
|
||||
ReportPendingException(aCx);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,12 @@
|
||||
class nsIScriptContext;
|
||||
class nsIScriptGlobalObject;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class AutoJSAPI;
|
||||
}
|
||||
}
|
||||
|
||||
class nsJSUtils
|
||||
{
|
||||
public:
|
||||
@ -49,7 +55,7 @@ public:
|
||||
*/
|
||||
static void ReportPendingException(JSContext *aContext);
|
||||
|
||||
static nsresult CompileFunction(JSContext* aCx,
|
||||
static nsresult CompileFunction(mozilla::dom::AutoJSAPI& jsapi,
|
||||
JS::Handle<JSObject*> aTarget,
|
||||
JS::CompileOptions& aOptions,
|
||||
const nsACString& aName,
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
{
|
||||
MOZ_ASSERT(!PreservingWrapper(), "Clearing a preserved wrapper!");
|
||||
MOZ_ASSERT(aWrapper, "Use ClearWrapper!");
|
||||
MOZ_ASSERT(js::HasObjectMovedOp(aWrapper),
|
||||
MOZ_ASSERT(js::HasObjectMovedOpIfRequired(aWrapper),
|
||||
"Object has not provided the hook to update the wrapper if it is moved");
|
||||
|
||||
SetWrapperJSObject(aWrapper);
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "mozilla/dom/DOMErrorBinding.h"
|
||||
#include "mozilla/dom/ElementBinding.h"
|
||||
#include "mozilla/dom/HTMLObjectElement.h"
|
||||
#include "mozilla/dom/HTMLObjectElementBinding.h"
|
||||
#include "mozilla/dom/HTMLSharedObjectElement.h"
|
||||
@ -343,53 +344,40 @@ DefineUnforgeableAttributes(JSContext* cx, JS::Handle<JSObject*> obj,
|
||||
// passed a non-Function object we also need to provide our own toString method
|
||||
// for interface objects.
|
||||
|
||||
enum {
|
||||
TOSTRING_CLASS_RESERVED_SLOT = 0,
|
||||
TOSTRING_NAME_RESERVED_SLOT = 1
|
||||
};
|
||||
|
||||
static bool
|
||||
InterfaceObjectToString(JSContext* cx, unsigned argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::Rooted<JSObject*> callee(cx, &args.callee());
|
||||
|
||||
if (!args.thisv().isObject()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JSMSG_CANT_CONVERT_TO, "null", "object");
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::Value v = js::GetFunctionNativeReserved(callee,
|
||||
TOSTRING_CLASS_RESERVED_SLOT);
|
||||
const JSClass* clasp = static_cast<const JSClass*>(v.toPrivate());
|
||||
|
||||
v = js::GetFunctionNativeReserved(callee, TOSTRING_NAME_RESERVED_SLOT);
|
||||
JSString* jsname = v.toString();
|
||||
|
||||
nsAutoJSString name;
|
||||
if (!name.init(cx, jsname)) {
|
||||
JS::Rooted<JSObject*> thisObj(cx, &args.thisv().toObject());
|
||||
JS::Rooted<JSObject*> obj(cx, js::CheckedUnwrap(thisObj, /* stopAtOuter = */ false));
|
||||
if (!obj) {
|
||||
JS_ReportError(cx, "Permission denied to access object");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (js::GetObjectJSClass(&args.thisv().toObject()) != clasp) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JSMSG_INCOMPATIBLE_PROTO,
|
||||
NS_ConvertUTF16toUTF8(name).get(), "toString",
|
||||
"object");
|
||||
const js::Class* clasp = js::GetObjectClass(obj);
|
||||
if (!IsDOMIfaceAndProtoClass(clasp)) {
|
||||
JS_ReportError(cx, "toString called on incompatible object");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsString str;
|
||||
str.AppendLiteral("function ");
|
||||
str.Append(name);
|
||||
str.AppendLiteral("() {");
|
||||
str.Append('\n');
|
||||
str.AppendLiteral(" [native code]");
|
||||
str.Append('\n');
|
||||
str.Append('}');
|
||||
const DOMIfaceAndProtoJSClass* ifaceAndProtoJSClass =
|
||||
DOMIfaceAndProtoJSClass::FromJSClass(clasp);
|
||||
JS::Rooted<JSString*> str(cx,
|
||||
JS_NewStringCopyZ(cx,
|
||||
ifaceAndProtoJSClass->mToString));
|
||||
if (!str) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return xpc::NonVoidStringToJsval(cx, str, args.rval());
|
||||
args.rval().setString(str);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -439,7 +427,7 @@ DefineConstructor(JSContext* cx, JS::Handle<JSObject*> global, const char* name,
|
||||
static JSObject*
|
||||
CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Handle<JSObject*> constructorProto,
|
||||
const JSClass* constructorClass,
|
||||
const js::Class* constructorClass,
|
||||
const JSNativeHolder* constructorNative,
|
||||
unsigned ctorNargs, const NamedConstructor* namedConstructors,
|
||||
JS::Handle<JSObject*> proto,
|
||||
@ -450,7 +438,8 @@ CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Rooted<JSObject*> constructor(cx);
|
||||
if (constructorClass) {
|
||||
MOZ_ASSERT(constructorProto);
|
||||
constructor = JS_NewObject(cx, constructorClass, constructorProto, global);
|
||||
constructor = JS_NewObject(cx, Jsvalify(constructorClass), constructorProto,
|
||||
global);
|
||||
} else {
|
||||
MOZ_ASSERT(constructorNative);
|
||||
MOZ_ASSERT(constructorProto == JS_GetFunctionPrototype(cx, global));
|
||||
@ -465,25 +454,12 @@ CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
// Have to shadow Function.prototype.toString, since that throws
|
||||
// on things that are not js::FunctionClass.
|
||||
JS::Rooted<JSFunction*> toString(cx,
|
||||
js::DefineFunctionWithReserved(cx, constructor,
|
||||
"toString",
|
||||
InterfaceObjectToString,
|
||||
0, 0));
|
||||
JS_DefineFunction(cx, constructor, "toString", InterfaceObjectToString,
|
||||
0, 0));
|
||||
if (!toString) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSString *str = ::JS_InternString(cx, name);
|
||||
if (!str) {
|
||||
return nullptr;
|
||||
}
|
||||
JSObject* toStringObj = JS_GetFunctionObject(toString);
|
||||
js::SetFunctionNativeReserved(toStringObj, TOSTRING_CLASS_RESERVED_SLOT,
|
||||
PRIVATE_TO_JSVAL(const_cast<JSClass *>(constructorClass)));
|
||||
|
||||
js::SetFunctionNativeReserved(toStringObj, TOSTRING_NAME_RESERVED_SLOT,
|
||||
STRING_TO_JSVAL(str));
|
||||
|
||||
if (!JS_DefineProperty(cx, constructor, "length", ctorNargs,
|
||||
JSPROP_READONLY | JSPROP_PERMANENT)) {
|
||||
return nullptr;
|
||||
@ -592,12 +568,12 @@ DefineWebIDLBindingPropertiesOnXPCObject(JSContext* cx,
|
||||
static JSObject*
|
||||
CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Handle<JSObject*> parentProto,
|
||||
const JSClass* protoClass,
|
||||
const js::Class* protoClass,
|
||||
const NativeProperties* properties,
|
||||
const NativeProperties* chromeOnlyProperties)
|
||||
{
|
||||
JS::Rooted<JSObject*> ourProto(cx,
|
||||
JS_NewObjectWithUniqueType(cx, protoClass, parentProto, global));
|
||||
JS_NewObjectWithUniqueType(cx, Jsvalify(protoClass), parentProto, global));
|
||||
if (!ourProto ||
|
||||
!DefineProperties(cx, ourProto, properties, chromeOnlyProperties)) {
|
||||
return nullptr;
|
||||
@ -651,9 +627,9 @@ DefineProperties(JSContext* cx, JS::Handle<JSObject*> obj,
|
||||
void
|
||||
CreateInterfaceObjects(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Handle<JSObject*> protoProto,
|
||||
const JSClass* protoClass, JS::Heap<JSObject*>* protoCache,
|
||||
const js::Class* protoClass, JS::Heap<JSObject*>* protoCache,
|
||||
JS::Handle<JSObject*> constructorProto,
|
||||
const JSClass* constructorClass, const JSNativeHolder* constructor,
|
||||
const js::Class* constructorClass, const JSNativeHolder* constructor,
|
||||
unsigned ctorNargs, const NamedConstructor* namedConstructors,
|
||||
JS::Heap<JSObject*>* constructorCache,
|
||||
const NativeProperties* properties,
|
||||
@ -939,9 +915,12 @@ inline const NativePropertyHooks*
|
||||
GetNativePropertyHooks(JSContext *cx, JS::Handle<JSObject*> obj,
|
||||
DOMObjectType& type)
|
||||
{
|
||||
const DOMJSClass* domClass = GetDOMClass(obj);
|
||||
const js::Class* clasp = js::GetObjectClass(obj);
|
||||
|
||||
const DOMJSClass* domClass = GetDOMClass(clasp);
|
||||
if (domClass) {
|
||||
type = eInstance;
|
||||
bool isGlobal = (clasp->flags & JSCLASS_DOM_GLOBAL) != 0;
|
||||
type = isGlobal ? eGlobalInstance : eInstance;
|
||||
return domClass->mNativeHooks;
|
||||
}
|
||||
|
||||
@ -963,65 +942,6 @@ GetNativePropertyHooks(JSContext *cx, JS::Handle<JSObject*> obj,
|
||||
return ifaceAndProtoJSClass->mNativeHooks;
|
||||
}
|
||||
|
||||
// Try to resolve a property as an unforgeable property from the given
|
||||
// NativeProperties, if it's there. nativeProperties is allowed to be null (in
|
||||
// which case we of course won't resolve anything).
|
||||
static bool
|
||||
XrayResolveUnforgeableProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||
JS::MutableHandle<JSPropertyDescriptor> desc,
|
||||
bool& cacheOnHolder,
|
||||
const NativeProperties* nativeProperties);
|
||||
|
||||
static bool
|
||||
XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
const NativePropertyHooks* nativePropertyHooks,
|
||||
DOMObjectType type, JS::Handle<JSObject*> obj,
|
||||
JS::Handle<jsid> id,
|
||||
JS::MutableHandle<JSPropertyDescriptor> desc,
|
||||
bool& cacheOnHolder);
|
||||
|
||||
bool
|
||||
XrayResolveOwnProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||
JS::MutableHandle<JSPropertyDescriptor> desc,
|
||||
bool& cacheOnHolder)
|
||||
{
|
||||
cacheOnHolder = false;
|
||||
|
||||
DOMObjectType type;
|
||||
const NativePropertyHooks *nativePropertyHooks =
|
||||
GetNativePropertyHooks(cx, obj, type);
|
||||
|
||||
if (type != eInstance) {
|
||||
// For prototype objects and interface objects, just return their
|
||||
// normal set of properties.
|
||||
return XrayResolveNativeProperty(cx, wrapper, nativePropertyHooks, type,
|
||||
obj, id, desc, cacheOnHolder);
|
||||
}
|
||||
|
||||
// Check for unforgeable properties before doing mResolveOwnProperty weirdness
|
||||
const NativePropertiesHolder& nativeProperties =
|
||||
nativePropertyHooks->mNativeProperties;
|
||||
if (!XrayResolveUnforgeableProperty(cx, wrapper, obj, id, desc, cacheOnHolder,
|
||||
nativeProperties.regular)) {
|
||||
return false;
|
||||
}
|
||||
if (desc.object()) {
|
||||
return true;
|
||||
}
|
||||
if (!XrayResolveUnforgeableProperty(cx, wrapper, obj, id, desc, cacheOnHolder,
|
||||
nativeProperties.chromeOnly)) {
|
||||
return false;
|
||||
}
|
||||
if (desc.object()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !nativePropertyHooks->mResolveOwnProperty ||
|
||||
nativePropertyHooks->mResolveOwnProperty(cx, wrapper, obj, id, desc);
|
||||
}
|
||||
|
||||
static bool
|
||||
XrayResolveAttribute(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||
@ -1124,7 +1044,10 @@ XrayResolveMethod(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
// Try to resolve a property as an unforgeable property from the given
|
||||
// NativeProperties, if it's there. nativeProperties is allowed to be null (in
|
||||
// which case we of course won't resolve anything).
|
||||
static bool
|
||||
XrayResolveUnforgeableProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||
JS::MutableHandle<JSPropertyDescriptor> desc,
|
||||
@ -1275,31 +1198,171 @@ ResolvePrototypeOrConstructor(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
return JS_WrapPropertyDescriptor(cx, desc);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
const NativePropertyHooks* nativePropertyHooks,
|
||||
DOMObjectType type, JS::Handle<JSObject*> obj,
|
||||
JS::Handle<jsid> id,
|
||||
JS::MutableHandle<JSPropertyDescriptor> desc,
|
||||
bool& cacheOnHolder)
|
||||
#ifdef DEBUG
|
||||
|
||||
static void
|
||||
DEBUG_CheckXBLCallable(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
if (type == eInterface && IdEquals(id, "prototype")) {
|
||||
return nativePropertyHooks->mPrototypeID == prototypes::id::_ID_Count ||
|
||||
ResolvePrototypeOrConstructor(cx, wrapper, obj,
|
||||
nativePropertyHooks->mPrototypeID,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY,
|
||||
desc, cacheOnHolder);
|
||||
}
|
||||
// In general, we shouldn't have cross-compartment wrappers here, because
|
||||
// we should be running in an XBL scope, and the content prototype should
|
||||
// contain wrappers to functions defined in the XBL scope. But if the node
|
||||
// has been adopted into another compartment, those prototypes will now point
|
||||
// to a different XBL scope (which is ok).
|
||||
MOZ_ASSERT_IF(js::IsCrossCompartmentWrapper(obj),
|
||||
xpc::IsContentXBLScope(js::GetObjectCompartment(js::UncheckedUnwrap(obj))));
|
||||
MOZ_ASSERT(JS::IsCallable(obj));
|
||||
}
|
||||
|
||||
if (type == eInterfacePrototype && IdEquals(id, "constructor")) {
|
||||
return nativePropertyHooks->mConstructorID == constructors::id::_ID_Count ||
|
||||
ResolvePrototypeOrConstructor(cx, wrapper, obj,
|
||||
nativePropertyHooks->mConstructorID,
|
||||
0, desc, cacheOnHolder);
|
||||
}
|
||||
static void
|
||||
DEBUG_CheckXBLLookup(JSContext *cx, JSPropertyDescriptor *desc)
|
||||
{
|
||||
if (!desc->obj)
|
||||
return;
|
||||
if (!desc->value.isUndefined()) {
|
||||
MOZ_ASSERT(desc->value.isObject());
|
||||
DEBUG_CheckXBLCallable(cx, &desc->value.toObject());
|
||||
}
|
||||
if (desc->getter) {
|
||||
MOZ_ASSERT(desc->attrs & JSPROP_GETTER);
|
||||
DEBUG_CheckXBLCallable(cx, JS_FUNC_TO_DATA_PTR(JSObject *, desc->getter));
|
||||
}
|
||||
if (desc->setter) {
|
||||
MOZ_ASSERT(desc->attrs & JSPROP_SETTER);
|
||||
DEBUG_CheckXBLCallable(cx, JS_FUNC_TO_DATA_PTR(JSObject *, desc->setter));
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define DEBUG_CheckXBLLookup(a, b) {}
|
||||
#endif
|
||||
|
||||
/* static */ bool
|
||||
XrayResolveOwnProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||
JS::MutableHandle<JSPropertyDescriptor> desc,
|
||||
bool& cacheOnHolder)
|
||||
{
|
||||
cacheOnHolder = false;
|
||||
|
||||
DOMObjectType type;
|
||||
const NativePropertyHooks *nativePropertyHooks =
|
||||
GetNativePropertyHooks(cx, obj, type);
|
||||
const NativePropertiesHolder& nativeProperties =
|
||||
nativePropertyHooks->mNativeProperties;
|
||||
ResolveOwnProperty resolveOwnProperty =
|
||||
nativePropertyHooks->mResolveOwnProperty;
|
||||
|
||||
if (type == eNamedPropertiesObject) {
|
||||
// None of these should be cached on the holder, since they're dynamic.
|
||||
return resolveOwnProperty(cx, wrapper, obj, id, desc);
|
||||
}
|
||||
|
||||
// Check for unforgeable properties first.
|
||||
if (IsInstance(type)) {
|
||||
const NativePropertiesHolder& nativeProperties =
|
||||
nativePropertyHooks->mNativeProperties;
|
||||
if (!XrayResolveUnforgeableProperty(cx, wrapper, obj, id, desc, cacheOnHolder,
|
||||
nativeProperties.regular)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!desc.object() && xpc::AccessCheck::isChrome(wrapper) &&
|
||||
!XrayResolveUnforgeableProperty(cx, wrapper, obj, id, desc, cacheOnHolder,
|
||||
nativeProperties.chromeOnly)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (desc.object()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsInstance(type)) {
|
||||
if (resolveOwnProperty) {
|
||||
if (!resolveOwnProperty(cx, wrapper, obj, id, desc)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (desc.object()) {
|
||||
// None of these should be cached on the holder, since they're dynamic.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// If we're a special scope for in-content XBL, our script expects to see
|
||||
// the bound XBL methods and attributes when accessing content. However,
|
||||
// these members are implemented in content via custom-spliced prototypes,
|
||||
// and thus aren't visible through Xray wrappers unless we handle them
|
||||
// explicitly. So we check if we're running in such a scope, and if so,
|
||||
// whether the wrappee is a bound element. If it is, we do a lookup via
|
||||
// specialized XBL machinery.
|
||||
//
|
||||
// While we have to do some sketchy walking through content land, we should
|
||||
// be protected by read-only/non-configurable properties, and any functions
|
||||
// we end up with should _always_ be living in our own scope (the XBL scope).
|
||||
// Make sure to assert that.
|
||||
Element* element;
|
||||
if (xpc::ObjectScope(wrapper)->IsContentXBLScope() &&
|
||||
NS_SUCCEEDED(UNWRAP_OBJECT(Element, obj, element))) {
|
||||
if (!nsContentUtils::LookupBindingMember(cx, element, id, desc)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_CheckXBLLookup(cx, desc.address());
|
||||
|
||||
if (desc.object()) {
|
||||
// XBL properties shouldn't be cached on the holder, as they might be
|
||||
// shadowed by own properties returned from mResolveOwnProperty.
|
||||
desc.object().set(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// For non-global instance Xrays there are no other properties, so return
|
||||
// here for them.
|
||||
if (type != eGlobalInstance || !GlobalPropertiesAreOwn()) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == eInterface) {
|
||||
if (IdEquals(id, "prototype")) {
|
||||
return nativePropertyHooks->mPrototypeID == prototypes::id::_ID_Count ||
|
||||
ResolvePrototypeOrConstructor(cx, wrapper, obj,
|
||||
nativePropertyHooks->mPrototypeID,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY,
|
||||
desc, cacheOnHolder);
|
||||
}
|
||||
|
||||
if (IdEquals(id, "toString") && !JS_ObjectIsFunction(cx, obj)) {
|
||||
MOZ_ASSERT(IsDOMIfaceAndProtoClass(js::GetObjectClass(obj)));
|
||||
|
||||
JS::Rooted<JSFunction*> toString(cx, JS_NewFunction(cx, InterfaceObjectToString, 0, 0, wrapper, "toString"));
|
||||
if (!toString) {
|
||||
return false;
|
||||
}
|
||||
|
||||
cacheOnHolder = true;
|
||||
|
||||
FillPropertyDescriptor(desc, wrapper, 0,
|
||||
JS::ObjectValue(*JS_GetFunctionObject(toString)));
|
||||
|
||||
return JS_WrapPropertyDescriptor(cx, desc);
|
||||
}
|
||||
} else {
|
||||
MOZ_ASSERT(IsInterfacePrototype(type));
|
||||
|
||||
if (IdEquals(id, "constructor")) {
|
||||
return nativePropertyHooks->mConstructorID == constructors::id::_ID_Count ||
|
||||
ResolvePrototypeOrConstructor(cx, wrapper, obj,
|
||||
nativePropertyHooks->mConstructorID,
|
||||
0, desc, cacheOnHolder);
|
||||
}
|
||||
|
||||
// The properties for globals live on the instance, so return here as there
|
||||
// are no properties on their interface prototype object.
|
||||
if (type == eGlobalInterfacePrototype && GlobalPropertiesAreOwn()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (nativeProperties.regular &&
|
||||
!XrayResolveProperty(cx, wrapper, obj, id, desc, cacheOnHolder, type,
|
||||
@ -1318,43 +1381,6 @@ XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Handle<JSObject*> obj,
|
||||
JS::Handle<jsid> id, JS::MutableHandle<JSPropertyDescriptor> desc,
|
||||
bool& cacheOnHolder)
|
||||
{
|
||||
cacheOnHolder = false;
|
||||
|
||||
DOMObjectType type;
|
||||
const NativePropertyHooks* nativePropertyHooks =
|
||||
GetNativePropertyHooks(cx, obj, type);
|
||||
|
||||
if (type == eInstance) {
|
||||
// Force the type to be eInterfacePrototype, since we need to walk the
|
||||
// prototype chain.
|
||||
type = eInterfacePrototype;
|
||||
}
|
||||
|
||||
if (type == eInterfacePrototype) {
|
||||
do {
|
||||
if (!XrayResolveNativeProperty(cx, wrapper, nativePropertyHooks, type,
|
||||
obj, id, desc, cacheOnHolder)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (desc.object()) {
|
||||
return true;
|
||||
}
|
||||
} while ((nativePropertyHooks = nativePropertyHooks->mProtoHooks));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return XrayResolveNativeProperty(cx, wrapper, nativePropertyHooks, type, obj,
|
||||
id, desc, cacheOnHolder);
|
||||
}
|
||||
|
||||
bool
|
||||
XrayDefineProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||
@ -1411,14 +1437,20 @@ XrayEnumerateProperties(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
DOMObjectType type,
|
||||
const NativeProperties* nativeProperties)
|
||||
{
|
||||
if (type == eInstance) {
|
||||
MOZ_ASSERT(type != eNamedPropertiesObject);
|
||||
|
||||
if (IsInstance(type)) {
|
||||
ENUMERATE_IF_DEFINED(unforgeableMethod);
|
||||
ENUMERATE_IF_DEFINED(unforgeableAttribute);
|
||||
if (type == eGlobalInstance && GlobalPropertiesAreOwn()) {
|
||||
ENUMERATE_IF_DEFINED(method);
|
||||
ENUMERATE_IF_DEFINED(attribute);
|
||||
}
|
||||
} else if (type == eInterface) {
|
||||
ENUMERATE_IF_DEFINED(staticMethod);
|
||||
ENUMERATE_IF_DEFINED(staticAttribute);
|
||||
} else {
|
||||
MOZ_ASSERT(type == eInterfacePrototype);
|
||||
} else if (type != eGlobalInterfacePrototype || !GlobalPropertiesAreOwn()) {
|
||||
MOZ_ASSERT(IsInterfacePrototype(type));
|
||||
ENUMERATE_IF_DEFINED(method);
|
||||
ENUMERATE_IF_DEFINED(attribute);
|
||||
}
|
||||
@ -1447,16 +1479,19 @@ XrayEnumerateProperties(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
bool
|
||||
XrayEnumerateNativeProperties(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
const NativePropertyHooks* nativePropertyHooks,
|
||||
DOMObjectType type, JS::Handle<JSObject*> obj,
|
||||
unsigned flags, JS::AutoIdVector& props)
|
||||
DOMObjectType type,
|
||||
JS::Handle<JSObject*> obj, unsigned flags,
|
||||
JS::AutoIdVector& props)
|
||||
{
|
||||
MOZ_ASSERT(type != eNamedPropertiesObject);
|
||||
|
||||
if (type == eInterface &&
|
||||
nativePropertyHooks->mPrototypeID != prototypes::id::_ID_Count &&
|
||||
!AddStringToIDVector(cx, props, "prototype")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type == eInterfacePrototype &&
|
||||
if (IsInterfacePrototype(type) &&
|
||||
nativePropertyHooks->mConstructorID != constructors::id::_ID_Count &&
|
||||
(flags & JSITER_HIDDEN) &&
|
||||
!AddStringToIDVector(cx, props, "constructor")) {
|
||||
@ -1490,45 +1525,24 @@ XrayEnumerateProperties(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
DOMObjectType type;
|
||||
const NativePropertyHooks* nativePropertyHooks =
|
||||
GetNativePropertyHooks(cx, obj, type);
|
||||
EnumerateOwnProperties enumerateOwnProperties =
|
||||
nativePropertyHooks->mEnumerateOwnProperties;
|
||||
|
||||
if (type == eInstance) {
|
||||
if (nativePropertyHooks->mEnumerateOwnProperties &&
|
||||
!nativePropertyHooks->mEnumerateOwnProperties(cx, wrapper, obj,
|
||||
props)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handle Unforgeable properties.
|
||||
if (!XrayEnumerateNativeProperties(cx, wrapper, nativePropertyHooks, type,
|
||||
obj, flags, props)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flags & JSITER_OWNONLY) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Force the type to be eInterfacePrototype, since we need to walk the
|
||||
// prototype chain.
|
||||
type = eInterfacePrototype;
|
||||
if (type == eNamedPropertiesObject) {
|
||||
return enumerateOwnProperties(cx, wrapper, obj, props);
|
||||
}
|
||||
|
||||
if (type == eInterfacePrototype) {
|
||||
do {
|
||||
if (!XrayEnumerateNativeProperties(cx, wrapper, nativePropertyHooks, type,
|
||||
obj, flags, props)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flags & JSITER_OWNONLY) {
|
||||
return true;
|
||||
}
|
||||
} while ((nativePropertyHooks = nativePropertyHooks->mProtoHooks));
|
||||
|
||||
return true;
|
||||
if (IsInstance(type)) {
|
||||
// FIXME https://bugzilla.mozilla.org/show_bug.cgi?id=1071189
|
||||
// Should do something about XBL properties too.
|
||||
if (enumerateOwnProperties &&
|
||||
!enumerateOwnProperties(cx, wrapper, obj, props)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return XrayEnumerateNativeProperties(cx, wrapper, nativePropertyHooks, type,
|
||||
return (type == eGlobalInterfacePrototype && GlobalPropertiesAreOwn()) ||
|
||||
XrayEnumerateNativeProperties(cx, wrapper, nativePropertyHooks, type,
|
||||
obj, flags, props);
|
||||
}
|
||||
|
||||
@ -1652,85 +1666,6 @@ DictionaryBase::AppendJSONToString(const char16_t* aJSONData,
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSString*
|
||||
ConcatJSString(JSContext* cx, const char* pre, JS::Handle<JSString*> str, const char* post)
|
||||
{
|
||||
if (!str) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JS::Rooted<JSString*> preString(cx, JS_NewStringCopyN(cx, pre, strlen(pre)));
|
||||
JS::Rooted<JSString*> postString(cx, JS_NewStringCopyN(cx, post, strlen(post)));
|
||||
if (!preString || !postString) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
preString = JS_ConcatStrings(cx, preString, str);
|
||||
if (!preString) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return JS_ConcatStrings(cx, preString, postString);
|
||||
}
|
||||
|
||||
bool
|
||||
NativeToString(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Handle<JSObject*> obj,
|
||||
JS::MutableHandle<JS::Value> v)
|
||||
{
|
||||
JS::Rooted<JSPropertyDescriptor> toStringDesc(cx);
|
||||
toStringDesc.object().set(nullptr);
|
||||
toStringDesc.setAttributes(0);
|
||||
toStringDesc.setGetter(nullptr);
|
||||
toStringDesc.setSetter(nullptr);
|
||||
toStringDesc.value().set(JS::UndefinedValue());
|
||||
JS::Rooted<jsid> id(cx,
|
||||
nsXPConnect::GetRuntimeInstance()->GetStringID(XPCJSRuntime::IDX_TO_STRING));
|
||||
bool unused;
|
||||
if (!XrayResolveNativeProperty(cx, wrapper, obj, id, &toStringDesc, unused)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<JSString*> str(cx);
|
||||
{
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
if (toStringDesc.object()) {
|
||||
JS::Rooted<JS::Value> toString(cx, toStringDesc.value());
|
||||
if (!JS_WrapValue(cx, &toString)) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(JS::IsCallable(&toString.toObject()));
|
||||
JS::Rooted<JS::Value> toStringResult(cx);
|
||||
if (JS_CallFunctionValue(cx, obj, toString, JS::HandleValueArray::empty(),
|
||||
&toStringResult)) {
|
||||
str = toStringResult.toString();
|
||||
} else {
|
||||
str = nullptr;
|
||||
}
|
||||
} else {
|
||||
const js::Class* clasp = js::GetObjectClass(obj);
|
||||
if (IsDOMClass(clasp)) {
|
||||
str = JS_NewStringCopyZ(cx, clasp->name);
|
||||
str = ConcatJSString(cx, "[object ", str, "]");
|
||||
} else if (IsDOMIfaceAndProtoClass(clasp)) {
|
||||
const DOMIfaceAndProtoJSClass* ifaceAndProtoJSClass =
|
||||
DOMIfaceAndProtoJSClass::FromJSClass(clasp);
|
||||
str = JS_NewStringCopyZ(cx, ifaceAndProtoJSClass->mToString);
|
||||
} else {
|
||||
MOZ_ASSERT(JS_IsNativeFunction(obj, Constructor));
|
||||
JS::Rooted<JSFunction*> fun(cx, JS_GetObjectFunction(obj));
|
||||
str = JS_DecompileFunction(cx, fun, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!str) {
|
||||
return false;
|
||||
}
|
||||
|
||||
v.setString(str);
|
||||
return JS_WrapValue(cx, v);
|
||||
}
|
||||
|
||||
// Dynamically ensure that two objects don't end up with the same reserved slot.
|
||||
class MOZ_STACK_CLASS AutoCloneDOMObjectSlotGuard
|
||||
|
@ -180,14 +180,16 @@ UnwrapDOMObject(JSObject* obj)
|
||||
return static_cast<T*>(val.toPrivate());
|
||||
}
|
||||
|
||||
inline const DOMJSClass*
|
||||
GetDOMClass(const js::Class* clasp)
|
||||
{
|
||||
return IsDOMClass(clasp) ? DOMJSClass::FromJSClass(clasp) : nullptr;
|
||||
}
|
||||
|
||||
inline const DOMJSClass*
|
||||
GetDOMClass(JSObject* obj)
|
||||
{
|
||||
const js::Class* clasp = js::GetObjectClass(obj);
|
||||
if (IsDOMClass(clasp)) {
|
||||
return DOMJSClass::FromJSClass(clasp);
|
||||
}
|
||||
return nullptr;
|
||||
return GetDOMClass(js::GetObjectClass(obj));
|
||||
}
|
||||
|
||||
inline nsISupports*
|
||||
@ -289,13 +291,17 @@ IsConvertibleToCallbackInterface(JSContext* cx, JS::Handle<JSObject*> obj)
|
||||
return IsNotDateOrRegExp(cx, obj);
|
||||
}
|
||||
|
||||
// The items in the protoAndIfaceCache are indexed by the prototypes::id::ID and
|
||||
// constructors::id::ID enums, in that order. The end of the prototype objects
|
||||
// should be the start of the interface objects.
|
||||
// The items in the protoAndIfaceCache are indexed by the prototypes::id::ID,
|
||||
// constructors::id::ID and namedpropertiesobjects::id::ID enums, in that order.
|
||||
// The end of the prototype objects should be the start of the interface
|
||||
// objects, and the end of the interface objects should be the start of the
|
||||
// named properties objects.
|
||||
static_assert((size_t)constructors::id::_ID_Start ==
|
||||
(size_t)prototypes::id::_ID_Count,
|
||||
(size_t)prototypes::id::_ID_Count &&
|
||||
(size_t)namedpropertiesobjects::id::_ID_Start ==
|
||||
(size_t)constructors::id::_ID_Count,
|
||||
"Overlapping or discontiguous indexes.");
|
||||
const size_t kProtoAndIfaceCacheCount = constructors::id::_ID_Count;
|
||||
const size_t kProtoAndIfaceCacheCount = namedpropertiesobjects::id::_ID_Count;
|
||||
|
||||
class ProtoAndIfaceCache
|
||||
{
|
||||
@ -597,9 +603,9 @@ struct NamedConstructor
|
||||
void
|
||||
CreateInterfaceObjects(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Handle<JSObject*> protoProto,
|
||||
const JSClass* protoClass, JS::Heap<JSObject*>* protoCache,
|
||||
const js::Class* protoClass, JS::Heap<JSObject*>* protoCache,
|
||||
JS::Handle<JSObject*> interfaceProto,
|
||||
const JSClass* constructorClass, const JSNativeHolder* constructor,
|
||||
const js::Class* constructorClass, const JSNativeHolder* constructor,
|
||||
unsigned ctorNargs, const NamedConstructor* namedConstructors,
|
||||
JS::Heap<JSObject*>* constructorCache,
|
||||
const NativeProperties* regularProperties,
|
||||
@ -2311,7 +2317,7 @@ AddStringToIDVector(JSContext* cx, JS::AutoIdVector& vector, const char* name)
|
||||
// Implementation of the bits that XrayWrapper needs
|
||||
|
||||
/**
|
||||
* This resolves indexed or named properties of obj.
|
||||
* This resolves operations, attributes and constants of the interfaces for obj.
|
||||
*
|
||||
* wrapper is the Xray JS object.
|
||||
* obj is the target object of the Xray, a binding's instance object or a
|
||||
@ -2324,19 +2330,6 @@ XrayResolveOwnProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::MutableHandle<JSPropertyDescriptor> desc,
|
||||
bool& cacheOnHolder);
|
||||
|
||||
/**
|
||||
* This resolves operations, attributes and constants of the interfaces for obj.
|
||||
*
|
||||
* wrapper is the Xray JS object.
|
||||
* obj is the target object of the Xray, a binding's instance object or a
|
||||
* interface or interface prototype object.
|
||||
*/
|
||||
bool
|
||||
XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Handle<JSObject*> obj,
|
||||
JS::Handle<jsid> id, JS::MutableHandle<JSPropertyDescriptor> desc,
|
||||
bool& cacheOnHolder);
|
||||
|
||||
/**
|
||||
* Define a property on obj through an Xray wrapper.
|
||||
*
|
||||
@ -2364,6 +2357,43 @@ XrayEnumerateProperties(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Handle<JSObject*> obj,
|
||||
unsigned flags, JS::AutoIdVector& props);
|
||||
|
||||
/**
|
||||
* Returns the prototype to use for an Xray for a DOM object, wrapped in cx's
|
||||
* compartment. This always returns the prototype that would be used for a DOM
|
||||
* object if we ignore any changes that might have been done to the prototype
|
||||
* chain by JS, the XBL code or plugins.
|
||||
*
|
||||
* cx should be in the Xray's compartment.
|
||||
* obj is the target object of the Xray, a binding's instance object or an
|
||||
* interface or interface prototype object.
|
||||
*/
|
||||
inline bool
|
||||
XrayGetNativeProto(JSContext* cx, JS::Handle<JSObject*> obj,
|
||||
JS::MutableHandle<JSObject*> protop)
|
||||
{
|
||||
JS::Rooted<JSObject*> global(cx, js::GetGlobalForObjectCrossCompartment(obj));
|
||||
{
|
||||
JSAutoCompartment ac(cx, global);
|
||||
const DOMJSClass* domClass = GetDOMClass(obj);
|
||||
if (domClass) {
|
||||
ProtoHandleGetter protoGetter = domClass->mGetProto;
|
||||
if (protoGetter) {
|
||||
protop.set(protoGetter(cx, global));
|
||||
} else {
|
||||
protop.set(JS_GetObjectPrototype(cx, global));
|
||||
}
|
||||
} else {
|
||||
const js::Class* clasp = js::GetObjectClass(obj);
|
||||
MOZ_ASSERT(IsDOMIfaceAndProtoClass(clasp));
|
||||
ProtoGetter protoGetter =
|
||||
DOMIfaceAndProtoJSClass::FromJSClass(clasp)->mGetParentProto;
|
||||
protop.set(protoGetter(cx, global));
|
||||
}
|
||||
}
|
||||
|
||||
return JS_WrapObject(cx, protop);
|
||||
}
|
||||
|
||||
extern NativePropertyHooks sWorkerNativePropertyHooks;
|
||||
|
||||
// We use one constructor JSNative to represent all DOM interface objects (so
|
||||
@ -2421,23 +2451,6 @@ MustInheritFromNonRefcountedDOMObject(NonRefcountedDOMObject*)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* This creates a JSString containing the value that the toString function for
|
||||
* obj should create according to the WebIDL specification, ignoring any
|
||||
* modifications by script. The value is prefixed with pre and postfixed with
|
||||
* post, unless this is called for an object that has a stringifier. It is
|
||||
* specifically for use by Xray code.
|
||||
*
|
||||
* wrapper is the Xray JS object.
|
||||
* obj is the target object of the Xray, a binding's instance object or a
|
||||
* interface or interface prototype object.
|
||||
* v contains the JSString for the value if the function returns true.
|
||||
*/
|
||||
bool
|
||||
NativeToString(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Handle<JSObject*> obj,
|
||||
JS::MutableHandle<JS::Value> v);
|
||||
|
||||
HAS_MEMBER(JSBindingFinalized)
|
||||
|
||||
template<class T, bool hasCallback=HasJSBindingFinalizedMember<T>::Value>
|
||||
@ -2833,7 +2846,7 @@ struct CreateGlobalOptions<nsGlobalWindow>
|
||||
nsresult
|
||||
RegisterDOMNames();
|
||||
|
||||
template <class T, ProtoGetter GetProto>
|
||||
template <class T, ProtoHandleGetter GetProto>
|
||||
bool
|
||||
CreateGlobal(JSContext* aCx, T* aNative, nsWrapperCache* aCache,
|
||||
const JSClass* aClass, JS::CompartmentOptions& aOptions,
|
||||
@ -3013,6 +3026,13 @@ template<class T, template<typename> class SmartPtr, class S>
|
||||
inline void
|
||||
StrongOrRawPtr(SmartPtr<S>&& aPtr) MOZ_DELETE;
|
||||
|
||||
inline
|
||||
JSObject*
|
||||
GetErrorPrototype(JSContext* aCx, JS::Handle<JSObject*> aForObj)
|
||||
{
|
||||
return JS_GetErrorPrototype(aCx);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -702,6 +702,15 @@ DOMInterfaces = {
|
||||
'nativeType': 'mozilla::dom::CellBroadcast',
|
||||
},
|
||||
|
||||
'MozCellBroadcastEtwsInfo': {
|
||||
'nativeType': 'mozilla::dom::CellBroadcastEtwsInfo',
|
||||
'headerFile': 'CellBroadcastMessage.h'
|
||||
},
|
||||
|
||||
'MozCellBroadcastMessage': {
|
||||
'nativeType': 'mozilla::dom::CellBroadcastMessage',
|
||||
},
|
||||
|
||||
'MozIcc': {
|
||||
'nativeType': 'mozilla::dom::Icc',
|
||||
},
|
||||
|
@ -298,9 +298,9 @@ class CGNativePropertyHooks(CGThing):
|
||||
prototypeID += self.descriptor.name
|
||||
else:
|
||||
prototypeID += "_ID_Count"
|
||||
parent = self.descriptor.interface.parent
|
||||
parentHooks = (toBindingNamespace(parent.identifier.name) + "::sNativePropertyHooks"
|
||||
if parent else 'nullptr')
|
||||
parentProtoName = self.descriptor.parentPrototypeName
|
||||
parentHooks = (toBindingNamespace(parentProtoName) + "::sNativePropertyHooks"
|
||||
if parentProtoName else 'nullptr')
|
||||
|
||||
return fill(
|
||||
"""
|
||||
@ -327,10 +327,7 @@ def NativePropertyHooks(descriptor):
|
||||
|
||||
|
||||
def DOMClass(descriptor):
|
||||
def make_name(d):
|
||||
return "%s%s" % (d.interface.identifier.name, '_workers' if d.workers else '')
|
||||
|
||||
protoList = ['prototypes::id::' + make_name(descriptor.getDescriptor(proto)) for proto in descriptor.prototypeChain]
|
||||
protoList = ['prototypes::id::' + proto for proto in descriptor.prototypeNameChain]
|
||||
# Pad out the list to the right length with _ID_Count so we
|
||||
# guarantee that all the lists are the same length. _ID_Count
|
||||
# is never the ID of any prototype, so it's safe to use as
|
||||
@ -343,7 +340,7 @@ def DOMClass(descriptor):
|
||||
IsBaseOf<nsISupports, ${nativeType} >::value,
|
||||
${hooks},
|
||||
GetParentObject<${nativeType}>::Get,
|
||||
GetProtoObject,
|
||||
GetProtoObjectHandle,
|
||||
GetCCParticipant<${nativeType}>::Get()
|
||||
""",
|
||||
protoChain=', '.join(protoList),
|
||||
@ -605,6 +602,36 @@ def CallOnUnforgeableHolder(descriptor, code, isXrayCheck=None,
|
||||
code=code)
|
||||
|
||||
|
||||
def InterfacePrototypeObjectProtoGetter(descriptor):
|
||||
"""
|
||||
Returns a tuple with two elements:
|
||||
|
||||
1) The name of the function to call to get the prototype to use for the
|
||||
interface prototype object as a JSObject*.
|
||||
|
||||
2) The name of the function to call to get the prototype to use for the
|
||||
interface prototype object as a JS::Handle<JSObject*> or None if no
|
||||
such function exists.
|
||||
"""
|
||||
parentProtoName = descriptor.parentPrototypeName
|
||||
if descriptor.hasNamedPropertiesObject:
|
||||
protoGetter = "GetNamedPropertiesObject"
|
||||
protoHandleGetter = None
|
||||
elif parentProtoName is None:
|
||||
if descriptor.interface.getExtendedAttribute("ArrayClass"):
|
||||
protoGetter = "JS_GetArrayPrototype"
|
||||
elif descriptor.interface.getExtendedAttribute("ExceptionClass"):
|
||||
protoGetter = "GetErrorPrototype"
|
||||
else:
|
||||
protoGetter = "JS_GetObjectPrototype"
|
||||
protoHandleGetter = None
|
||||
else:
|
||||
prefix = toBindingNamespace(parentProtoName)
|
||||
protoGetter = prefix + "::GetProtoObject"
|
||||
protoHandleGetter = prefix + "::GetProtoObjectHandle"
|
||||
|
||||
return (protoGetter, protoHandleGetter)
|
||||
|
||||
class CGPrototypeJSClass(CGThing):
|
||||
def __init__(self, descriptor, properties):
|
||||
CGThing.__init__(self)
|
||||
@ -620,6 +647,8 @@ class CGPrototypeJSClass(CGThing):
|
||||
slotCount = "DOM_INTERFACE_PROTO_SLOTS_BASE"
|
||||
if UseHolderForUnforgeable(self.descriptor):
|
||||
slotCount += " + 1 /* slot for the JSObject holding the unforgeable properties */"
|
||||
(protoGetter, _) = InterfacePrototypeObjectProtoGetter(self.descriptor)
|
||||
type = "eGlobalInterfacePrototype" if self.descriptor.isGlobal() else "eInterfacePrototype"
|
||||
return fill(
|
||||
"""
|
||||
static const DOMIfaceAndProtoJSClass PrototypeClass = {
|
||||
@ -638,25 +667,55 @@ class CGPrototypeJSClass(CGThing):
|
||||
nullptr, /* hasInstance */
|
||||
nullptr, /* construct */
|
||||
nullptr, /* trace */
|
||||
JSCLASS_NO_INTERNAL_MEMBERS
|
||||
JS_NULL_CLASS_SPEC,
|
||||
JS_NULL_CLASS_EXT,
|
||||
JS_NULL_OBJECT_OPS
|
||||
},
|
||||
eInterfacePrototype,
|
||||
${type},
|
||||
${hooks},
|
||||
"[object ${name}Prototype]",
|
||||
${prototypeID},
|
||||
${depth}
|
||||
${depth},
|
||||
${protoGetter}
|
||||
};
|
||||
""",
|
||||
name=self.descriptor.interface.identifier.name,
|
||||
slotCount=slotCount,
|
||||
type=type,
|
||||
hooks=NativePropertyHooks(self.descriptor),
|
||||
prototypeID=prototypeID,
|
||||
depth=depth)
|
||||
depth=depth,
|
||||
protoGetter=protoGetter)
|
||||
|
||||
|
||||
def NeedsGeneratedHasInstance(descriptor):
|
||||
return descriptor.hasXPConnectImpls or descriptor.interface.isConsequential()
|
||||
|
||||
def InterfaceObjectProtoGetter(descriptor):
|
||||
"""
|
||||
Returns a tuple with two elements:
|
||||
|
||||
1) The name of the function to call to get the prototype to use for the
|
||||
interface object as a JSObject*.
|
||||
|
||||
2) The name of the function to call to get the prototype to use for the
|
||||
interface prototype as a JS::Handle<JSObject*> or None if no such
|
||||
function exists.
|
||||
"""
|
||||
parentWithInterfaceObject = descriptor.interface.parent
|
||||
while (parentWithInterfaceObject and
|
||||
not parentWithInterfaceObject.hasInterfaceObject()):
|
||||
parentWithInterfaceObject = parentWithInterfaceObject.parent
|
||||
if parentWithInterfaceObject:
|
||||
parentIfaceName = parentWithInterfaceObject.identifier.name
|
||||
parentDesc = descriptor.getDescriptor(parentIfaceName)
|
||||
prefix = toBindingNamespace(parentDesc.name)
|
||||
protoGetter = prefix + "::GetConstructorObject"
|
||||
protoHandleGetter = prefix + "::GetConstructorObjectHandle"
|
||||
else:
|
||||
protoGetter = "JS_GetFunctionPrototype"
|
||||
protoHandleGetter = None
|
||||
return (protoGetter, protoHandleGetter)
|
||||
|
||||
class CGInterfaceObjectJSClass(CGThing):
|
||||
def __init__(self, descriptor, properties):
|
||||
@ -684,6 +743,8 @@ class CGInterfaceObjectJSClass(CGThing):
|
||||
if len(self.descriptor.interface.namedConstructors) > 0:
|
||||
slotCount += (" + %i /* slots for the named constructors */" %
|
||||
len(self.descriptor.interface.namedConstructors))
|
||||
(protoGetter, _) = InterfaceObjectProtoGetter(self.descriptor)
|
||||
|
||||
return fill(
|
||||
"""
|
||||
static const DOMIfaceAndProtoJSClass InterfaceObjectClass = {
|
||||
@ -702,13 +763,16 @@ class CGInterfaceObjectJSClass(CGThing):
|
||||
${hasInstance}, /* hasInstance */
|
||||
${ctorname}, /* construct */
|
||||
nullptr, /* trace */
|
||||
JSCLASS_NO_INTERNAL_MEMBERS
|
||||
JS_NULL_CLASS_SPEC,
|
||||
JS_NULL_CLASS_EXT,
|
||||
JS_NULL_OBJECT_OPS
|
||||
},
|
||||
eInterface,
|
||||
${hooks},
|
||||
"function ${name}() {\\n [native code]\\n}",
|
||||
${prototypeID},
|
||||
${depth}
|
||||
${depth},
|
||||
${protoGetter}
|
||||
};
|
||||
""",
|
||||
slotCount=slotCount,
|
||||
@ -717,7 +781,8 @@ class CGInterfaceObjectJSClass(CGThing):
|
||||
hooks=NativePropertyHooks(self.descriptor),
|
||||
name=self.descriptor.interface.identifier.name,
|
||||
prototypeID=prototypeID,
|
||||
depth=depth)
|
||||
depth=depth,
|
||||
protoGetter=protoGetter)
|
||||
|
||||
|
||||
class CGList(CGThing):
|
||||
@ -2578,38 +2643,23 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
|
||||
self.properties = properties
|
||||
|
||||
def definition_body(self):
|
||||
if len(self.descriptor.prototypeChain) == 1:
|
||||
(protoGetter, protoHandleGetter) = InterfacePrototypeObjectProtoGetter(self.descriptor)
|
||||
if protoHandleGetter is None:
|
||||
parentProtoType = "Rooted"
|
||||
if self.descriptor.interface.getExtendedAttribute("ArrayClass"):
|
||||
getParentProto = "aCx, JS_GetArrayPrototype(aCx, aGlobal)"
|
||||
elif self.descriptor.interface.getExtendedAttribute("ExceptionClass"):
|
||||
getParentProto = "aCx, JS_GetErrorPrototype(aCx)"
|
||||
else:
|
||||
getParentProto = "aCx, JS_GetObjectPrototype(aCx, aGlobal)"
|
||||
getParentProto = "aCx, " + protoGetter
|
||||
else:
|
||||
parentProtoName = self.descriptor.prototypeChain[-2]
|
||||
parentDesc = self.descriptor.getDescriptor(parentProtoName)
|
||||
if parentDesc.workers:
|
||||
parentProtoName += '_workers'
|
||||
getParentProto = ("%s::GetProtoObject(aCx, aGlobal)" %
|
||||
toBindingNamespace(parentProtoName))
|
||||
parentProtoType = "Handle"
|
||||
getParentProto = protoHandleGetter
|
||||
getParentProto = getParentProto + "(aCx, aGlobal)"
|
||||
|
||||
parentWithInterfaceObject = self.descriptor.interface.parent
|
||||
while (parentWithInterfaceObject and
|
||||
not parentWithInterfaceObject.hasInterfaceObject()):
|
||||
parentWithInterfaceObject = parentWithInterfaceObject.parent
|
||||
if parentWithInterfaceObject:
|
||||
parentIfaceName = parentWithInterfaceObject.identifier.name
|
||||
parentDesc = self.descriptor.getDescriptor(parentIfaceName)
|
||||
if parentDesc.workers:
|
||||
parentIfaceName += "_workers"
|
||||
getConstructorProto = ("%s::GetConstructorObject(aCx, aGlobal)" %
|
||||
toBindingNamespace(parentIfaceName))
|
||||
constructorProtoType = "Handle"
|
||||
else:
|
||||
getConstructorProto = "aCx, JS_GetFunctionPrototype(aCx, aGlobal)"
|
||||
(protoGetter, protoHandleGetter) = InterfaceObjectProtoGetter(self.descriptor)
|
||||
if protoHandleGetter is None:
|
||||
getConstructorProto = "aCx, " + protoGetter
|
||||
constructorProtoType = "Rooted"
|
||||
else:
|
||||
getConstructorProto = protoHandleGetter
|
||||
constructorProtoType = "Handle"
|
||||
getConstructorProto += "(aCx, aGlobal)"
|
||||
|
||||
needInterfaceObject = self.descriptor.interface.hasInterfaceObject()
|
||||
needInterfacePrototypeObject = self.descriptor.interface.hasInterfacePrototypeObject()
|
||||
@ -2814,12 +2864,12 @@ class CGGetPerInterfaceObject(CGAbstractMethod):
|
||||
id=self.id)
|
||||
|
||||
|
||||
class CGGetProtoObjectMethod(CGGetPerInterfaceObject):
|
||||
class CGGetProtoObjectHandleMethod(CGGetPerInterfaceObject):
|
||||
"""
|
||||
A method for getting the interface prototype object.
|
||||
"""
|
||||
def __init__(self, descriptor):
|
||||
CGGetPerInterfaceObject.__init__(self, descriptor, "GetProtoObject",
|
||||
CGGetPerInterfaceObject.__init__(self, descriptor, "GetProtoObjectHandle",
|
||||
"prototypes::")
|
||||
|
||||
def definition_body(self):
|
||||
@ -2831,13 +2881,25 @@ class CGGetProtoObjectMethod(CGGetPerInterfaceObject):
|
||||
""") + CGGetPerInterfaceObject.definition_body(self)
|
||||
|
||||
|
||||
class CGGetConstructorObjectMethod(CGGetPerInterfaceObject):
|
||||
class CGGetProtoObjectMethod(CGAbstractMethod):
|
||||
"""
|
||||
A method for getting the interface prototype object.
|
||||
"""
|
||||
def __init__(self, descriptor):
|
||||
CGAbstractMethod.__init__(
|
||||
self, descriptor, "GetProtoObject", "JSObject*", [Argument('JSContext*', 'aCx'),
|
||||
Argument('JS::Handle<JSObject*>', 'aGlobal')])
|
||||
|
||||
def definition_body(self):
|
||||
return "return GetProtoObjectHandle(aCx, aGlobal);\n"
|
||||
|
||||
class CGGetConstructorObjectHandleMethod(CGGetPerInterfaceObject):
|
||||
"""
|
||||
A method for getting the interface constructor object.
|
||||
"""
|
||||
def __init__(self, descriptor):
|
||||
CGGetPerInterfaceObject.__init__(
|
||||
self, descriptor, "GetConstructorObject",
|
||||
self, descriptor, "GetConstructorObjectHandle",
|
||||
"constructors::",
|
||||
extraArgs=[Argument("bool", "aDefineOnGlobal", "true")])
|
||||
|
||||
@ -2848,6 +2910,73 @@ class CGGetConstructorObjectMethod(CGGetPerInterfaceObject):
|
||||
|
||||
""") + CGGetPerInterfaceObject.definition_body(self)
|
||||
|
||||
class CGGetConstructorObjectMethod(CGAbstractMethod):
|
||||
"""
|
||||
A method for getting the interface constructor object.
|
||||
"""
|
||||
def __init__(self, descriptor):
|
||||
CGAbstractMethod.__init__(
|
||||
self, descriptor, "GetConstructorObject", "JSObject*", [Argument('JSContext*', 'aCx'),
|
||||
Argument('JS::Handle<JSObject*>', 'aGlobal')])
|
||||
|
||||
def definition_body(self):
|
||||
return "return GetConstructorObjectHandle(aCx, aGlobal);\n"
|
||||
|
||||
class CGGetNamedPropertiesObjectMethod(CGAbstractStaticMethod):
|
||||
def __init__(self, descriptor):
|
||||
args = [Argument('JSContext*', 'aCx'),
|
||||
Argument('JS::Handle<JSObject*>', 'aGlobal')]
|
||||
CGAbstractStaticMethod.__init__(self, descriptor,
|
||||
'GetNamedPropertiesObject',
|
||||
'JSObject*', args)
|
||||
|
||||
def definition_body(self):
|
||||
parentProtoName = self.descriptor.parentPrototypeName
|
||||
if parentProtoName is None:
|
||||
getParentProto = ""
|
||||
parentProto = "nullptr"
|
||||
else:
|
||||
getParentProto = fill(
|
||||
"""
|
||||
JS::Rooted<JSObject*> parentProto(aCx, ${parent}::GetProtoObjectHandle(aCx, aGlobal));
|
||||
if (!parentProto) {
|
||||
return nullptr;
|
||||
}
|
||||
""",
|
||||
parent=toBindingNamespace(parentProtoName))
|
||||
parentProto = "parentProto"
|
||||
return fill(
|
||||
"""
|
||||
/* Make sure our global is sane. Hopefully we can remove this sometime */
|
||||
if (!(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Check to see whether the named properties object has already been created */
|
||||
ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(aGlobal);
|
||||
|
||||
JS::Heap<JSObject*>& namedPropertiesObject = protoAndIfaceCache.EntrySlotOrCreate(namedpropertiesobjects::id::${ifaceName});
|
||||
if (!namedPropertiesObject) {
|
||||
$*{getParentProto}
|
||||
namedPropertiesObject = ${nativeType}::CreateNamedPropertiesObject(aCx, ${parentProto});
|
||||
DebugOnly<const DOMIfaceAndProtoJSClass*> clasp =
|
||||
DOMIfaceAndProtoJSClass::FromJSClass(js::GetObjectClass(namedPropertiesObject));
|
||||
MOZ_ASSERT(clasp->mType == eNamedPropertiesObject,
|
||||
"Expected ${nativeType}::CreateNamedPropertiesObject to return a named properties object");
|
||||
MOZ_ASSERT(clasp->mNativeHooks,
|
||||
"The named properties object for ${nativeType} should have NativePropertyHooks.");
|
||||
MOZ_ASSERT(clasp->mNativeHooks->mResolveOwnProperty,
|
||||
"Don't know how to resolve the properties of the named properties object for ${nativeType}.");
|
||||
MOZ_ASSERT(clasp->mNativeHooks->mEnumerateOwnProperties,
|
||||
"Don't know how to enumerate the properties of the named properties object for ${nativeType}.");
|
||||
}
|
||||
return namedPropertiesObject.get();
|
||||
""",
|
||||
getParentProto=getParentProto,
|
||||
ifaceName=self.descriptor.name,
|
||||
parentProto=parentProto,
|
||||
nativeType=self.descriptor.nativeType)
|
||||
|
||||
|
||||
class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
||||
"""
|
||||
@ -2874,7 +3003,7 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
||||
def definition_body(self):
|
||||
if len(self.descriptor.interface.namedConstructors) > 0:
|
||||
getConstructor = dedent("""
|
||||
JSObject* interfaceObject = GetConstructorObject(aCx, aGlobal, aDefineOnGlobal);
|
||||
JSObject* interfaceObject = GetConstructorObjectHandle(aCx, aGlobal, aDefineOnGlobal);
|
||||
if (!interfaceObject) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -2887,7 +3016,7 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
||||
return interfaceObject;
|
||||
""")
|
||||
else:
|
||||
getConstructor = "return GetConstructorObject(aCx, aGlobal, aDefineOnGlobal);\n"
|
||||
getConstructor = "return GetConstructorObjectHandle(aCx, aGlobal, aDefineOnGlobal);\n"
|
||||
return getConstructor
|
||||
|
||||
|
||||
@ -3168,7 +3297,7 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
|
||||
|
||||
JSAutoCompartment ac(aCx, parent);
|
||||
JS::Rooted<JSObject*> global(aCx, JS_GetGlobalForObject(aCx, parent));
|
||||
JS::Handle<JSObject*> proto = GetProtoObject(aCx, global);
|
||||
JS::Handle<JSObject*> proto = GetProtoObjectHandle(aCx, global);
|
||||
if (!proto) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -3224,7 +3353,7 @@ class CGWrapNonWrapperCacheMethod(CGAbstractMethod):
|
||||
$*{assertions}
|
||||
|
||||
JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
|
||||
JS::Handle<JSObject*> proto = GetProtoObject(aCx, global);
|
||||
JS::Handle<JSObject*> proto = GetProtoObjectHandle(aCx, global);
|
||||
if (!proto) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -3286,7 +3415,7 @@ class CGWrapGlobalMethod(CGAbstractMethod):
|
||||
"nsISupports must be on our primary inheritance chain");
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx);
|
||||
CreateGlobal<${nativeType}, GetProtoObject>(aCx,
|
||||
CreateGlobal<${nativeType}, GetProtoObjectHandle>(aCx,
|
||||
aObject,
|
||||
aCache,
|
||||
Class.ToJSClass(),
|
||||
@ -11016,6 +11145,9 @@ class CGDescriptor(CGThing):
|
||||
cgThings.append(CGNewResolveHook(descriptor))
|
||||
cgThings.append(CGEnumerateHook(descriptor))
|
||||
|
||||
if descriptor.hasNamedPropertiesObject:
|
||||
cgThings.append(CGGetNamedPropertiesObjectMethod(descriptor))
|
||||
|
||||
if descriptor.interface.hasInterfacePrototypeObject():
|
||||
cgThings.append(CGPrototypeJSClass(descriptor, properties))
|
||||
|
||||
@ -11085,8 +11217,11 @@ class CGDescriptor(CGThing):
|
||||
# CGGetProtoObjectMethod and CGGetConstructorObjectMethod need
|
||||
# to come after CGCreateInterfaceObjectsMethod.
|
||||
if descriptor.interface.hasInterfacePrototypeObject():
|
||||
cgThings.append(CGGetProtoObjectMethod(descriptor))
|
||||
cgThings.append(CGGetProtoObjectHandleMethod(descriptor))
|
||||
if descriptor.interface.hasChildInterfaces():
|
||||
cgThings.append(CGGetProtoObjectMethod(descriptor))
|
||||
if descriptor.interface.hasInterfaceObject():
|
||||
cgThings.append(CGGetConstructorObjectHandleMethod(descriptor))
|
||||
cgThings.append(CGGetConstructorObjectMethod(descriptor))
|
||||
|
||||
# See whether we need we need to generate an IsPermitted method
|
||||
@ -14172,6 +14307,18 @@ class GlobalGenRoots():
|
||||
|
||||
curr.append(idEnum)
|
||||
|
||||
# Named properties object enum.
|
||||
namedPropertiesObjects = [d.name for d in config.getDescriptors(hasNamedPropertiesObject=True)]
|
||||
idEnum = CGNamespacedEnum('id', 'ID', ['_ID_Start'] + namedPropertiesObjects,
|
||||
['constructors::id::_ID_Count', '_ID_Start'])
|
||||
|
||||
# Wrap all of that in our namespaces.
|
||||
idEnum = CGNamespace.build(['mozilla', 'dom', 'namedpropertiesobjects'],
|
||||
CGWrapper(idEnum, pre='\n'))
|
||||
idEnum = CGWrapper(idEnum, post='\n')
|
||||
|
||||
curr.append(idEnum)
|
||||
|
||||
traitsDecls = [CGGeneric(declare=dedent("""
|
||||
template <prototypes::ID PrototypeID>
|
||||
struct PrototypeTraits;
|
||||
|
@ -303,7 +303,7 @@ class Descriptor(DescriptorProvider):
|
||||
self.concrete = (not self.interface.isExternal() and
|
||||
not self.interface.isCallback() and
|
||||
desc.get('concrete', True))
|
||||
operations = {
|
||||
self.operations = {
|
||||
'IndexedGetter': None,
|
||||
'IndexedSetter': None,
|
||||
'IndexedCreator': None,
|
||||
@ -320,8 +320,8 @@ class Descriptor(DescriptorProvider):
|
||||
self.proxy = False
|
||||
iface = self.interface
|
||||
def addOperation(operation, m):
|
||||
if not operations[operation]:
|
||||
operations[operation] = m
|
||||
if not self.operations[operation]:
|
||||
self.operations[operation] = m
|
||||
# Since stringifiers go on the prototype, we only need to worry
|
||||
# about our own stringifier, not those of our ancestor interfaces.
|
||||
for m in iface.members:
|
||||
@ -345,7 +345,6 @@ class Descriptor(DescriptorProvider):
|
||||
continue
|
||||
|
||||
def addIndexedOrNamedOperation(operation, m):
|
||||
self.proxy = True
|
||||
if m.isIndexed():
|
||||
operation = 'Indexed' + operation
|
||||
else:
|
||||
@ -369,18 +368,22 @@ class Descriptor(DescriptorProvider):
|
||||
iface.setUserData('hasConcreteDescendant', True)
|
||||
iface = iface.parent
|
||||
|
||||
self.proxy = (self.supportsIndexedProperties() or
|
||||
(self.supportsNamedProperties() and
|
||||
not self.hasNamedPropertiesObject))
|
||||
|
||||
if self.proxy:
|
||||
if (not operations['IndexedGetter'] and
|
||||
(operations['IndexedSetter'] or
|
||||
operations['IndexedDeleter'] or
|
||||
operations['IndexedCreator'])):
|
||||
if (not self.operations['IndexedGetter'] and
|
||||
(self.operations['IndexedSetter'] or
|
||||
self.operations['IndexedDeleter'] or
|
||||
self.operations['IndexedCreator'])):
|
||||
raise SyntaxError("%s supports indexed properties but does "
|
||||
"not have an indexed getter.\n%s" %
|
||||
(self.interface, self.interface.location))
|
||||
if (not operations['NamedGetter'] and
|
||||
(operations['NamedSetter'] or
|
||||
operations['NamedDeleter'] or
|
||||
operations['NamedCreator'])):
|
||||
if (not self.operations['NamedGetter'] and
|
||||
(self.operations['NamedSetter'] or
|
||||
self.operations['NamedDeleter'] or
|
||||
self.operations['NamedCreator'])):
|
||||
raise SyntaxError("%s supports named properties but does "
|
||||
"not have a named getter.\n%s" %
|
||||
(self.interface, self.interface.location))
|
||||
@ -388,7 +391,6 @@ class Descriptor(DescriptorProvider):
|
||||
while iface:
|
||||
iface.setUserData('hasProxyDescendant', True)
|
||||
iface = iface.parent
|
||||
self.operations = operations
|
||||
|
||||
self.nativeOwnership = desc.get('nativeOwnership', 'refcounted')
|
||||
if not self.nativeOwnership in ('owned', 'refcounted'):
|
||||
@ -511,6 +513,16 @@ class Descriptor(DescriptorProvider):
|
||||
def binaryNameFor(self, name):
|
||||
return self._binaryNames.get(name, name)
|
||||
|
||||
@property
|
||||
def prototypeNameChain(self):
|
||||
return map(lambda p: self.getDescriptor(p).name, self.prototypeChain)
|
||||
|
||||
@property
|
||||
def parentPrototypeName(self):
|
||||
if len(self.prototypeChain) == 1:
|
||||
return None
|
||||
return self.getDescriptor(self.prototypeChain[-2]).name
|
||||
|
||||
def hasInterfaceOrInterfacePrototypeObject(self):
|
||||
|
||||
# Forward-declared interfaces don't need either interface object or
|
||||
@ -521,6 +533,13 @@ class Descriptor(DescriptorProvider):
|
||||
|
||||
return self.interface.hasInterfaceObject() or self.interface.hasInterfacePrototypeObject()
|
||||
|
||||
@property
|
||||
def hasNamedPropertiesObject(self):
|
||||
if self.interface.isExternal():
|
||||
return False
|
||||
|
||||
return self.isGlobal() and self.supportsNamedProperties()
|
||||
|
||||
def getExtendedAttributes(self, member, getter=False, setter=False):
|
||||
def ensureValidThrowsExtendedAttribute(attr):
|
||||
assert(attr is None or attr is True or len(attr) == 1)
|
||||
|
@ -156,25 +156,46 @@ struct NativePropertyHooks
|
||||
// constructors::id::_ID_Count.
|
||||
constructors::ID mConstructorID;
|
||||
|
||||
// The NativePropertyHooks instance for the parent interface.
|
||||
// The NativePropertyHooks instance for the parent interface (for
|
||||
// ShimInterfaceInfo).
|
||||
const NativePropertyHooks* mProtoHooks;
|
||||
};
|
||||
|
||||
enum DOMObjectType {
|
||||
eInstance,
|
||||
eGlobalInstance,
|
||||
eInterface,
|
||||
eInterfacePrototype
|
||||
eInterfacePrototype,
|
||||
eGlobalInterfacePrototype,
|
||||
eNamedPropertiesObject
|
||||
};
|
||||
|
||||
inline
|
||||
bool
|
||||
IsInstance(DOMObjectType type)
|
||||
{
|
||||
return type == eInstance || type == eGlobalInstance;
|
||||
}
|
||||
|
||||
inline
|
||||
bool
|
||||
IsInterfacePrototype(DOMObjectType type)
|
||||
{
|
||||
return type == eInterfacePrototype || type == eGlobalInterfacePrototype;
|
||||
}
|
||||
|
||||
typedef JSObject* (*ParentGetter)(JSContext* aCx, JS::Handle<JSObject*> aObj);
|
||||
|
||||
typedef JSObject* (*ProtoGetter)(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGlobal);
|
||||
/**
|
||||
* Returns a handle to the relevent WebIDL prototype object for the given global
|
||||
* (which may be a handle to null on out of memory). Once allocated, the
|
||||
* prototype object is guaranteed to exist as long as the global does, since the
|
||||
* global traces its array of WebIDL prototypes and constructors.
|
||||
*/
|
||||
typedef JS::Handle<JSObject*> (*ProtoGetter)(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGlobal);
|
||||
typedef JS::Handle<JSObject*> (*ProtoHandleGetter)(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGlobal);
|
||||
|
||||
// Special JSClass for reflected DOM objects.
|
||||
struct DOMJSClass
|
||||
@ -197,7 +218,7 @@ struct DOMJSClass
|
||||
const NativePropertyHooks* mNativeHooks;
|
||||
|
||||
ParentGetter mGetParent;
|
||||
ProtoGetter mGetProto;
|
||||
ProtoHandleGetter mGetProto;
|
||||
|
||||
// This stores the CC participant for the native, null if this class is for a
|
||||
// worker or for a native inheriting from nsISupports (we can get the CC
|
||||
@ -219,13 +240,14 @@ struct DOMJSClass
|
||||
// Special JSClass for DOM interface and interface prototype objects.
|
||||
struct DOMIfaceAndProtoJSClass
|
||||
{
|
||||
// It would be nice to just inherit from JSClass, but that precludes pure
|
||||
// It would be nice to just inherit from js::Class, but that precludes pure
|
||||
// compile-time initialization of the form
|
||||
// |DOMJSInterfaceAndPrototypeClass = {...};|, since C++ only allows brace
|
||||
// initialization for aggregate/POD types.
|
||||
const JSClass mBase;
|
||||
const js::Class mBase;
|
||||
|
||||
// Either eInterface or eInterfacePrototype
|
||||
// Either eInterface, eInterfacePrototype, eGlobalInterfacePrototype or
|
||||
// eNamedPropertiesObject.
|
||||
DOMObjectType mType;
|
||||
|
||||
const NativePropertyHooks* mNativeHooks;
|
||||
@ -237,6 +259,8 @@ struct DOMIfaceAndProtoJSClass
|
||||
const prototypes::ID mPrototypeID;
|
||||
const uint32_t mDepth;
|
||||
|
||||
ProtoGetter mGetParentProto;
|
||||
|
||||
static const DOMIfaceAndProtoJSClass* FromJSClass(const JSClass* base) {
|
||||
MOZ_ASSERT(base->flags & JSCLASS_IS_DOMIFACEANDPROTOJSCLASS);
|
||||
return reinterpret_cast<const DOMIfaceAndProtoJSClass*>(base);
|
||||
@ -245,7 +269,7 @@ struct DOMIfaceAndProtoJSClass
|
||||
return FromJSClass(Jsvalify(base));
|
||||
}
|
||||
|
||||
const JSClass* ToJSClass() const { return &mBase; }
|
||||
const JSClass* ToJSClass() const { return Jsvalify(&mBase); }
|
||||
};
|
||||
|
||||
class ProtoAndIfaceCache;
|
||||
|
@ -3,5 +3,6 @@
|
||||
[test_bug707564-chrome.html]
|
||||
[test_bug775543.html]
|
||||
[test_document_location_set_via_xray.html]
|
||||
[test_dom_xrays.html]
|
||||
[test_proxies_via_xray.html]
|
||||
[test_document_location_via_xray_cached.html]
|
||||
|
24
dom/bindings/test/file_dom_xrays.html
Normal file
24
dom/bindings/test/file_dom_xrays.html
Normal file
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<script>
|
||||
window.expando = 42;
|
||||
window.shadowedIframe = 42;
|
||||
Object.setPrototypeOf(window, Object.create(Window.prototype,
|
||||
{
|
||||
shadowedIframe: { value: 42 },
|
||||
iframe: { value: 42 },
|
||||
document: { value: 42 },
|
||||
addEventListener: { value: 42 },
|
||||
toString: { value: 42 }
|
||||
}));
|
||||
window.documentElement.expando = 42;
|
||||
Object.defineProperty(window.documentElement, "version", { value: 42 });
|
||||
</script>
|
||||
<iframe name="shadowedIframe" id="shadowedIframe"></iframe>
|
||||
<iframe name="iframe" id="iframe"></iframe>
|
||||
<iframe name="document" id="document"></iframe>
|
||||
<iframe name="self" id="self"></iframe>
|
||||
<iframe name="addEventListener" id="addEventListener"></iframe>
|
||||
<iframe name="toString" id="toString"></iframe>
|
||||
<iframe name="item" id="item"></iframe>
|
||||
</html>
|
@ -4,6 +4,7 @@ support-files =
|
||||
file_bug707564.html
|
||||
file_bug775543.html
|
||||
file_document_location_set_via_xray.html
|
||||
file_dom_xrays.html
|
||||
file_proxies_via_xray.html
|
||||
forOf_iframe.html
|
||||
|
||||
|
158
dom/bindings/test/test_dom_xrays.html
Normal file
158
dom/bindings/test/test_dom_xrays.html
Normal file
@ -0,0 +1,158 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=787070
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 787070</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=787070">Mozilla Bug 787070</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe id="t" src="http://example.org/tests/dom/bindings/test/file_dom_xrays.html"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 1021066 **/
|
||||
|
||||
var Cu = Components.utils;
|
||||
|
||||
// values should contain the values that the property should have on each of
|
||||
// the objects on the prototype chain of obj. A value of undefined signals
|
||||
// that the value should not be present on that prototype.
|
||||
function checkXrayProperty(obj, name, values)
|
||||
{
|
||||
var instance = obj;
|
||||
do {
|
||||
var value = values.shift();
|
||||
if (typeof value == "undefined") {
|
||||
ok(!obj.hasOwnProperty(name), "hasOwnProperty shouldn't see \"" + name + "\" through Xrays");
|
||||
ise(Object.getOwnPropertyDescriptor(obj, name), undefined, "getOwnPropertyDescriptor shouldn't see \"" + name + "\" through Xrays");
|
||||
ok(Object.keys(obj).indexOf(name) == -1, "Enumerating the Xray should not return \"" + name + "\"");
|
||||
} else {
|
||||
ok(obj.hasOwnProperty(name), "hasOwnProperty should see \"" + name + "\" through Xrays");
|
||||
var pd = Object.getOwnPropertyDescriptor(obj, name);
|
||||
ok(pd, "getOwnPropertyDescriptor should see \"" + name + "\" through Xrays");
|
||||
if (pd && pd.get) {
|
||||
is(pd.get.call(instance), value, "Should get the right value for \"" + name + "\" through Xrays");
|
||||
} else {
|
||||
is(obj[name], value, "Should get the right value for \"" + name + "\" through Xrays");
|
||||
}
|
||||
if (pd && pd.enumerable) {
|
||||
ok(Object.keys(obj).indexOf("" + name) > -1, "Enumerating the Xray should return \"" + name + "\"");
|
||||
}
|
||||
}
|
||||
} while ((obj = Object.getPrototypeOf(obj)));
|
||||
}
|
||||
|
||||
function checkWindowXrayProperty(obj, name, windowValue, windowPrototypeValue, namedPropertiesValue, eventTargetValue)
|
||||
{
|
||||
checkXrayProperty(obj, name, [ windowValue, windowPrototypeValue, namedPropertiesValue, eventTargetValue ]);
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
// Window
|
||||
var win = document.getElementById("t").contentWindow;
|
||||
var doc = document.getElementById("t").contentDocument;
|
||||
|
||||
var winProto = Object.getPrototypeOf(win);
|
||||
ise(winProto, win.Window.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
|
||||
|
||||
var namedPropertiesObject = Object.getPrototypeOf(winProto);
|
||||
ise(Cu.getClassName(namedPropertiesObject, /* unwrap = */ true), "WindowProperties", "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
|
||||
|
||||
var eventTargetProto = Object.getPrototypeOf(namedPropertiesObject);
|
||||
ise(eventTargetProto, win.EventTarget.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
|
||||
|
||||
// Xrays need to filter expandos.
|
||||
checkWindowXrayProperty(win, "expando", undefined);
|
||||
ok(!("expando" in win), "Xrays should filter expandos");
|
||||
|
||||
checkWindowXrayProperty(win, "shadowedIframe", undefined, undefined, doc.getElementById("shadowedIframe").contentWindow);
|
||||
ok("shadowedIframe" in win, "Named properties should be exposed through Xrays");
|
||||
|
||||
// Named properties live on the named properties object for global objects.
|
||||
checkWindowXrayProperty(win, "iframe", undefined, undefined, doc.getElementById("iframe").contentWindow);
|
||||
ok("iframe" in win, "Named properties should be exposed through Xrays");
|
||||
|
||||
// Window properties live on the instance, shadowing the properties of the named property object.
|
||||
checkWindowXrayProperty(win, "document", doc, undefined, doc.getElementById("document").contentWindow);
|
||||
ok("document" in win, "WebIDL properties should be exposed through Xrays");
|
||||
|
||||
// Unforgeable properties live on the instance, shadowing the properties of the named property object.
|
||||
checkWindowXrayProperty(win, "self", win, undefined, doc.getElementById("self").contentWindow);
|
||||
ok("self" in win, "WebIDL properties should be exposed through Xrays");
|
||||
|
||||
// Object.prototype is at the end of the prototype chain.
|
||||
var obj = win;
|
||||
while ((proto = Object.getPrototypeOf(obj))) {
|
||||
obj = proto;
|
||||
}
|
||||
ise(obj, win.Object.prototype, "Object.prototype should be at the end of the prototype chain");
|
||||
|
||||
// Named properties shouldn't shadow WebIDL- or ECMAScript-defined properties.
|
||||
checkWindowXrayProperty(win, "addEventListener", undefined, undefined, undefined, eventTargetProto.addEventListener);
|
||||
ise(win.addEventListener, eventTargetProto.addEventListener, "Named properties shouldn't shadow WebIDL-defined properties");
|
||||
|
||||
ise(win.toString, win.Object.prototype.toString, "Named properties shouldn't shadow ECMAScript-defined properties");
|
||||
|
||||
// HTMLDocument
|
||||
// Unforgeable properties live on the instance.
|
||||
checkXrayProperty(doc, "location", [ document.getElementById("t").src ]);
|
||||
|
||||
// HTMLHtmlElement
|
||||
var elem = doc.documentElement;
|
||||
|
||||
var elemProto = Object.getPrototypeOf(elem);
|
||||
ise(elemProto, win.HTMLHtmlElement.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
|
||||
|
||||
elemProto = Object.getPrototypeOf(elemProto);
|
||||
ise(elemProto, win.HTMLElement.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
|
||||
|
||||
elemProto = Object.getPrototypeOf(elemProto);
|
||||
ise(elemProto, win.Element.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
|
||||
|
||||
elemProto = Object.getPrototypeOf(elemProto);
|
||||
ise(elemProto, win.Node.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
|
||||
|
||||
elemProto = Object.getPrototypeOf(elemProto);
|
||||
ise(elemProto, win.EventTarget.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
|
||||
|
||||
// Xrays need to filter expandos.
|
||||
ok(!("expando" in elem), "Xrays should filter expandos");
|
||||
|
||||
// WebIDL-defined properties live on the prototype.
|
||||
checkXrayProperty(elem, "version", [ undefined, "" ]);
|
||||
ise(elem.version, "", "WebIDL properties should be exposed through Xrays");
|
||||
|
||||
// HTMLCollection
|
||||
var coll = doc.getElementsByTagName("iframe");
|
||||
|
||||
// Named properties live on the instance for non-global objects.
|
||||
checkXrayProperty(coll, "iframe", [ doc.getElementById("iframe") ]);
|
||||
|
||||
// Indexed properties live on the instance.
|
||||
checkXrayProperty(coll, 0, [ doc.getElementById("shadowedIframe") ]);
|
||||
|
||||
// WebIDL-defined properties live on the prototype, overriding any named properties.
|
||||
checkXrayProperty(coll, "item", [ undefined, win.HTMLCollection.prototype.item ]);
|
||||
|
||||
// ECMAScript-defined properties live on the prototype, overriding any named properties.
|
||||
checkXrayProperty(coll, "toString", [ undefined, undefined, win.Object.prototype.toString ]);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(test);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -82,6 +82,7 @@
|
||||
#include "mozilla/gfx/Helpers.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "mozilla/gfx/DataSurfaceHelpers.h"
|
||||
#include "mozilla/gfx/PatternHelpers.h"
|
||||
#include "mozilla/ipc/DocumentRendererParent.h"
|
||||
#include "mozilla/ipc/PDocumentRendererParent.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
@ -223,42 +224,33 @@ public:
|
||||
typedef CanvasRenderingContext2D::Style Style;
|
||||
typedef CanvasRenderingContext2D::ContextState ContextState;
|
||||
|
||||
CanvasGeneralPattern() : mPattern(nullptr) {}
|
||||
~CanvasGeneralPattern()
|
||||
{
|
||||
if (mPattern) {
|
||||
mPattern->~Pattern();
|
||||
}
|
||||
}
|
||||
|
||||
Pattern& ForStyle(CanvasRenderingContext2D *aCtx,
|
||||
Style aStyle,
|
||||
DrawTarget *aRT)
|
||||
{
|
||||
// This should only be called once or the mPattern destructor will
|
||||
// not be executed.
|
||||
NS_ASSERTION(!mPattern, "ForStyle() should only be called once on CanvasGeneralPattern!");
|
||||
NS_ASSERTION(!mPattern.GetPattern(), "ForStyle() should only be called once on CanvasGeneralPattern!");
|
||||
|
||||
const ContextState &state = aCtx->CurrentState();
|
||||
|
||||
if (state.StyleIsColor(aStyle)) {
|
||||
mPattern = new (mColorPattern.addr()) ColorPattern(Color::FromABGR(state.colorStyles[aStyle]));
|
||||
mPattern.InitColorPattern(Color::FromABGR(state.colorStyles[aStyle]));
|
||||
} else if (state.gradientStyles[aStyle] &&
|
||||
state.gradientStyles[aStyle]->GetType() == CanvasGradient::Type::LINEAR) {
|
||||
CanvasLinearGradient *gradient =
|
||||
static_cast<CanvasLinearGradient*>(state.gradientStyles[aStyle].get());
|
||||
|
||||
mPattern = new (mLinearGradientPattern.addr())
|
||||
LinearGradientPattern(gradient->mBegin, gradient->mEnd,
|
||||
gradient->GetGradientStopsForTarget(aRT));
|
||||
mPattern.InitLinearGradientPattern(gradient->mBegin, gradient->mEnd,
|
||||
gradient->GetGradientStopsForTarget(aRT));
|
||||
} else if (state.gradientStyles[aStyle] &&
|
||||
state.gradientStyles[aStyle]->GetType() == CanvasGradient::Type::RADIAL) {
|
||||
CanvasRadialGradient *gradient =
|
||||
static_cast<CanvasRadialGradient*>(state.gradientStyles[aStyle].get());
|
||||
|
||||
mPattern = new (mRadialGradientPattern.addr())
|
||||
RadialGradientPattern(gradient->mCenter1, gradient->mCenter2, gradient->mRadius1,
|
||||
gradient->mRadius2, gradient->GetGradientStopsForTarget(aRT));
|
||||
mPattern.InitRadialGradientPattern(gradient->mCenter1, gradient->mCenter2,
|
||||
gradient->mRadius1, gradient->mRadius2,
|
||||
gradient->GetGradientStopsForTarget(aRT));
|
||||
} else if (state.patternStyles[aStyle]) {
|
||||
if (aCtx->mCanvasElement) {
|
||||
CanvasUtils::DoDrawImageSecurityCheck(aCtx->mCanvasElement,
|
||||
@ -273,21 +265,14 @@ public:
|
||||
} else {
|
||||
mode = ExtendMode::REPEAT;
|
||||
}
|
||||
mPattern = new (mSurfacePattern.addr())
|
||||
SurfacePattern(state.patternStyles[aStyle]->mSurface, mode,
|
||||
state.patternStyles[aStyle]->mTransform);
|
||||
mPattern.InitSurfacePattern(state.patternStyles[aStyle]->mSurface, mode,
|
||||
state.patternStyles[aStyle]->mTransform);
|
||||
}
|
||||
|
||||
return *mPattern;
|
||||
return *mPattern.GetPattern();
|
||||
}
|
||||
|
||||
union {
|
||||
AlignedStorage2<ColorPattern> mColorPattern;
|
||||
AlignedStorage2<LinearGradientPattern> mLinearGradientPattern;
|
||||
AlignedStorage2<RadialGradientPattern> mRadialGradientPattern;
|
||||
AlignedStorage2<SurfacePattern> mSurfacePattern;
|
||||
};
|
||||
Pattern *mPattern;
|
||||
GeneralPattern mPattern;
|
||||
};
|
||||
|
||||
/* This is an RAII based class that can be used as a drawtarget for
|
||||
|
@ -13,7 +13,7 @@
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLBuffer::WebGLBuffer(WebGLContext *context)
|
||||
: WebGLBindableName<GLenum>()
|
||||
: WebGLBindableName<BufferBinding>()
|
||||
, WebGLContextBoundObject(context)
|
||||
, mByteLength(0)
|
||||
{
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "WebGLBindableName.h"
|
||||
#include "WebGLObjectModel.h"
|
||||
#include "WebGLTypes.h"
|
||||
#include "WebGLStrongTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -20,7 +21,7 @@ class WebGLElementArrayCache;
|
||||
|
||||
class WebGLBuffer MOZ_FINAL
|
||||
: public nsWrapperCache
|
||||
, public WebGLBindableName<GLenum>
|
||||
, public WebGLBindableName<BufferBinding>
|
||||
, public WebGLRefCountedObject<WebGLBuffer>
|
||||
, public LinkedListElement<WebGLBuffer>
|
||||
, public WebGLContextBoundObject
|
||||
|
@ -1272,7 +1272,7 @@ protected:
|
||||
GLuint mGLName;
|
||||
|
||||
public:
|
||||
FakeBlackTexture(gl::GLContext* gl, GLenum target, GLenum format);
|
||||
FakeBlackTexture(gl::GLContext* gl, TexTarget target, GLenum format);
|
||||
~FakeBlackTexture();
|
||||
GLuint GLName() const { return mGLName; }
|
||||
};
|
||||
|
@ -710,11 +710,10 @@ WebGLContext::UnbindFakeBlackTextures()
|
||||
gl->fActiveTexture(LOCAL_GL_TEXTURE0 + mActiveTexture);
|
||||
}
|
||||
|
||||
WebGLContext::FakeBlackTexture::FakeBlackTexture(GLContext *gl, GLenum target, GLenum format)
|
||||
WebGLContext::FakeBlackTexture::FakeBlackTexture(GLContext *gl, TexTarget target, GLenum format)
|
||||
: mGL(gl)
|
||||
, mGLName(0)
|
||||
{
|
||||
MOZ_ASSERT(target == LOCAL_GL_TEXTURE_2D || target == LOCAL_GL_TEXTURE_CUBE_MAP);
|
||||
MOZ_ASSERT(format == LOCAL_GL_RGB || format == LOCAL_GL_RGBA);
|
||||
|
||||
mGL->MakeCurrent();
|
||||
@ -724,7 +723,7 @@ WebGLContext::FakeBlackTexture::FakeBlackTexture(GLContext *gl, GLenum target, G
|
||||
: LOCAL_GL_TEXTURE_BINDING_CUBE_MAP,
|
||||
&formerBinding);
|
||||
gl->fGenTextures(1, &mGLName);
|
||||
gl->fBindTexture(target, mGLName);
|
||||
gl->fBindTexture(target.get(), mGLName);
|
||||
|
||||
// we allocate our zeros on the heap, and we overallocate (16 bytes instead of 4)
|
||||
// to minimize the risk of running into a driver bug in texImage2D, as it is
|
||||
@ -732,7 +731,7 @@ WebGLContext::FakeBlackTexture::FakeBlackTexture(GLContext *gl, GLenum target, G
|
||||
// that texImage2D expects.
|
||||
void* zeros = calloc(1, 16);
|
||||
if (target == LOCAL_GL_TEXTURE_2D) {
|
||||
gl->fTexImage2D(target, 0, format, 1, 1,
|
||||
gl->fTexImage2D(target.get(), 0, format, 1, 1,
|
||||
0, format, LOCAL_GL_UNSIGNED_BYTE, zeros);
|
||||
} else {
|
||||
for (GLuint i = 0; i < 6; ++i) {
|
||||
@ -742,7 +741,7 @@ WebGLContext::FakeBlackTexture::FakeBlackTexture(GLContext *gl, GLenum target, G
|
||||
}
|
||||
free(zeros);
|
||||
|
||||
gl->fBindTexture(target, formerBinding);
|
||||
gl->fBindTexture(target.get(), formerBinding);
|
||||
}
|
||||
|
||||
WebGLContext::FakeBlackTexture::~FakeBlackTexture()
|
||||
|
@ -942,7 +942,7 @@ WebGLContext::GenerateMipmap(GLenum rawTarget)
|
||||
// note that the choice of GL_NEAREST_MIPMAP_NEAREST really matters. See Chromium bug 101105.
|
||||
gl->fTexParameteri(target.get(), LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_NEAREST_MIPMAP_NEAREST);
|
||||
gl->fGenerateMipmap(target.get());
|
||||
gl->fTexParameteri(target.get(), LOCAL_GL_TEXTURE_MIN_FILTER, tex->MinFilter());
|
||||
gl->fTexParameteri(target.get(), LOCAL_GL_TEXTURE_MIN_FILTER, tex->MinFilter().get());
|
||||
} else {
|
||||
gl->fGenerateMipmap(target.get());
|
||||
}
|
||||
|
@ -252,6 +252,26 @@ STRONG_GLENUM_BEGIN(TexType)
|
||||
STRONG_GLENUM_VALUE(FLOAT_32_UNSIGNED_INT_24_8_REV),
|
||||
STRONG_GLENUM_END(TexType)
|
||||
|
||||
STRONG_GLENUM_BEGIN(TexMinFilter)
|
||||
STRONG_GLENUM_VALUE(NEAREST),
|
||||
STRONG_GLENUM_VALUE(LINEAR),
|
||||
STRONG_GLENUM_VALUE(NEAREST_MIPMAP_NEAREST),
|
||||
STRONG_GLENUM_VALUE(LINEAR_MIPMAP_NEAREST),
|
||||
STRONG_GLENUM_VALUE(NEAREST_MIPMAP_LINEAR),
|
||||
STRONG_GLENUM_VALUE(LINEAR_MIPMAP_LINEAR),
|
||||
STRONG_GLENUM_END(TexMinFilter)
|
||||
|
||||
STRONG_GLENUM_BEGIN(TexMagFilter)
|
||||
STRONG_GLENUM_VALUE(NEAREST),
|
||||
STRONG_GLENUM_VALUE(LINEAR),
|
||||
STRONG_GLENUM_END(TexMagFilter)
|
||||
|
||||
STRONG_GLENUM_BEGIN(TexWrap)
|
||||
STRONG_GLENUM_VALUE(REPEAT),
|
||||
STRONG_GLENUM_VALUE(CLAMP_TO_EDGE),
|
||||
STRONG_GLENUM_VALUE(MIRRORED_REPEAT),
|
||||
STRONG_GLENUM_END(TexWrap)
|
||||
|
||||
STRONG_GLENUM_BEGIN(TexFormat)
|
||||
STRONG_GLENUM_VALUE(NONE),
|
||||
STRONG_GLENUM_VALUE(DEPTH_COMPONENT),
|
||||
@ -405,4 +425,15 @@ STRONG_GLENUM_BEGIN(RBParam)
|
||||
STRONG_GLENUM_VALUE(RENDERBUFFER_STENCIL_SIZE),
|
||||
STRONG_GLENUM_END(RBParam)
|
||||
|
||||
STRONG_GLENUM_BEGIN(VAOBinding)
|
||||
STRONG_GLENUM_VALUE(NONE),
|
||||
STRONG_GLENUM_VALUE(VERTEX_ARRAY_BINDING),
|
||||
STRONG_GLENUM_END(VAOBinding)
|
||||
|
||||
STRONG_GLENUM_BEGIN(BufferBinding)
|
||||
STRONG_GLENUM_VALUE(NONE),
|
||||
STRONG_GLENUM_VALUE(ARRAY_BUFFER),
|
||||
STRONG_GLENUM_VALUE(ELEMENT_ARRAY_BUFFER),
|
||||
STRONG_GLENUM_END(BufferBinding)
|
||||
|
||||
#endif
|
||||
|
@ -194,7 +194,9 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
GLenum mMinFilter, mMagFilter, mWrapS, mWrapT;
|
||||
TexMinFilter mMinFilter;
|
||||
TexMagFilter mMagFilter;
|
||||
TexWrap mWrapS, mWrapT;
|
||||
|
||||
size_t mFacesCount, mMaxLevelWithCustomImages;
|
||||
nsTArray<ImageInfo> mImageInfos;
|
||||
@ -227,23 +229,23 @@ public:
|
||||
GLsizei aWidth, GLsizei aHeight,
|
||||
TexInternalFormat aFormat, TexType aType, WebGLImageDataStatus aStatus);
|
||||
|
||||
void SetMinFilter(GLenum aMinFilter) {
|
||||
void SetMinFilter(TexMinFilter aMinFilter) {
|
||||
mMinFilter = aMinFilter;
|
||||
SetFakeBlackStatus(WebGLTextureFakeBlackStatus::Unknown);
|
||||
}
|
||||
void SetMagFilter(GLenum aMagFilter) {
|
||||
void SetMagFilter(TexMagFilter aMagFilter) {
|
||||
mMagFilter = aMagFilter;
|
||||
SetFakeBlackStatus(WebGLTextureFakeBlackStatus::Unknown);
|
||||
}
|
||||
void SetWrapS(GLenum aWrapS) {
|
||||
void SetWrapS(TexWrap aWrapS) {
|
||||
mWrapS = aWrapS;
|
||||
SetFakeBlackStatus(WebGLTextureFakeBlackStatus::Unknown);
|
||||
}
|
||||
void SetWrapT(GLenum aWrapT) {
|
||||
void SetWrapT(TexWrap aWrapT) {
|
||||
mWrapT = aWrapT;
|
||||
SetFakeBlackStatus(WebGLTextureFakeBlackStatus::Unknown);
|
||||
}
|
||||
GLenum MinFilter() const { return mMinFilter; }
|
||||
TexMinFilter MinFilter() const { return mMinFilter; }
|
||||
|
||||
bool DoesMinFilterRequireMipmap() const {
|
||||
return !(mMinFilter == LOCAL_GL_NEAREST || mMinFilter == LOCAL_GL_LINEAR);
|
||||
|
@ -20,7 +20,7 @@ WebGLVertexArray::WrapObject(JSContext *cx) {
|
||||
}
|
||||
|
||||
WebGLVertexArray::WebGLVertexArray(WebGLContext* context)
|
||||
: WebGLBindableName<GLenum>()
|
||||
: WebGLBindableName<VAOBinding>()
|
||||
, WebGLContextBoundObject(context)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "WebGLObjectModel.h"
|
||||
#include "WebGLBuffer.h"
|
||||
#include "WebGLVertexAttribData.h"
|
||||
#include "WebGLStrongTypes.h"
|
||||
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
@ -21,7 +22,7 @@ class WebGLVertexArrayFake;
|
||||
|
||||
class WebGLVertexArray
|
||||
: public nsWrapperCache
|
||||
, public WebGLBindableName<GLenum>
|
||||
, public WebGLBindableName<VAOBinding>
|
||||
, public WebGLRefCountedObject<WebGLVertexArray>
|
||||
, public LinkedListElement<WebGLVertexArray>
|
||||
, public WebGLContextBoundObject
|
||||
@ -41,8 +42,6 @@ public:
|
||||
virtual void GenVertexArray() = 0;
|
||||
virtual void BindVertexArrayImpl() = 0;
|
||||
|
||||
GLuint GLName() const { return mGLName; }
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// IMPLEMENT PARENT CLASSES
|
||||
|
||||
|
@ -3,15 +3,21 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "CellBroadcast.h"
|
||||
#include "mozilla/dom/CellBroadcast.h"
|
||||
#include "mozilla/dom/CellBroadcastMessage.h"
|
||||
#include "mozilla/dom/MozCellBroadcastBinding.h"
|
||||
#include "mozilla/dom/MozCellBroadcastEvent.h"
|
||||
#include "nsIDOMMozCellBroadcastMessage.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#define NS_RILCONTENTHELPER_CONTRACTID "@mozilla.org/ril/content-helper;1"
|
||||
// Service instantiation
|
||||
#include "ipc/CellBroadcastIPCService.h"
|
||||
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
|
||||
#include "nsIGonkCellBroadcastService.h"
|
||||
#endif
|
||||
#include "nsXULAppAPI.h" // For XRE_GetProcessType()
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using mozilla::ErrorResult;
|
||||
|
||||
/**
|
||||
* CellBroadcast::Listener Implementation.
|
||||
@ -58,34 +64,39 @@ CellBroadcast::Create(nsPIDOMWindow* aWindow, ErrorResult& aRv)
|
||||
MOZ_ASSERT(aWindow);
|
||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
||||
|
||||
nsCOMPtr<nsICellBroadcastProvider> provider =
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
if (!provider) {
|
||||
nsCOMPtr<nsICellBroadcastService> service =
|
||||
do_GetService(CELLBROADCAST_SERVICE_CONTRACTID);
|
||||
if (!service) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<CellBroadcast> cb = new CellBroadcast(aWindow, provider);
|
||||
nsRefPtr<CellBroadcast> cb = new CellBroadcast(aWindow, service);
|
||||
return cb.forget();
|
||||
}
|
||||
|
||||
CellBroadcast::CellBroadcast(nsPIDOMWindow *aWindow,
|
||||
nsICellBroadcastProvider *aProvider)
|
||||
nsICellBroadcastService *aService)
|
||||
: DOMEventTargetHelper(aWindow)
|
||||
, mProvider(aProvider)
|
||||
{
|
||||
mListener = new Listener(this);
|
||||
DebugOnly<nsresult> rv = mProvider->RegisterCellBroadcastMsg(mListener);
|
||||
DebugOnly<nsresult> rv = aService->RegisterListener(mListener);
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
|
||||
"Failed registering Cell Broadcast callback with provider");
|
||||
"Failed registering Cell Broadcast callback");
|
||||
}
|
||||
|
||||
CellBroadcast::~CellBroadcast()
|
||||
{
|
||||
MOZ_ASSERT(mProvider && mListener);
|
||||
MOZ_ASSERT(mListener);
|
||||
|
||||
mListener->Disconnect();
|
||||
mProvider->UnregisterCellBroadcastMsg(mListener);
|
||||
nsCOMPtr<nsICellBroadcastService> service =
|
||||
do_GetService(CELLBROADCAST_SERVICE_CONTRACTID);
|
||||
if (service) {
|
||||
service->UnregisterListener(mListener);
|
||||
}
|
||||
|
||||
mListener = nullptr;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(CellBroadcast, DOMEventTargetHelper)
|
||||
@ -99,14 +110,54 @@ CellBroadcast::WrapObject(JSContext* aCx)
|
||||
// Forwarded nsICellBroadcastListener methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
CellBroadcast::NotifyMessageReceived(nsIDOMMozCellBroadcastMessage* aMessage)
|
||||
{
|
||||
CellBroadcast::NotifyMessageReceived(uint32_t aServiceId,
|
||||
uint32_t aGsmGeographicalScope,
|
||||
uint16_t aMessageCode,
|
||||
uint16_t aMessageId,
|
||||
const nsAString& aLanguage,
|
||||
const nsAString& aBody,
|
||||
uint32_t aMessageClass,
|
||||
DOMTimeStamp aTimestamp,
|
||||
uint32_t aCdmaServiceCategory,
|
||||
bool aHasEtwsInfo,
|
||||
uint32_t aEtwsWarningType,
|
||||
bool aEtwsEmergencyUserAlert,
|
||||
bool aEtwsPopup) {
|
||||
MozCellBroadcastEventInit init;
|
||||
init.mBubbles = true;
|
||||
init.mCancelable = false;
|
||||
init.mMessage = aMessage;
|
||||
init.mMessage = new CellBroadcastMessage(GetOwner(),
|
||||
aServiceId,
|
||||
aGsmGeographicalScope,
|
||||
aMessageCode,
|
||||
aMessageId,
|
||||
aLanguage,
|
||||
aBody,
|
||||
aMessageClass,
|
||||
aTimestamp,
|
||||
aCdmaServiceCategory,
|
||||
aHasEtwsInfo,
|
||||
aEtwsWarningType,
|
||||
aEtwsEmergencyUserAlert,
|
||||
aEtwsPopup);
|
||||
|
||||
nsRefPtr<MozCellBroadcastEvent> event =
|
||||
MozCellBroadcastEvent::Constructor(this, NS_LITERAL_STRING("received"), init);
|
||||
return DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
already_AddRefed<nsICellBroadcastService>
|
||||
NS_CreateCellBroadcastService()
|
||||
{
|
||||
nsCOMPtr<nsICellBroadcastService> service;
|
||||
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
service = new mozilla::dom::cellbroadcast::CellBroadcastIPCService();
|
||||
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
|
||||
} else {
|
||||
service = do_GetService(GONK_CELLBROADCAST_SERVICE_CONTRACTID);
|
||||
#endif
|
||||
}
|
||||
|
||||
return service.forget();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsICellBroadcastProvider.h"
|
||||
#include "nsICellBroadcastService.h"
|
||||
#include "js/TypeDecls.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
@ -23,7 +23,7 @@ class CellBroadcast MOZ_FINAL : public DOMEventTargetHelper,
|
||||
/**
|
||||
* Class CellBroadcast doesn't actually expose nsICellBroadcastListener.
|
||||
* Instead, it owns an nsICellBroadcastListener derived instance mListener
|
||||
* and passes it to nsICellBroadcastProvider. The onreceived events are first
|
||||
* and passes it to nsICellBroadcastService. The onreceived events are first
|
||||
* delivered to mListener and then forwarded to its owner, CellBroadcast. See
|
||||
* also bug 775997 comment #51.
|
||||
*/
|
||||
@ -43,7 +43,7 @@ public:
|
||||
|
||||
CellBroadcast() MOZ_DELETE;
|
||||
CellBroadcast(nsPIDOMWindow *aWindow,
|
||||
nsICellBroadcastProvider* aProvider);
|
||||
nsICellBroadcastService* aService);
|
||||
|
||||
nsPIDOMWindow*
|
||||
GetParentObject() const { return GetOwner(); }
|
||||
@ -54,7 +54,6 @@ public:
|
||||
IMPL_EVENT_HANDLER(received)
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsICellBroadcastProvider> mProvider;
|
||||
nsRefPtr<Listener> mListener;
|
||||
};
|
||||
|
||||
|
154
dom/cellbroadcast/CellBroadcastMessage.cpp
Normal file
154
dom/cellbroadcast/CellBroadcastMessage.cpp
Normal file
@ -0,0 +1,154 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "CellBroadcastMessage.h"
|
||||
#include "mozilla/dom/MozCellBroadcastMessageBinding.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsICellBroadcastService.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
/**
|
||||
* Converter for XPIDL Constants to WebIDL Enumerations
|
||||
*/
|
||||
|
||||
template<class T> struct EnumConverter {};
|
||||
|
||||
template<class T>
|
||||
struct StaticEnumConverter
|
||||
{
|
||||
typedef T WebidlEnumType;
|
||||
typedef uint32_t XpidlEnumType;
|
||||
|
||||
static MOZ_CONSTEXPR WebidlEnumType
|
||||
x2w(XpidlEnumType aXpidlEnum) { return static_cast<WebidlEnumType>(aXpidlEnum); }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
MOZ_CONSTEXPR T
|
||||
ToWebidlEnum(uint32_t aXpidlEnum) { return EnumConverter<T>::x2w(aXpidlEnum); }
|
||||
|
||||
// Declare converters here:
|
||||
template <>
|
||||
struct EnumConverter<CellBroadcastGsmGeographicalScope> :
|
||||
public StaticEnumConverter<CellBroadcastGsmGeographicalScope> {};
|
||||
template <>
|
||||
struct EnumConverter<CellBroadcastMessageClass> :
|
||||
public StaticEnumConverter<CellBroadcastMessageClass> {};
|
||||
template <>
|
||||
struct EnumConverter<CellBroadcastEtwsWarningType> :
|
||||
public StaticEnumConverter<CellBroadcastEtwsWarningType> {};
|
||||
|
||||
/**
|
||||
* CellBroadcastMessage Implementation.
|
||||
*/
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CellBroadcastMessage, mWindow, mEtwsInfo)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(CellBroadcastMessage)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(CellBroadcastMessage)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CellBroadcastMessage)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
CellBroadcastMessage::CellBroadcastMessage(nsPIDOMWindow* aWindow,
|
||||
uint32_t aServiceId,
|
||||
uint32_t aGsmGeographicalScope,
|
||||
uint16_t aMessageCode,
|
||||
uint16_t aMessageId,
|
||||
const nsAString& aLanguage,
|
||||
const nsAString& aBody,
|
||||
uint32_t aMessageClass,
|
||||
uint64_t aTimestamp,
|
||||
uint32_t aCdmaServiceCategory,
|
||||
bool aHasEtwsInfo,
|
||||
uint32_t aEtwsWarningType,
|
||||
bool aEtwsEmergencyUserAlert,
|
||||
bool aEtwsPopup)
|
||||
: mWindow(aWindow)
|
||||
, mServiceId(aServiceId)
|
||||
, mMessageCode(aMessageCode)
|
||||
, mMessageId(aMessageId)
|
||||
, mLanguage(aLanguage)
|
||||
, mBody(aBody)
|
||||
, mTimestamp(aTimestamp)
|
||||
, mEtwsInfo(aHasEtwsInfo ? new CellBroadcastEtwsInfo(aWindow,
|
||||
aEtwsWarningType,
|
||||
aEtwsEmergencyUserAlert,
|
||||
aEtwsPopup)
|
||||
: nullptr)
|
||||
{
|
||||
if (aGsmGeographicalScope < nsICellBroadcastService::GSM_GEOGRAPHICAL_SCOPE_INVALID) {
|
||||
mGsmGeographicalScope.SetValue(
|
||||
ToWebidlEnum<CellBroadcastGsmGeographicalScope>(aGsmGeographicalScope));
|
||||
}
|
||||
|
||||
if (aMessageClass < nsICellBroadcastService::GSM_MESSAGE_CLASS_INVALID) {
|
||||
mMessageClass.SetValue(
|
||||
ToWebidlEnum<CellBroadcastMessageClass>(aMessageClass));
|
||||
}
|
||||
|
||||
// CdmaServiceCategory represents a 16bit unsigned value.
|
||||
if (aCdmaServiceCategory <= 0xFFFFU) {
|
||||
mCdmaServiceCategory.SetValue(static_cast<uint16_t>(aCdmaServiceCategory));
|
||||
}
|
||||
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
CellBroadcastMessage::WrapObject(JSContext* aCx)
|
||||
{
|
||||
return MozCellBroadcastMessageBinding::Wrap(aCx, this);
|
||||
}
|
||||
|
||||
already_AddRefed<CellBroadcastEtwsInfo>
|
||||
CellBroadcastMessage::GetEtws() const
|
||||
{
|
||||
nsRefPtr<CellBroadcastEtwsInfo> etwsInfo = mEtwsInfo;
|
||||
return etwsInfo.forget();
|
||||
}
|
||||
|
||||
/**
|
||||
* CellBroadcastEtwsInfo Implementation.
|
||||
*/
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CellBroadcastEtwsInfo, mWindow)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(CellBroadcastEtwsInfo)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(CellBroadcastEtwsInfo)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CellBroadcastEtwsInfo)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
CellBroadcastEtwsInfo::CellBroadcastEtwsInfo(nsPIDOMWindow* aWindow,
|
||||
uint32_t aWarningType,
|
||||
bool aEmergencyUserAlert,
|
||||
bool aPopup)
|
||||
: mWindow(aWindow)
|
||||
, mEmergencyUserAlert(aEmergencyUserAlert)
|
||||
, mPopup(aPopup)
|
||||
{
|
||||
if (aWarningType < nsICellBroadcastService::GSM_ETWS_WARNING_INVALID) {
|
||||
mWarningType.SetValue(
|
||||
ToWebidlEnum<CellBroadcastEtwsWarningType>(aWarningType));
|
||||
}
|
||||
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
CellBroadcastEtwsInfo::WrapObject(JSContext* aCx)
|
||||
{
|
||||
return MozCellBroadcastEtwsInfoBinding::Wrap(aCx, this);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
136
dom/cellbroadcast/CellBroadcastMessage.h
Normal file
136
dom/cellbroadcast/CellBroadcastMessage.h
Normal file
@ -0,0 +1,136 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_cellbroadcast_CellBroadcastMessage_h
|
||||
#define mozilla_dom_cellbroadcast_CellBroadcastMessage_h
|
||||
|
||||
#include "mozilla/dom/MozCellBroadcastMessageBinding.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class CellBroadcastEtwsInfo;
|
||||
|
||||
class CellBroadcastMessage MOZ_FINAL : public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CellBroadcastMessage)
|
||||
|
||||
CellBroadcastMessage(nsPIDOMWindow* aWindow,
|
||||
uint32_t aServiceId,
|
||||
uint32_t aGsmGeographicalScope,
|
||||
uint16_t aMessageCode,
|
||||
uint16_t aMessageId,
|
||||
const nsAString& aLanguage,
|
||||
const nsAString& aBody,
|
||||
uint32_t aMessageClass,
|
||||
uint64_t aTimestamp,
|
||||
uint32_t aCdmaServiceCategory,
|
||||
bool aHasEtwsInfo,
|
||||
uint32_t aEtwsWarningType,
|
||||
bool aEtwsEmergencyUserAlert,
|
||||
bool aEtwsPopup);
|
||||
|
||||
nsPIDOMWindow*
|
||||
GetParentObject() const { return mWindow; }
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL interface
|
||||
|
||||
uint32_t ServiceId() const { return mServiceId; }
|
||||
|
||||
const Nullable<CellBroadcastGsmGeographicalScope>&
|
||||
GetGsmGeographicalScope() { return mGsmGeographicalScope; }
|
||||
|
||||
uint16_t MessageCode() const { return mMessageCode; }
|
||||
|
||||
uint16_t MessageId() const { return mMessageId; }
|
||||
|
||||
void GetLanguage(nsString& aLanguage) const { aLanguage = mLanguage; }
|
||||
|
||||
void GetBody(nsString& aBody) const { aBody = mBody; }
|
||||
|
||||
const Nullable<CellBroadcastMessageClass>&
|
||||
GetMessageClass() { return mMessageClass; }
|
||||
|
||||
uint64_t Timestamp() const { return mTimestamp; }
|
||||
|
||||
// Mark this as resultNotAddRefed to return raw pointers
|
||||
already_AddRefed<CellBroadcastEtwsInfo> GetEtws() const;
|
||||
|
||||
const Nullable<uint16_t>& GetCdmaServiceCategory() { return mCdmaServiceCategory; };
|
||||
|
||||
private:
|
||||
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
|
||||
~CellBroadcastMessage() {};
|
||||
|
||||
// Don't try to use the default constructor.
|
||||
CellBroadcastMessage();
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
uint32_t mServiceId;
|
||||
Nullable<CellBroadcastGsmGeographicalScope> mGsmGeographicalScope;
|
||||
uint16_t mMessageCode;
|
||||
uint16_t mMessageId;
|
||||
nsString mLanguage;
|
||||
nsString mBody;
|
||||
Nullable<CellBroadcastMessageClass> mMessageClass;
|
||||
uint64_t mTimestamp;
|
||||
Nullable<uint16_t> mCdmaServiceCategory;
|
||||
nsRefPtr<CellBroadcastEtwsInfo> mEtwsInfo;
|
||||
};
|
||||
|
||||
class CellBroadcastEtwsInfo MOZ_FINAL : public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CellBroadcastEtwsInfo)
|
||||
|
||||
CellBroadcastEtwsInfo(nsPIDOMWindow* aWindow,
|
||||
uint32_t aWarningType,
|
||||
bool aEmergencyUserAlert,
|
||||
bool aPopup);
|
||||
|
||||
nsPIDOMWindow*
|
||||
GetParentObject() const { return mWindow; }
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL interface
|
||||
|
||||
const Nullable<CellBroadcastEtwsWarningType>&
|
||||
GetWarningType() { return mWarningType; }
|
||||
|
||||
bool EmergencyUserAlert() const { return mEmergencyUserAlert; }
|
||||
|
||||
bool Popup() const { return mPopup; }
|
||||
|
||||
private:
|
||||
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
|
||||
~CellBroadcastEtwsInfo() {};
|
||||
|
||||
// Don't try to use the default constructor.
|
||||
CellBroadcastEtwsInfo();
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
Nullable<CellBroadcastEtwsWarningType> mWarningType;
|
||||
bool mEmergencyUserAlert;
|
||||
bool mPopup;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_cellbroadcast_CellBroadcastMessage_h
|
196
dom/cellbroadcast/gonk/CellBroadcastService.js
Normal file
196
dom/cellbroadcast/gonk/CellBroadcastService.js
Normal file
@ -0,0 +1,196 @@
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "RIL", function () {
|
||||
let obj = {};
|
||||
Cu.import("resource://gre/modules/ril_consts.js", obj);
|
||||
return obj;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gSystemMessenger",
|
||||
"@mozilla.org/system-message-internal;1",
|
||||
"nsISystemMessagesInternal");
|
||||
|
||||
const GONK_CELLBROADCAST_SERVICE_CONTRACTID =
|
||||
"@mozilla.org/cellbroadcast/gonkservice;1";
|
||||
const GONK_CELLBROADCAST_SERVICE_CID =
|
||||
Components.ID("{7ba407ce-21fd-11e4-a836-1bfdee377e5c}");
|
||||
const CELLBROADCASTMESSAGE_CID =
|
||||
Components.ID("{29474c96-3099-486f-bb4a-3c9a1da834e4}");
|
||||
const CELLBROADCASTETWSINFO_CID =
|
||||
Components.ID("{59f176ee-9dcd-4005-9d47-f6be0cd08e17}");
|
||||
|
||||
const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
|
||||
|
||||
let DEBUG;
|
||||
function debug(s) {
|
||||
dump("CellBroadcastService: " + s);
|
||||
}
|
||||
|
||||
function CellBroadcastService() {
|
||||
this._listeners = [];
|
||||
|
||||
this._updateDebugFlag();
|
||||
|
||||
Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
|
||||
}
|
||||
CellBroadcastService.prototype = {
|
||||
classID: GONK_CELLBROADCAST_SERVICE_CID,
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({classID: GONK_CELLBROADCAST_SERVICE_CID,
|
||||
contractID: GONK_CELLBROADCAST_SERVICE_CONTRACTID,
|
||||
classDescription: "CellBroadcastService",
|
||||
interfaces: [Ci.nsICellBroadcastService,
|
||||
Ci.nsIGonkCellBroadcastService],
|
||||
flags: Ci.nsIClassInfo.SINGLETON}),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICellBroadcastService,
|
||||
Ci.nsIGonkCellBroadcastService,
|
||||
Ci.nsIObserver]),
|
||||
|
||||
// An array of nsICellBroadcastListener instances.
|
||||
_listeners: null,
|
||||
|
||||
_updateDebugFlag: function() {
|
||||
try {
|
||||
DEBUG = RIL.DEBUG_RIL ||
|
||||
Services.prefs.getBoolPref(kPrefRilDebuggingEnabled);
|
||||
} catch (e) {}
|
||||
},
|
||||
|
||||
_convertCbGsmGeographicalScope: function(aGeographicalScope) {
|
||||
return (aGeographicalScope >= Ci.nsICellBroadcastService.GSM_GEOGRAPHICAL_SCOPE_INVALID)
|
||||
? null
|
||||
: RIL.CB_GSM_GEOGRAPHICAL_SCOPE_NAMES[aGeographicalScope];
|
||||
},
|
||||
|
||||
_convertCbMessageClass: function(aMessageClass) {
|
||||
return (aMessageClass >= Ci.nsICellBroadcastService.GSM_MESSAGE_CLASS)
|
||||
? null
|
||||
: RIL.GECKO_SMS_MESSAGE_CLASSES[aMessageClass];
|
||||
},
|
||||
|
||||
_convertCbEtwsWarningType: function(aWarningType) {
|
||||
return (aWarningType >= Ci.nsICellBroadcastService.GSM_ETWS_WARNING_INVALID)
|
||||
? null
|
||||
: RIL.CB_ETWS_WARNING_TYPE_NAMES[aWarningType];
|
||||
},
|
||||
|
||||
/**
|
||||
* nsICellBroadcastService interface
|
||||
*/
|
||||
registerListener: function(aListener) {
|
||||
if (this._listeners.indexOf(aListener) >= 0) {
|
||||
throw Cr.NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
this._listeners.push(aListener);
|
||||
},
|
||||
|
||||
unregisterListener: function(aListener) {
|
||||
let index = this._listeners.indexOf(aListener);
|
||||
|
||||
if (index < 0) {
|
||||
throw Cr.NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
this._listeners.splice(index, 1);
|
||||
},
|
||||
|
||||
/**
|
||||
* nsIGonkCellBroadcastService interface
|
||||
*/
|
||||
notifyMessageReceived: function(aServiceId,
|
||||
aGsmGeographicalScope,
|
||||
aMessageCode,
|
||||
aMessageId,
|
||||
aLanguage,
|
||||
aBody,
|
||||
aMessageClass,
|
||||
aTimestamp,
|
||||
aCdmaServiceCategory,
|
||||
aHasEtwsInfo,
|
||||
aEtwsWarningType,
|
||||
aEtwsEmergencyUserAlert,
|
||||
aEtwsPopup) {
|
||||
// Broadcast CBS System message
|
||||
// Align the same layout to MozCellBroadcastMessage
|
||||
let systemMessage = {
|
||||
serviceId: aServiceId,
|
||||
gsmGeographicalScope: this._convertCbGsmGeographicalScope(aGsmGeographicalScope),
|
||||
messageCode: aMessageCode,
|
||||
messageId: aMessageId,
|
||||
language: aLanguage,
|
||||
body: aBody,
|
||||
messageClass: this._convertCbMessageClass(aMessageClass),
|
||||
timestamp: aTimestamp,
|
||||
cdmaServiceCategory: null,
|
||||
etws: null
|
||||
};
|
||||
|
||||
if (aHasEtwsInfo) {
|
||||
systemMessage.etws = {
|
||||
warningType: this._convertCbEtwsWarningType(aEtwsWarningType),
|
||||
emergencyUserAlert: aEtwsEmergencyUserAlert,
|
||||
popup: aEtwsPopup
|
||||
};
|
||||
}
|
||||
|
||||
if (aCdmaServiceCategory !=
|
||||
Ci.nsICellBroadcastService.CDMA_SERVICE_CATEGORY_INVALID) {
|
||||
systemMessage.cdmaServiceCategory = aCdmaServiceCategory;
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
debug("CBS system message to be broadcasted: " + JSON.stringify(systemMessage));
|
||||
}
|
||||
|
||||
gSystemMessenger.broadcastMessage("cellbroadcast-received", systemMessage);
|
||||
|
||||
// Notify received message to registered listener
|
||||
for (let listener of this._listeners) {
|
||||
try {
|
||||
listener.notifyMessageReceived(aServiceId,
|
||||
aGsmGeographicalScope,
|
||||
aMessageCode,
|
||||
aMessageId,
|
||||
aLanguage,
|
||||
aBody,
|
||||
aMessageClass,
|
||||
aTimestamp,
|
||||
aCdmaServiceCategory,
|
||||
aHasEtwsInfo,
|
||||
aEtwsWarningType,
|
||||
aEtwsEmergencyUserAlert,
|
||||
aEtwsPopup);
|
||||
} catch (e) {
|
||||
debug("listener threw an exception: " + e);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* nsIObserver interface.
|
||||
*/
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case NS_XPCOM_SHUTDOWN_OBSERVER_ID:
|
||||
Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
|
||||
|
||||
// Remove all listeners.
|
||||
this._listeners = [];
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CellBroadcastService]);
|
6
dom/cellbroadcast/gonk/CellBroadcastService.manifest
Normal file
6
dom/cellbroadcast/gonk/CellBroadcastService.manifest
Normal file
@ -0,0 +1,6 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
component {7ba407ce-21fd-11e4-a836-1bfdee377e5c} CellBroadcastService.js
|
||||
contract @mozilla.org/cellbroadcast/gonkservice;1 {7ba407ce-21fd-11e4-a836-1bfdee377e5c}
|
@ -5,9 +5,12 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsICellBroadcastProvider.idl',
|
||||
'nsIDOMMozCellBroadcastMessage.idl',
|
||||
'nsICellBroadcastService.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_cellbroadcast'
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
|
||||
XPIDL_SOURCES += [
|
||||
'nsIGonkCellBroadcastService.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_cellbroadcast'
|
||||
|
@ -1,35 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMMozCellBroadcastMessage;
|
||||
|
||||
[scriptable, uuid(4c6fb794-31bd-4ed7-b21a-34b82aa3efbe)]
|
||||
interface nsICellBroadcastListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* Called when a Cell Broadcast message has been received by the network.
|
||||
*
|
||||
* @param message
|
||||
* The received Cell Broadcast Message.
|
||||
*/
|
||||
void notifyMessageReceived(in nsIDOMMozCellBroadcastMessage message);
|
||||
};
|
||||
|
||||
/**
|
||||
* XPCOM component (in the content process) that provides the cell broadcast
|
||||
* information.
|
||||
*/
|
||||
[scriptable, uuid(e6c01d18-829e-4d5a-9611-60fca36e6b46)]
|
||||
interface nsICellBroadcastProvider : nsISupports
|
||||
{
|
||||
/**
|
||||
* Called when a content process registers receiving unsolicited messages from
|
||||
* RadioInterfaceLayer in the chrome process. Only a content process that has
|
||||
* the 'cellbroadcast' permission is allowed to register.
|
||||
*/
|
||||
void registerCellBroadcastMsg(in nsICellBroadcastListener listener);
|
||||
void unregisterCellBroadcastMsg(in nsICellBroadcastListener listener);
|
||||
};
|
96
dom/cellbroadcast/interfaces/nsICellBroadcastService.idl
Normal file
96
dom/cellbroadcast/interfaces/nsICellBroadcastService.idl
Normal file
@ -0,0 +1,96 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "domstubs.idl"
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(56f66190-44a0-11e4-aa32-636783cc014a)]
|
||||
interface nsICellBroadcastListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* Called when a Cell Broadcast message has been received by the network.
|
||||
*/
|
||||
void notifyMessageReceived(in unsigned long aServiceId,
|
||||
in unsigned long aGsmGeographicalScope,
|
||||
in unsigned short aMessageCode,
|
||||
in unsigned short aMessageId,
|
||||
in DOMString aLanguage,
|
||||
in DOMString aBody,
|
||||
in unsigned long aMessageClass,
|
||||
in DOMTimeStamp aTimestamp,
|
||||
in unsigned long aCdmaServiceCategory,
|
||||
in boolean aHasEtwsInfo,
|
||||
in unsigned long aEtwsWarningType,
|
||||
in boolean aEtwsEmergencyUserAlert,
|
||||
in boolean aEtwsPopup);
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define CELLBROADCAST_SERVICE_CID \
|
||||
{ 0xc870bdca, 0x277c, 0x11e4, { 0xac, 0xa3, 0x33, 0x73, 0xa1, 0xef, 0x48, 0xf8 } }
|
||||
#define CELLBROADCAST_SERVICE_CONTRACTID \
|
||||
"@mozilla.org/cellbroadcast/cellbroadcastservice;1"
|
||||
%}
|
||||
|
||||
/**
|
||||
* XPCOM component that provides the cell broadcast information.
|
||||
*/
|
||||
[scriptable, uuid(eed283f6-44a8-11e4-b364-afb894b7a283)]
|
||||
interface nsICellBroadcastService : nsISupports
|
||||
{
|
||||
/**
|
||||
* Constant definitions of predefined GSM Geographic Scope
|
||||
* See 3GPP TS 23.041 clause 9.4.1.2.1 Serial Number
|
||||
*/
|
||||
const unsigned short GSM_GEOGRAPHICAL_SCOPE_CELL_IMMEDIATE = 0;
|
||||
const unsigned short GSM_GEOGRAPHICAL_SCOPE_PLMN = 1;
|
||||
const unsigned short GSM_GEOGRAPHICAL_SCOPE_LOCATION_AREA = 2;
|
||||
const unsigned short GSM_GEOGRAPHICAL_SCOPE_CELL = 3;
|
||||
const unsigned short GSM_GEOGRAPHICAL_SCOPE_INVALID = 4;
|
||||
|
||||
/**
|
||||
* Constant definitions of predefined GSM Message Class
|
||||
* See 3GPP TS 23.038 clause 5 CBS Data Coding Scheme
|
||||
*/
|
||||
const unsigned short GSM_MESSAGE_CLASS_0 = 0;
|
||||
const unsigned short GSM_MESSAGE_CLASS_1 = 1;
|
||||
const unsigned short GSM_MESSAGE_CLASS_2 = 2;
|
||||
const unsigned short GSM_MESSAGE_CLASS_3 = 3;
|
||||
const unsigned short GSM_MESSAGE_CLASS_USER_1 = 4;
|
||||
const unsigned short GSM_MESSAGE_CLASS_USER_2 = 5;
|
||||
const unsigned short GSM_MESSAGE_CLASS_NORMAL = 6;
|
||||
const unsigned short GSM_MESSAGE_CLASS_INVALID = 7;
|
||||
|
||||
/**
|
||||
* Constant definitions of predefined GSM ETWS Warning Types
|
||||
* see 3GPP TS 23.041 clause 9.3.24 Warning-Type
|
||||
*/
|
||||
const unsigned short GSM_ETWS_WARNING_EARTHQUAKE = 0;
|
||||
const unsigned short GSM_ETWS_WARNING_TSUNAMI = 1;
|
||||
const unsigned short GSM_ETWS_WARNING_EARTHQUAKE_TSUNAMI = 2;
|
||||
const unsigned short GSM_ETWS_WARNING_TEST = 3;
|
||||
const unsigned short GSM_ETWS_WARNING_OTHER = 4;
|
||||
const unsigned short GSM_ETWS_WARNING_INVALID = 5;
|
||||
|
||||
/**
|
||||
* Attribute CdmaServiceCategory is only valid in CDMA network.
|
||||
* Set to CDMA_SERVICE_CATEGORY_INVALID if received from GSM/UMTS network.
|
||||
*/
|
||||
const unsigned long CDMA_SERVICE_CATEGORY_INVALID = 0xFFFFFFFF;
|
||||
|
||||
/**
|
||||
* Called to register receiving cellbroadcast messages.
|
||||
*
|
||||
* 'cellbroadcast' permission is required for registration/unregistration.
|
||||
*/
|
||||
void registerListener(in nsICellBroadcastListener listener);
|
||||
void unregisterListener(in nsICellBroadcastListener listener);
|
||||
};
|
||||
|
||||
%{C++
|
||||
template<typename T> struct already_AddRefed;
|
||||
|
||||
already_AddRefed<nsICellBroadcastService>
|
||||
NS_CreateCellBroadcastService();
|
||||
%}
|
31
dom/cellbroadcast/interfaces/nsIGonkCellBroadcastService.idl
Normal file
31
dom/cellbroadcast/interfaces/nsIGonkCellBroadcastService.idl
Normal file
@ -0,0 +1,31 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsICellBroadcastService.idl"
|
||||
|
||||
%{C++
|
||||
#define GONK_CELLBROADCAST_SERVICE_CONTRACTID \
|
||||
"@mozilla.org/cellbroadcast/gonkservice;1"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(7cac92aa-42f8-11e4-96f3-7f490e355277)]
|
||||
interface nsIGonkCellBroadcastService : nsICellBroadcastService
|
||||
{
|
||||
/**
|
||||
* Called when a cellbroadcast message has been received by the network.
|
||||
*/
|
||||
void notifyMessageReceived(in unsigned long aServiceId,
|
||||
in unsigned long aGsmGeographicalScope,
|
||||
in unsigned short aMessageCode,
|
||||
in unsigned short aMessageId,
|
||||
in DOMString aLanguage,
|
||||
in DOMString aBody,
|
||||
in unsigned long aMessageClass,
|
||||
in DOMTimeStamp aTimestamp,
|
||||
in unsigned long aCdmaServiceCategory,
|
||||
in boolean aHasEtwsInfo,
|
||||
in unsigned long aEtwsWarningType,
|
||||
in boolean aEtwsEmergencyUserAlert,
|
||||
in boolean aEtwsPopup);
|
||||
};
|
110
dom/cellbroadcast/ipc/CellBroadcastIPCService.cpp
Normal file
110
dom/cellbroadcast/ipc/CellBroadcastIPCService.cpp
Normal file
@ -0,0 +1,110 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "CellBroadcastIPCService.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace cellbroadcast {
|
||||
|
||||
NS_IMPL_ISUPPORTS(CellBroadcastIPCService, nsICellBroadcastService)
|
||||
|
||||
CellBroadcastIPCService::CellBroadcastIPCService()
|
||||
: mActorDestroyed(false)
|
||||
{
|
||||
ContentChild::GetSingleton()->SendPCellBroadcastConstructor(this);
|
||||
}
|
||||
|
||||
CellBroadcastIPCService::~CellBroadcastIPCService()
|
||||
{
|
||||
if (!mActorDestroyed) {
|
||||
Send__delete__(this);
|
||||
}
|
||||
|
||||
mListeners.Clear();
|
||||
}
|
||||
|
||||
/*
|
||||
* Implementation of nsICellBroadcastService.
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
CellBroadcastIPCService::RegisterListener(nsICellBroadcastListener* aListener)
|
||||
{
|
||||
MOZ_ASSERT(!mListeners.Contains(aListener));
|
||||
|
||||
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_UNEXPECTED);
|
||||
|
||||
// nsTArray doesn't fail.
|
||||
mListeners.AppendElement(aListener);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CellBroadcastIPCService::UnregisterListener(nsICellBroadcastListener* aListener)
|
||||
{
|
||||
MOZ_ASSERT(mListeners.Contains(aListener));
|
||||
|
||||
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_UNEXPECTED);
|
||||
|
||||
// We always have the element here, so it can't fail.
|
||||
mListeners.RemoveElement(aListener);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Implementation of PCellBroadcastChild.
|
||||
*/
|
||||
|
||||
bool
|
||||
CellBroadcastIPCService::RecvNotifyReceivedMessage(const uint32_t& aServiceId,
|
||||
const uint32_t& aGsmGeographicalScope,
|
||||
const uint16_t& aMessageCode,
|
||||
const uint16_t& aMessageId,
|
||||
const nsString& aLanguage,
|
||||
const nsString& aBody,
|
||||
const uint32_t& aMessageClass,
|
||||
const uint64_t& aTimestamp,
|
||||
const uint32_t& aCdmaServiceCategory,
|
||||
const bool& aHasEtwsInfo,
|
||||
const uint32_t& aEtwsWarningType,
|
||||
const bool& aEtwsEmergencyUserAlert,
|
||||
const bool& aEtwsPopup)
|
||||
{
|
||||
// UnregisterListener() could be triggered in
|
||||
// nsICellBroadcastListener::NotifyMessageReceived().
|
||||
// Make a immutable copy for notifying the event.
|
||||
nsTArray<nsCOMPtr<nsICellBroadcastListener>> immutableListeners(mListeners);
|
||||
for (uint32_t i = 0; i < immutableListeners.Length(); i++) {
|
||||
immutableListeners[i]->NotifyMessageReceived(aServiceId,
|
||||
aGsmGeographicalScope,
|
||||
aMessageCode,
|
||||
aMessageId,
|
||||
aLanguage,
|
||||
aBody,
|
||||
aMessageClass,
|
||||
aTimestamp,
|
||||
aCdmaServiceCategory,
|
||||
aHasEtwsInfo,
|
||||
aEtwsWarningType,
|
||||
aEtwsEmergencyUserAlert,
|
||||
aEtwsPopup);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CellBroadcastIPCService::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
mActorDestroyed = true;
|
||||
}
|
||||
|
||||
} // namespace cellbroadcast
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
58
dom/cellbroadcast/ipc/CellBroadcastIPCService.h
Normal file
58
dom/cellbroadcast/ipc/CellBroadcastIPCService.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_cellbroadcast_CellBroadcastIPCService_h
|
||||
#define mozilla_dom_cellbroadcast_CellBroadcastIPCService_h
|
||||
|
||||
#include "mozilla/dom/cellbroadcast/PCellBroadcastChild.h"
|
||||
#include "nsICellBroadcastService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace cellbroadcast {
|
||||
|
||||
class CellBroadcastIPCService MOZ_FINAL : public PCellBroadcastChild
|
||||
, public nsICellBroadcastService
|
||||
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICELLBROADCASTSERVICE
|
||||
|
||||
CellBroadcastIPCService();
|
||||
|
||||
// PCellBroadcastChild interface
|
||||
virtual bool
|
||||
RecvNotifyReceivedMessage(const uint32_t& aServiceId,
|
||||
const uint32_t& aGsmGeographicalScope,
|
||||
const uint16_t& aMessageCode,
|
||||
const uint16_t& aMessageId,
|
||||
const nsString& aLanguage,
|
||||
const nsString& aBody,
|
||||
const uint32_t& aMessageClass,
|
||||
const uint64_t& aTimestamp,
|
||||
const uint32_t& aCdmaServiceCategory,
|
||||
const bool& aHasEtwsInfo,
|
||||
const uint32_t& aEtwsWarningType,
|
||||
const bool& aEtwsEmergencyUserAlert,
|
||||
const bool& aEtwsPopup) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
|
||||
~CellBroadcastIPCService();
|
||||
|
||||
bool mActorDestroyed;
|
||||
nsTArray<nsCOMPtr<nsICellBroadcastListener>> mListeners;
|
||||
};
|
||||
|
||||
} // namespace cellbroadcast
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_cellbroadcast_CellBroadcastIPCService_h
|
74
dom/cellbroadcast/ipc/CellBroadcastParent.cpp
Normal file
74
dom/cellbroadcast/ipc/CellBroadcastParent.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/cellbroadcast/CellBroadcastParent.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace cellbroadcast {
|
||||
|
||||
NS_IMPL_ISUPPORTS(CellBroadcastParent, nsICellBroadcastListener)
|
||||
|
||||
bool
|
||||
CellBroadcastParent::Init()
|
||||
{
|
||||
nsCOMPtr<nsICellBroadcastService> service =
|
||||
do_GetService(CELLBROADCAST_SERVICE_CONTRACTID);
|
||||
|
||||
if (service) {
|
||||
return NS_SUCCEEDED(service->RegisterListener(this));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
CellBroadcastParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
nsCOMPtr<nsICellBroadcastService> service =
|
||||
do_GetService(CELLBROADCAST_SERVICE_CONTRACTID);
|
||||
if (service) {
|
||||
service->UnregisterListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* nsICellBroadcastListener
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
CellBroadcastParent::NotifyMessageReceived(uint32_t aServiceId,
|
||||
uint32_t aGsmGeographicalScope,
|
||||
uint16_t aMessageCode,
|
||||
uint16_t aMessageId,
|
||||
const nsAString& aLanguage,
|
||||
const nsAString& aBody,
|
||||
uint32_t aMessageClass,
|
||||
DOMTimeStamp aTimestamp,
|
||||
uint32_t aCdmaServiceCategory,
|
||||
bool aHasEtwsInfo,
|
||||
uint32_t aEtwsWarningType,
|
||||
bool aEtwsEmergencyUserAlert,
|
||||
bool aEtwsPopup)
|
||||
{
|
||||
return SendNotifyReceivedMessage(aServiceId,
|
||||
aGsmGeographicalScope,
|
||||
aMessageCode,
|
||||
aMessageId,
|
||||
nsString(aLanguage),
|
||||
nsString(aBody),
|
||||
aMessageClass,
|
||||
aTimestamp,
|
||||
aCdmaServiceCategory,
|
||||
aHasEtwsInfo,
|
||||
aEtwsWarningType,
|
||||
aEtwsEmergencyUserAlert,
|
||||
aEtwsPopup) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
} // namespace cellbroadcast
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
38
dom/cellbroadcast/ipc/CellBroadcastParent.h
Normal file
38
dom/cellbroadcast/ipc/CellBroadcastParent.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#ifndef mozilla_dom_cellbroadcast_CellBroadcastParent_h
|
||||
#define mozilla_dom_cellbroadcast_CellBroadcastParent_h
|
||||
|
||||
#include "mozilla/dom/cellbroadcast/PCellBroadcastParent.h"
|
||||
#include "nsICellBroadcastService.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace cellbroadcast {
|
||||
|
||||
class CellBroadcastParent MOZ_FINAL : public PCellBroadcastParent
|
||||
, public nsICellBroadcastListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICELLBROADCASTLISTENER
|
||||
|
||||
bool Init();
|
||||
|
||||
private:
|
||||
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
|
||||
~CellBroadcastParent() {};
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy);
|
||||
};
|
||||
|
||||
} // namespace cellbroadcast
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_cellbroadcast_CellBroadcastParent_h
|
41
dom/cellbroadcast/ipc/PCellBroadcast.ipdl
Normal file
41
dom/cellbroadcast/ipc/PCellBroadcast.ipdl
Normal file
@ -0,0 +1,41 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et ft=cpp : */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PContent;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace cellbroadcast {
|
||||
|
||||
sync protocol PCellBroadcast {
|
||||
manager PContent;
|
||||
|
||||
child:
|
||||
NotifyReceivedMessage(uint32_t aServiceId,
|
||||
uint32_t aGsmGeographicalScope,
|
||||
uint16_t aMessageCode,
|
||||
uint16_t aMessageId,
|
||||
nsString aLanguage,
|
||||
nsString aBody,
|
||||
uint32_t aMessageClass,
|
||||
uint64_t aTimestamp,
|
||||
uint32_t aCdmaServiceCategory,
|
||||
bool aHasEtwsInfo,
|
||||
uint32_t aEtwsWarningType,
|
||||
bool aEtwsEmergencyUserAlert,
|
||||
bool aEtwsPopup);
|
||||
|
||||
parent:
|
||||
/**
|
||||
* Sent when the child no longer needs to use cellbroadcast.
|
||||
*/
|
||||
__delete__();
|
||||
|
||||
};
|
||||
|
||||
} // namespace mobilemessage
|
||||
} // namespace dom
|
||||
} // namespace cellbroadcast
|
@ -8,12 +8,33 @@ DIRS += ['interfaces']
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'CellBroadcast.h',
|
||||
'CellBroadcastMessage.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'CellBroadcast.cpp',
|
||||
'CellBroadcastMessage.cpp',
|
||||
'ipc/CellBroadcastIPCService.cpp',
|
||||
'ipc/CellBroadcastParent.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
|
||||
EXTRA_COMPONENTS += [
|
||||
'gonk/CellBroadcastService.js',
|
||||
'gonk/CellBroadcastService.manifest',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom.cellbroadcast += [
|
||||
'ipc/CellBroadcastIPCService.h',
|
||||
'ipc/CellBroadcastParent.h',
|
||||
]
|
||||
|
||||
IPDL_SOURCES += [
|
||||
'ipc/PCellBroadcast.ipdl',
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
@ -23,7 +23,9 @@ function testReceiving_ETWS_MessageAttributes() {
|
||||
ok(aMessage.etws.emergencyUserAlert != null,
|
||||
"aMessage.etws.emergencyUserAlert");
|
||||
ok(aMessage.etws.popup != null, "aMessage.etws.popup");
|
||||
ok(aMessage.cdmaServiceCategory != null, "aMessage.cdmaServiceCategory");
|
||||
|
||||
// cdmaServiceCategory shall always be unavailable in GMS/UMTS CB message.
|
||||
ok(aMessage.cdmaServiceCategory == null, "aMessage.cdmaServiceCategory");
|
||||
};
|
||||
|
||||
// Here we use a simple ETWS message for test.
|
||||
|
@ -22,7 +22,9 @@ function testReceiving_GSM_MessageAttributes() {
|
||||
ok(aMessage.etws.emergencyUserAlert != null, "aMessage.etws.emergencyUserAlert");
|
||||
ok(aMessage.etws.popup != null, "aMessage.etws.popup");
|
||||
}
|
||||
ok(aMessage.cdmaServiceCategory != null, "aMessage.cdmaServiceCategory");
|
||||
|
||||
// cdmaServiceCategory shall always be unavailable in GMS/UMTS CB message.
|
||||
ok(aMessage.cdmaServiceCategory == null, "aMessage.cdmaServiceCategory");
|
||||
};
|
||||
|
||||
// Here we use a simple GSM message for test.
|
||||
@ -296,20 +298,6 @@ function testReceiving_GSM_Multipart() {
|
||||
return promise;
|
||||
}
|
||||
|
||||
function testReceiving_GSM_ServiceCategory() {
|
||||
log("Test receiving GSM Cell Broadcast - Service Category");
|
||||
|
||||
let verifyCBMessage = (aMessage) => {
|
||||
// Bug 910091
|
||||
// "Service Category" is not defined in GSM. We should always get '0' here.
|
||||
is(aMessage.cdmaServiceCategory, 0, "aMessage.cdmaServiceCategory");
|
||||
};
|
||||
|
||||
let pdu = buildHexStr(0, CB_MESSAGE_SIZE_GSM * 2);
|
||||
return sendMultipleRawCbsToEmulatorAndWait([pdu])
|
||||
.then((aMessage) => verifyCBMessage(aMessage));
|
||||
}
|
||||
|
||||
function testReceiving_GSM_PaddingCharacters() {
|
||||
log("Test receiving GSM Cell Broadcast - Padding Characters <CR>");
|
||||
|
||||
@ -369,6 +357,5 @@ startTestCommon(function testCaseMain() {
|
||||
.then(() => testReceiving_GSM_EmergencyUserAlert())
|
||||
.then(() => testReceiving_GSM_Popup())
|
||||
.then(() => testReceiving_GSM_Multipart())
|
||||
.then(() => testReceiving_GSM_ServiceCategory())
|
||||
.then(() => testReceiving_GSM_PaddingCharacters());
|
||||
});
|
||||
|
@ -20,7 +20,9 @@ function testReceiving_UMTS_MessageAttributes() {
|
||||
ok(aMessage.etws.emergencyUserAlert != null, "aMessage.etws.emergencyUserAlert");
|
||||
ok(aMessage.etws.popup != null, "aMessage.etws.popup");
|
||||
}
|
||||
ok(aMessage.cdmaServiceCategory != null, "aMessage.cdmaServiceCategory");
|
||||
|
||||
// cdmaServiceCategory shall always be unavailable in GMS/UMTS CB message.
|
||||
ok(aMessage.cdmaServiceCategory == null, "aMessage.cdmaServiceCategory");
|
||||
};
|
||||
|
||||
// Here we use a single UMTS message for test.
|
||||
|
@ -56,6 +56,8 @@ EncodingUtils::FindEncodingForLabelNoReplacement(const nsACString& aLabel,
|
||||
bool
|
||||
EncodingUtils::IsAsciiCompatible(const nsACString& aPreferredName)
|
||||
{
|
||||
// HZ and UTF-7 are no longer in mozilla-central, but keeping them here
|
||||
// just in case for the benefit of comm-central.
|
||||
return !(aPreferredName.LowerCaseEqualsLiteral("utf-16") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("utf-16be") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("utf-16le") ||
|
||||
|
@ -10,7 +10,6 @@ EUC-JP=ja
|
||||
EUC-KR=ko
|
||||
gb18030=zh-CN
|
||||
gbk=zh-CN
|
||||
HZ-GB-2312=zh-CN
|
||||
IBM866=x-cyrillic
|
||||
ISO-2022-JP=ja
|
||||
ISO-8859-3=x-western
|
||||
|
@ -187,7 +187,7 @@ gbk=gbk
|
||||
iso-ir-58=gbk
|
||||
x-gbk=gbk
|
||||
gb18030=gb18030
|
||||
hz-gb-2312=HZ-GB-2312
|
||||
hz-gb-2312=replacement
|
||||
big5=Big5
|
||||
big5-hkscs=Big5-HKSCS
|
||||
cn-big5=Big5
|
||||
|
1
dom/encoding/test/reftest/bug945215-1-ref.html
Normal file
1
dom/encoding/test/reftest/bug945215-1-ref.html
Normal file
@ -0,0 +1 @@
|
||||
<meta charset=utf-8><EFBFBD>
|
1
dom/encoding/test/reftest/bug945215-1.html
Normal file
1
dom/encoding/test/reftest/bug945215-1.html
Normal file
@ -0,0 +1 @@
|
||||
<meta charset=HZ-GB-2312>
|
3
dom/encoding/test/reftest/bug945215-2-ref.html
Normal file
3
dom/encoding/test/reftest/bug945215-2-ref.html
Normal file
@ -0,0 +1,3 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<iframe src="data:text/html;charset=utf-8,<2C><iframe src='data:text/html;charset=utf-8,PASS'></iframe>" width=400 height=200></iframe>
|
17
dom/encoding/test/reftest/bug945215-2.html
Normal file
17
dom/encoding/test/reftest/bug945215-2.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html class=reftest-wait>
|
||||
<meta charset=utf-8>
|
||||
<script>
|
||||
function runTest() {
|
||||
var r = document.documentElement;
|
||||
var d = window[0].document;
|
||||
var i = d.createElement("iframe");
|
||||
i.src = "data:text/html,PASS";
|
||||
i.onload = function() {
|
||||
r.removeAttribute("class");
|
||||
}
|
||||
d.body.appendChild(i);
|
||||
}
|
||||
</script>
|
||||
<body onload="runTest();">
|
||||
<iframe src="bug945215-1.html" width=400 height=200></iframe>
|
@ -1,3 +1,5 @@
|
||||
== bug863728-1.html bug863728-1-ref.html
|
||||
== bug863728-2.html bug863728-2-ref.html
|
||||
== bug863728-3.html bug863728-3-ref.html
|
||||
== bug945215-1.html bug945215-1-ref.html
|
||||
== bug945215-2.html bug945215-2-ref.html
|
||||
|
@ -5,7 +5,6 @@ unit/test_big5.js
|
||||
unit/test_euc-jp.js
|
||||
unit/test_euc-kr.js
|
||||
unit/test_gbk.js
|
||||
unit/test_hz-gb-2312.js
|
||||
unit/test_iso-2022-jp.js
|
||||
unit/test_iso-2022-kr.js
|
||||
unit/test_shift_jis.js
|
||||
|
@ -342,7 +342,6 @@ function testDecoderGetEncoding()
|
||||
{encoding: "x-mac-cyrillic", labels: ["x-mac-cyrillic", "x-mac-ukrainian"]},
|
||||
{encoding: "gbk", labels: ["chinese", "csgb2312", "csiso58gb231280", "gb2312", "gb_2312", "gb_2312-80", "gbk", "iso-ir-58", "x-gbk"]},
|
||||
{encoding: "gb18030", labels: ["gb18030"]},
|
||||
{encoding: "hz-gb-2312", labels: ["hz-gb-2312"]},
|
||||
{encoding: "big5", labels: ["big5", "cn-big5", "csbig5", "x-x-big5"]},
|
||||
{encoding: "big5-hkscs", labels: ["big5-hkscs"]},
|
||||
{encoding: "euc-jp", labels: ["cseucpkdfmtjapanese", "euc-jp", "x-euc-jp"]},
|
||||
@ -352,7 +351,7 @@ function testDecoderGetEncoding()
|
||||
{encoding: "utf-16le", labels: ["utf-16", "utf-16le"]},
|
||||
{encoding: "utf-16be", labels: ["utf-16be"]},
|
||||
{encoding: "x-user-defined", labels: ["x-user-defined"]},
|
||||
{error: "TypeError", labels: ["x-windows-949", "\u0130SO-8859-1", "csiso2022kr", "iso-2022-kr", "iso-2022-cn", "iso-2022-cn-ext", "replacement"]},
|
||||
{error: "TypeError", labels: ["x-windows-949", "\u0130SO-8859-1", "csiso2022kr", "iso-2022-kr", "iso-2022-cn", "iso-2022-cn-ext", "replacement", "hz-gb-2312"]},
|
||||
];
|
||||
|
||||
for (var le of labelEncodings) {
|
||||
|
@ -18,7 +18,6 @@ setup({explicit_timeout: true});
|
||||
<!-- TODO: test for all single-byte encoding indexes -->
|
||||
<script type="text/javascript" src="unit/test_gbk.js"></script>
|
||||
<!-- TODO: gb18030 -->
|
||||
<script type="text/javascript" src="unit/test_hz-gb-2312.js"></script>
|
||||
<script type="text/javascript" src="unit/test_big5.js"></script>
|
||||
<script type="text/javascript" src="unit/test_euc-jp.js"></script>
|
||||
<script type="text/javascript" src="unit/test_iso-2022-jp.js"></script>
|
||||
|
@ -5,6 +5,5 @@ skip-if = e10s
|
||||
[test_euc-jp.js]
|
||||
[test_euc-kr.js]
|
||||
[test_gbk.js]
|
||||
[test_hz-gb-2312.js]
|
||||
[test_iso-2022-jp.js]
|
||||
[test_shift_jis.js]
|
||||
|
File diff suppressed because one or more lines are too long
@ -163,15 +163,13 @@ test(
|
||||
|
||||
test(
|
||||
function () {
|
||||
var encodings = ["utf-8", "ibm866", "iso-8859-2", "iso-8859-3", "iso-8859-4", "iso-8859-5", "iso-8859-6", "iso-8859-7", "iso-8859-8", "iso-8859-8-i", "iso-8859-10", "iso-8859-13", "iso-8859-14", "iso-8859-15", "iso-8859-16", "koi8-r", "koi8-u", "macintosh", "windows-874", "windows-1250", "windows-1251", "windows-1252", "windows-1253", "windows-1254", "windows-1255", "windows-1256", "windows-1257", "windows-1258", "x-mac-cyrillic", "gbk", "gb18030", "hz-gb-2312", "big5", "euc-jp", "iso-2022-jp", "shift_jis", "euc-kr", "x-user-defined"];
|
||||
var encodings = ["utf-8", "ibm866", "iso-8859-2", "iso-8859-3", "iso-8859-4", "iso-8859-5", "iso-8859-6", "iso-8859-7", "iso-8859-8", "iso-8859-8-i", "iso-8859-10", "iso-8859-13", "iso-8859-14", "iso-8859-15", "iso-8859-16", "koi8-r", "koi8-u", "macintosh", "windows-874", "windows-1250", "windows-1251", "windows-1252", "windows-1253", "windows-1254", "windows-1255", "windows-1256", "windows-1257", "windows-1258", "x-mac-cyrillic", "gbk", "gb18030", "big5", "euc-jp", "iso-2022-jp", "shift_jis", "euc-kr", "x-user-defined"];
|
||||
|
||||
encodings.forEach(function (encoding) {
|
||||
var string = '', bytes = [];
|
||||
for (var i = 0; i < 128; ++i) {
|
||||
|
||||
// Encodings that have escape codes in 0x00-0x7F
|
||||
if (encoding === "hz-gb-2312" && i === 0x7E)
|
||||
continue;
|
||||
if (encoding === "iso-2022-jp" && i === 0x1B)
|
||||
continue;
|
||||
|
||||
@ -208,7 +206,7 @@ test(
|
||||
|
||||
var utf_encodings = ["utf-8", "utf-16le", "utf-16be"];
|
||||
|
||||
var legacy_encodings = ["ibm866", "iso-8859-2", "iso-8859-3", "iso-8859-4", "iso-8859-5", "iso-8859-6", "iso-8859-7", "iso-8859-8", "iso-8859-8-i", "iso-8859-10", "iso-8859-13", "iso-8859-14", "iso-8859-15", "iso-8859-16", "koi8-r", "koi8-u", "macintosh", "windows-874", "windows-1250", "windows-1251", "windows-1252", "windows-1253", "windows-1254", "windows-1255", "windows-1256", "windows-1257", "windows-1258", "x-mac-cyrillic", "gbk", "gb18030", "hz-gb-2312", "big5", "euc-jp", "iso-2022-jp", "shift_jis", "euc-kr", "x-user-defined"];
|
||||
var legacy_encodings = ["ibm866", "iso-8859-2", "iso-8859-3", "iso-8859-4", "iso-8859-5", "iso-8859-6", "iso-8859-7", "iso-8859-8", "iso-8859-8-i", "iso-8859-10", "iso-8859-13", "iso-8859-14", "iso-8859-15", "iso-8859-16", "koi8-r", "koi8-u", "macintosh", "windows-874", "windows-1250", "windows-1251", "windows-1252", "windows-1253", "windows-1254", "windows-1255", "windows-1256", "windows-1257", "windows-1258", "x-mac-cyrillic", "gbk", "gb18030", "big5", "euc-jp", "iso-2022-jp", "shift_jis", "euc-kr", "x-user-defined"];
|
||||
|
||||
utf_encodings.forEach(function(encoding) {
|
||||
assert_equals(new TextDecoder(encoding).encoding, encoding);
|
||||
|
@ -9,6 +9,5 @@ tail =
|
||||
[test_euc-jp.js]
|
||||
[test_euc-kr.js]
|
||||
[test_gbk.js]
|
||||
[test_hz-gb-2312.js]
|
||||
[test_iso-2022-jp.js]
|
||||
[test_shift_jis.js]
|
||||
|
@ -776,9 +776,10 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
|
||||
// Activate JSAPI, and make sure that exceptions are reported on the right
|
||||
// Window.
|
||||
AutoJSAPI jsapi;
|
||||
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(global))) {
|
||||
if (NS_WARN_IF(!jsapi.Init(global))) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
jsapi.TakeOwnershipOfErrorReporting();
|
||||
JSContext* cx = jsapi.cx();
|
||||
|
||||
nsCOMPtr<nsIAtom> typeAtom = aListener->mTypeAtom;
|
||||
@ -895,7 +896,7 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
|
||||
.setDefineOnScope(false);
|
||||
|
||||
JS::Rooted<JSObject*> handler(cx);
|
||||
result = nsJSUtils::CompileFunction(cx, target, options,
|
||||
result = nsJSUtils::CompileFunction(jsapi, target, options,
|
||||
nsAtomCString(typeAtom),
|
||||
argCount, argNames, *body, handler.address());
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
@ -128,6 +128,7 @@
|
||||
#include "ipc/Nuwa.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/dom/cellbroadcast/CellBroadcastIPCService.h"
|
||||
#include "mozilla/dom/mobileconnection/MobileConnectionChild.h"
|
||||
#include "mozilla/dom/mobilemessage/SmsChild.h"
|
||||
#include "mozilla/dom/devicestorage/DeviceStorageRequestChild.h"
|
||||
@ -161,6 +162,7 @@ using namespace base;
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::docshell;
|
||||
using namespace mozilla::dom::bluetooth;
|
||||
using namespace mozilla::dom::cellbroadcast;
|
||||
using namespace mozilla::dom::devicestorage;
|
||||
using namespace mozilla::dom::ipc;
|
||||
using namespace mozilla::dom::mobileconnection;
|
||||
@ -387,7 +389,7 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage)
|
||||
{
|
||||
if (!mChild)
|
||||
return NS_OK;
|
||||
|
||||
|
||||
nsCOMPtr<nsIScriptError> scriptError = do_QueryInterface(aMessage);
|
||||
if (scriptError) {
|
||||
nsString msg, sourceName, sourceLine;
|
||||
@ -1379,6 +1381,30 @@ ContentChild::DeallocPExternalHelperAppChild(PExternalHelperAppChild* aService)
|
||||
return true;
|
||||
}
|
||||
|
||||
PCellBroadcastChild*
|
||||
ContentChild::AllocPCellBroadcastChild()
|
||||
{
|
||||
MOZ_CRASH("No one should be allocating PCellBroadcastChild actors");
|
||||
}
|
||||
|
||||
PCellBroadcastChild*
|
||||
ContentChild::SendPCellBroadcastConstructor(PCellBroadcastChild* aActor)
|
||||
{
|
||||
aActor = PContentChild::SendPCellBroadcastConstructor(aActor);
|
||||
if (aActor) {
|
||||
static_cast<CellBroadcastIPCService*>(aActor)->AddRef();
|
||||
}
|
||||
|
||||
return aActor;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::DeallocPCellBroadcastChild(PCellBroadcastChild* aActor)
|
||||
{
|
||||
static_cast<CellBroadcastIPCService*>(aActor)->Release();
|
||||
return true;
|
||||
}
|
||||
|
||||
PSmsChild*
|
||||
ContentChild::AllocPSmsChild()
|
||||
{
|
||||
|
@ -225,6 +225,10 @@ public:
|
||||
PBrowserChild* aBrowser) MOZ_OVERRIDE;
|
||||
virtual bool DeallocPExternalHelperAppChild(PExternalHelperAppChild *aService) MOZ_OVERRIDE;
|
||||
|
||||
virtual PCellBroadcastChild* AllocPCellBroadcastChild() MOZ_OVERRIDE;
|
||||
PCellBroadcastChild* SendPCellBroadcastConstructor(PCellBroadcastChild* aActor);
|
||||
virtual bool DeallocPCellBroadcastChild(PCellBroadcastChild* aActor) MOZ_OVERRIDE;
|
||||
|
||||
virtual PSmsChild* AllocPSmsChild() MOZ_OVERRIDE;
|
||||
virtual bool DeallocPSmsChild(PSmsChild*) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -31,22 +31,23 @@
|
||||
#include "IHistory.h"
|
||||
#include "mozIApplication.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/dom/asmjscache/AsmJSCache.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/DataStoreService.h"
|
||||
#include "mozilla/dom/ExternalHelperAppParent.h"
|
||||
#include "mozilla/dom/PContentBridgeParent.h"
|
||||
#include "mozilla/dom/PCycleCollectWithLogsParent.h"
|
||||
#include "mozilla/dom/PMemoryReportRequestParent.h"
|
||||
#include "mozilla/dom/power/PowerManagerService.h"
|
||||
#include "mozilla/dom/DOMStorageIPC.h"
|
||||
#include "mozilla/dom/bluetooth/PBluetoothParent.h"
|
||||
#include "mozilla/dom/PFMRadioParent.h"
|
||||
#include "mozilla/dom/devicestorage/DeviceStorageRequestParent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ExternalHelperAppParent.h"
|
||||
#include "mozilla/dom/FileSystemRequestParent.h"
|
||||
#include "mozilla/dom/GeolocationBinding.h"
|
||||
#include "mozilla/dom/PContentBridgeParent.h"
|
||||
#include "mozilla/dom/PCycleCollectWithLogsParent.h"
|
||||
#include "mozilla/dom/PFMRadioParent.h"
|
||||
#include "mozilla/dom/PMemoryReportRequestParent.h"
|
||||
#include "mozilla/dom/asmjscache/AsmJSCache.h"
|
||||
#include "mozilla/dom/bluetooth/PBluetoothParent.h"
|
||||
#include "mozilla/dom/cellbroadcast/CellBroadcastParent.h"
|
||||
#include "mozilla/dom/devicestorage/DeviceStorageRequestParent.h"
|
||||
#include "mozilla/dom/mobileconnection/MobileConnectionParent.h"
|
||||
#include "mozilla/dom/mobilemessage/SmsParent.h"
|
||||
#include "mozilla/dom/power/PowerManagerService.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "mozilla/dom/telephony/TelephonyParent.h"
|
||||
#include "mozilla/dom/time/DateCacheCleaner.h"
|
||||
@ -190,6 +191,7 @@ static const char* sClipboardTextFlavors[] = { kUnicodeMime };
|
||||
using base::ChildPrivileges;
|
||||
using base::KillProcess;
|
||||
using namespace mozilla::dom::bluetooth;
|
||||
using namespace mozilla::dom::cellbroadcast;
|
||||
using namespace mozilla::dom::devicestorage;
|
||||
using namespace mozilla::dom::indexedDB;
|
||||
using namespace mozilla::dom::power;
|
||||
@ -2864,7 +2866,7 @@ ContentParent::KillHard()
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(&ProcessWatcher::EnsureProcessTerminated,
|
||||
OtherProcess(), /*force=*/true));
|
||||
//We do clean-up here
|
||||
//We do clean-up here
|
||||
MessageLoop::current()->PostDelayedTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &ContentParent::ShutDownProcess,
|
||||
@ -3069,13 +3071,13 @@ ContentParent::AllocPExternalHelperAppParent(const OptionalURIParams& uri,
|
||||
{
|
||||
ExternalHelperAppParent *parent = new ExternalHelperAppParent(uri, aContentLength);
|
||||
parent->AddRef();
|
||||
parent->Init(this,
|
||||
aMimeContentType,
|
||||
parent->Init(this,
|
||||
aMimeContentType,
|
||||
aContentDisposition,
|
||||
aContentDispositionHint,
|
||||
aContentDispositionFilename,
|
||||
aForceSave,
|
||||
aReferrer,
|
||||
aForceSave,
|
||||
aReferrer,
|
||||
aBrowser);
|
||||
return parent;
|
||||
}
|
||||
@ -3088,6 +3090,31 @@ ContentParent::DeallocPExternalHelperAppParent(PExternalHelperAppParent* aServic
|
||||
return true;
|
||||
}
|
||||
|
||||
PCellBroadcastParent*
|
||||
ContentParent::AllocPCellBroadcastParent()
|
||||
{
|
||||
if (!AssertAppProcessPermission(this, "cellbroadcast")) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CellBroadcastParent* actor = new CellBroadcastParent();
|
||||
actor->AddRef();
|
||||
return actor;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::DeallocPCellBroadcastParent(PCellBroadcastParent* aActor)
|
||||
{
|
||||
static_cast<CellBroadcastParent*>(aActor)->Release();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvPCellBroadcastConstructor(PCellBroadcastParent* aActor)
|
||||
{
|
||||
return static_cast<CellBroadcastParent*>(aActor)->Init();
|
||||
}
|
||||
|
||||
PSmsParent*
|
||||
ContentParent::AllocPSmsParent()
|
||||
{
|
||||
|
@ -469,13 +469,17 @@ private:
|
||||
const nsCString& aMimeContentType,
|
||||
const nsCString& aContentDisposition,
|
||||
const uint32_t& aContentDispositionHint,
|
||||
const nsString& aContentDispositionFilename,
|
||||
const nsString& aContentDispositionFilename,
|
||||
const bool& aForceSave,
|
||||
const int64_t& aContentLength,
|
||||
const OptionalURIParams& aReferrer,
|
||||
PBrowserParent* aBrowser) MOZ_OVERRIDE;
|
||||
virtual bool DeallocPExternalHelperAppParent(PExternalHelperAppParent* aService) MOZ_OVERRIDE;
|
||||
|
||||
virtual PCellBroadcastParent* AllocPCellBroadcastParent() MOZ_OVERRIDE;
|
||||
virtual bool DeallocPCellBroadcastParent(PCellBroadcastParent*) MOZ_OVERRIDE;
|
||||
virtual bool RecvPCellBroadcastConstructor(PCellBroadcastParent* aActor) MOZ_OVERRIDE;
|
||||
|
||||
virtual PSmsParent* AllocPSmsParent() MOZ_OVERRIDE;
|
||||
virtual bool DeallocPSmsParent(PSmsParent*) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -9,6 +9,7 @@ include protocol PBackground;
|
||||
include protocol PBlob;
|
||||
include protocol PBluetooth;
|
||||
include protocol PBrowser;
|
||||
include protocol PCellBroadcast;
|
||||
include protocol PCompositor;
|
||||
include protocol PContentBridge;
|
||||
include protocol PCycleCollectWithLogs;
|
||||
@ -40,6 +41,11 @@ include PTabContext;
|
||||
include URIParams;
|
||||
include ProtocolTypes;
|
||||
|
||||
// Workaround to prevent error if PContentChild.cpp & PContentBridgeParent.cpp
|
||||
// are put into different UnifiedProtocolsXX.cpp files.
|
||||
// XXX Remove this once bug 1069073 is fixed
|
||||
include "mozilla/dom/PContentBridgeParent.h";
|
||||
|
||||
include "mozilla/dom/indexedDB/SerializationHelpers.h";
|
||||
|
||||
using GeoPosition from "nsGeoPositionIPCSerialiser.h";
|
||||
@ -323,6 +329,7 @@ intr protocol PContent
|
||||
manages PBlob;
|
||||
manages PBluetooth;
|
||||
manages PBrowser;
|
||||
manages PCellBroadcast;
|
||||
manages PCrashReporter;
|
||||
manages PCycleCollectWithLogs;
|
||||
manages PDeviceStorageRequest;
|
||||
@ -532,6 +539,8 @@ parent:
|
||||
float systemDefaultScale,
|
||||
bool success);
|
||||
|
||||
PCellBroadcast();
|
||||
|
||||
PSms();
|
||||
|
||||
PSpeechSynthesis();
|
||||
@ -582,11 +591,11 @@ parent:
|
||||
|
||||
CloseAlert(nsString name, Principal principal);
|
||||
|
||||
PExternalHelperApp(OptionalURIParams uri,
|
||||
PExternalHelperApp(OptionalURIParams uri,
|
||||
nsCString aMimeContentType,
|
||||
nsCString aContentDisposition,
|
||||
uint32_t aContentDispositionHint,
|
||||
nsString aContentDispositionFilename,
|
||||
nsCString aContentDisposition,
|
||||
uint32_t aContentDispositionHint,
|
||||
nsString aContentDispositionFilename,
|
||||
bool aForceSave,
|
||||
int64_t aContentLength,
|
||||
OptionalURIParams aReferrer,
|
||||
@ -599,7 +608,7 @@ parent:
|
||||
ConsoleMessage(nsString message);
|
||||
ScriptError(nsString message, nsString sourceName, nsString sourceLine,
|
||||
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
|
||||
nsCString category);
|
||||
nsCString category);
|
||||
|
||||
// nsIPermissionManager messages
|
||||
sync ReadPermissions() returns (Permission[] permissions);
|
||||
|
@ -56,6 +56,7 @@ PECounterExtendsNotIdent=Expected identifier for extends system but found '%1$S'
|
||||
PECounterASWeight=Each weight in the additive-symbols descriptor must be smaller than the previous weight.
|
||||
PEClassSelEOF=class name
|
||||
PEClassSelNotIdent=Expected identifier for class selector but found '%1$S'.
|
||||
PECoordinatePair=Expected coordinate pair but found '%1$S'.
|
||||
PETypeSelEOF=element type
|
||||
PETypeSelNotType=Expected element name or '*' but found '%1$S'.
|
||||
PEUnknownNamespacePrefix=Unknown namespace prefix '%1$S'.
|
||||
@ -106,6 +107,7 @@ PEColorLightnessEOF=lightness
|
||||
PEColorOpacityEOF=opacity in color value
|
||||
PEExpectedNumber=Expected a number but found '%1$S'.
|
||||
PEExpectedCloseParen=Expected ')' but found '%1$S'.
|
||||
PEClipPathEOF=<basic-shape> or reference box
|
||||
PEDeclEndEOF=';' or '}' to end declaration
|
||||
PEParseDeclarationNoColon=Expected ':' but found '%1$S'.
|
||||
PEParseDeclarationDeclExpected=Expected declaration but found '%1$S'.
|
||||
|
@ -46,6 +46,7 @@ DIRS += [
|
||||
'battery',
|
||||
'browser-element',
|
||||
'canvas',
|
||||
'cellbroadcast',
|
||||
'contacts',
|
||||
'crypto',
|
||||
'phonenumberutils',
|
||||
@ -112,7 +113,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
if CONFIG['MOZ_B2G_RIL']:
|
||||
DIRS += [
|
||||
'icc',
|
||||
'cellbroadcast',
|
||||
'wappush',
|
||||
]
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user