Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2015-11-19 15:24:02 +01:00
commit 41ea3b20cb
2377 changed files with 121435 additions and 111774 deletions

View File

@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Bug 1214058 New xpcshell test not getting picked up
Bug 1198458 Fix failures in TaskCluster builds due to analog_agc.cc moving

View File

@ -46,7 +46,7 @@ nsWinUtils::GetComputedStyleDeclaration(nsIContent* aContent)
// Returns number of items in style declaration
nsCOMPtr<nsPIDOMWindow> window =
do_QueryInterface(elm->OwnerDoc()->GetWindow());
do_QueryInterface(elm->OwnerDoc()->GetInnerWindow());
if (!window)
return nullptr;

View File

@ -344,10 +344,6 @@ pref("image.mem.surfacecache.size_factor", 8); // 1/8 of main memory
pref("image.mem.surfacecache.discard_factor", 2); // Discard 1/2 of the surface cache at a time.
pref("image.mem.surfacecache.min_expiration_ms", 86400000); // 24h, we rely on the out of memory hook
// XXX this isn't a good check for "are touch events supported", but
// we don't really have a better one at the moment.
// enable touch events interfaces
pref("dom.w3c_touch_events.enabled", 1);
pref("dom.w3c_touch_events.safetyX", 0); // escape borders in units of 1/240"
pref("dom.w3c_touch_events.safetyY", 120); // escape borders in units of 1/240"

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba7e4b86361af31b153cfebaf99900e0b860f7b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
@ -24,7 +24,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f80d4c8bcb2f5a08015100048b3ae54c0d7999bd"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba7e4b86361af31b153cfebaf99900e0b860f7b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
@ -24,7 +24,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f80d4c8bcb2f5a08015100048b3ae54c0d7999bd"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cba7e4b86361af31b153cfebaf99900e0b860f7b"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cb4604d5a578efd027277059ce3e0f6e3af59bd1"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba7e4b86361af31b153cfebaf99900e0b860f7b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f80d4c8bcb2f5a08015100048b3ae54c0d7999bd"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba7e4b86361af31b153cfebaf99900e0b860f7b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f80d4c8bcb2f5a08015100048b3ae54c0d7999bd"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba7e4b86361af31b153cfebaf99900e0b860f7b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f80d4c8bcb2f5a08015100048b3ae54c0d7999bd"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
<!-- Stock Android things -->
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cba7e4b86361af31b153cfebaf99900e0b860f7b"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cb4604d5a578efd027277059ce3e0f6e3af59bd1"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba7e4b86361af31b153cfebaf99900e0b860f7b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
@ -24,7 +24,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f80d4c8bcb2f5a08015100048b3ae54c0d7999bd"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "cba7e4b86361af31b153cfebaf99900e0b860f7b",
"git_revision": "ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "d02e42f3a17e4c37ff6c2b56e792e7d762732676",
"revision": "38edf6a5a770747986828cae0e7316b90794dc19",
"repo_path": "integration/gaia-central"
}

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba7e4b86361af31b153cfebaf99900e0b860f7b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
@ -24,7 +24,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f80d4c8bcb2f5a08015100048b3ae54c0d7999bd"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>

View File

@ -18,10 +18,10 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba7e4b86361af31b153cfebaf99900e0b860f7b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f80d4c8bcb2f5a08015100048b3ae54c0d7999bd"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba7e4b86361af31b153cfebaf99900e0b860f7b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
@ -24,7 +24,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f80d4c8bcb2f5a08015100048b3ae54c0d7999bd"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
<!-- Stock Android things -->
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>

View File

@ -486,10 +486,6 @@ pref("dom.disable_window_move_resize", false);
// prevent JS from monkeying with window focus, etc
pref("dom.disable_window_flip", true);
// Disable touch events on Desktop Firefox by default until they are properly
// supported (bug 736048)
pref("dom.w3c_touch_events.enabled", 0);
// popups.policy 1=allow,2=reject
pref("privacy.popups.policy", 1);
pref("privacy.popups.usecustom", true);

View File

@ -6144,12 +6144,6 @@ var BrowserOffline = {
{
var ioService = Services.io;
// Stop automatic management of the offline status
try {
ioService.manageOfflineStatus = false;
} catch (ex) {
}
if (!ioService.offline && !this._canGoOffline()) {
this._updateOfflineUI(false);
return;
@ -6165,7 +6159,9 @@ var BrowserOffline = {
if (aTopic != "network:offline-status-changed")
return;
this._updateOfflineUI(aState == "offline");
// This notification is also received because of a loss in connectivity,
// which we ignore by updating the UI to the current value of io.offline
this._updateOfflineUI(Services.io.offline);
},
/////////////////////////////////////////////////////////////////////////////

View File

@ -20,7 +20,7 @@ if test -n "$MOZ_NATIVE_ICU"; then
PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
MOZ_SHARED_ICU=1
else
MOZ_ICU_CFLAGS='-I$(topsrcdir)/intl/icu/source/common -I$(topsrcdir)/intl/icu/source/i18n'
MOZ_ICU_CFLAGS="-I$_topsrcdir/intl/icu/source/common -I$_topsrcdir/intl/icu/source/i18n"
AC_SUBST_LIST(MOZ_ICU_CFLAGS)
fi

View File

@ -156,6 +156,7 @@ bool isInIgnoredNamespaceForImplicitCtor(const Decl *decl) {
name == "__gnu_cxx" || // gnu C++ lib
name == "boost" || // boost
name == "webrtc" || // upstream webrtc
name == "rtc" || // upstream webrtc 'base' package
name.substr(0, 4) == "icu_" || // icu
name == "google" || // protobuf
name == "google_breakpad" || // breakpad

View File

@ -160,11 +160,11 @@ def GeckoFramework(name, **kwargs):
@template
def XPCOMBinaryComponent(name, **kwargs):
def XPCOMBinaryComponent(name):
'''Template defining an XPCOM binary component for Gecko.
`name` is the name of the component.
'''
GeckoSharedLibrary(name, **kwargs)
GeckoSharedLibrary(name)
IS_COMPONENT = True

View File

@ -5,6 +5,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
gyp_vars = {
'lsan': 0,
'asan': 0,
'build_with_mozilla': 1,
'build_with_chromium': 0,
'use_official_google_api_keys': 0,
@ -27,14 +29,14 @@ gyp_vars = {
'build_libyuv': 0,
'build_libvpx': 0,
'build_ssl': 0,
'build_json': 0,
'build_icu': 0,
'build_opus': 0,
'libyuv_dir': '/media/libyuv',
'yuv_disable_avx2': 0 if CONFIG['HAVE_X86_AVX2'] else 1,
# don't use openssl
'use_openssl': 0,
# saves 4MB when webrtc_trace is off
'enable_lazy_trace_alloc': 1 if CONFIG['RELEASE_BUILD'] else 0,
'use_x11': 1 if CONFIG['MOZ_X11'] else 0,
'use_glib': 1 if CONFIG['GLIB_LIBS'] else 0,
@ -63,7 +65,9 @@ gyp_vars = {
'include_opus': 1,
'include_g722': 1,
'include_ilbc': 0,
'include_isac': 0,
# We turn on ISAC because the AGC uses parts of it, and depend on the
# linker to throw away uneeded bits.
'include_isac': 1,
'include_pcm16b': 1,
}

View File

@ -357,11 +357,10 @@ class B2GRemoteAutomation(Automation):
if (!testUtils.hasOwnProperty("specialPowersObserver")) {
let loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.js",
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.jsm",
testUtils);
testUtils.specialPowersObserver = new testUtils.SpecialPowersObserver();
testUtils.specialPowersObserver.init();
testUtils.specialPowersObserver._loadFrameScript();
}
""")

View File

@ -92,7 +92,7 @@ _PTHREAD_LDFLAGS=""
dnl Do not allow objdir == srcdir builds.
dnl ==============================================================
_topsrcdir=`cd \`dirname $0\`; pwd`
_topsrcdir=`cd \`dirname $0\`; pwd -W 2>/dev/null || pwd`
_objdir=`pwd`
dnl TODO Don't exempt L10N builds once bug 842760 is resolved.
@ -4152,7 +4152,6 @@ cairo-gtk3)
MOZ_X11=1
USE_FC_FREETYPE=1
TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
MOZ_WIDGET_GTK=3
AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
MOZ_PDF_PRINTING=1
@ -4170,8 +4169,6 @@ cairo-gtk2|cairo-gtk2-x11)
MOZ_X11=1
USE_FC_FREETYPE=1
TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
TK_LIBS='$(MOZ_GTK2_LIBS)'
AC_DEFINE(MOZ_WIDGET_GTK2)
MOZ_WIDGET_GTK=2
AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
@ -4191,8 +4188,6 @@ cairo-qt)
fi
USE_FC_FREETYPE=1
TK_CFLAGS='$(MOZ_QT_CFLAGS)'
TK_LIBS='$(MOZ_QT_LIBS)'
AC_DEFINE(MOZ_WIDGET_QT)
MOZ_PDF_PRINTING=1
AC_DEFINE(QT_NO_KEYWORDS)
@ -4228,8 +4223,6 @@ cairo-uikit)
cairo-android)
AC_DEFINE(MOZ_WIDGET_ANDROID)
MOZ_WIDGET_TOOLKIT=android
TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
MOZ_PDF_PRINTING=1
MOZ_INSTRUMENT_EVENT_LOOP=1
;;
@ -4238,8 +4231,6 @@ cairo-gonk)
AC_DEFINE(MOZ_WIDGET_GONK)
AC_DEFINE(MOZ_TOUCH)
MOZ_WIDGET_TOOLKIT=gonk
TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
MOZ_PDF_PRINTING=1
MOZ_TOUCH=1
MOZ_INSTRUMENT_EVENT_LOOP=1
@ -4265,9 +4256,7 @@ if test "$COMPILE_ENVIRONMENT"; then
if test "$MOZ_ENABLE_GTK3"; then
PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
dnl Contrary to MOZ_GTK2_LIBS, MOZ_GTK3_LIBS needs to be literally added to TK_LIBS instead
dnl of a make reference because of how TK_LIBS is mangled in toolkit/library/moz.build
dnl for GTK+3 builds.
TK_CFLAGS=$MOZ_GTK3_CFLAGS
TK_LIBS=$MOZ_GTK3_LIBS
AC_DEFINE_UNQUOTED(GDK_VERSION_MIN_REQUIRED,$GDK_VERSION_MIN_REQUIRED)
AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MIN_REQUIRED)
@ -4286,7 +4275,10 @@ if test "$COMPILE_ENVIRONMENT"; then
PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 $GDK_PACKAGES)
MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
fi
if test "$MOZ_ENABLE_GTK2"; then
TK_CFLAGS=$MOZ_GTK3_CFLAGS
TK_LIBS=$MOZ_GTK3_LIBS
fi
fi # COMPILE_ENVIRONMENT
AC_SUBST(MOZ_FS_LAYOUT)
@ -4512,6 +4504,8 @@ then
AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
AC_SUBST(MOZ_ENABLE_CONTENTACTION)
fi
TK_CFLAGS=$MOZ_QT_CFLAGS
TK_LIBS=$MOZ_QT_LIBS
fi
AC_SUBST(GTK_CONFIG)
@ -6331,8 +6325,8 @@ if test -n "$MOZ_TREE_FREETYPE"; then
AC_SUBST(MOZ_TREE_FREETYPE)
MOZ_ENABLE_CAIRO_FT=1
FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
FT2_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
CAIRO_FT_OSLIBS=''
AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
@ -8287,6 +8281,13 @@ else
fi
fi
case "$MOZ_WIDGET_TOOLKIT" in
android|gonk)
TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
;;
esac
AC_SUBST(MOZ_TREE_CAIRO)
AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
AC_SUBST_LIST(MOZ_CAIRO_LIBS)

View File

@ -12,3 +12,4 @@ support-files =
[browser_fontinspector_edit-previews.js]
[browser_fontinspector_edit-previews-show-all.js]
[browser_fontinspector_theme-change.js]
skip-if = e10s && debug && os == 'win'

View File

@ -28,6 +28,7 @@ support-files =
[browser_target_remote.js]
[browser_target_support.js]
[browser_two_tabs.js]
skip-if = e10s && debug && os == 'win'
[browser_toolbox_dynamic_registration.js]
[browser_toolbox_getpanelwhenready.js]
[browser_toolbox_highlight.js]

View File

@ -78,6 +78,7 @@ skip-if = e10s # GCLI isn't e10s compatible. See bug 1128988.
[browser_inspector_iframe-navigation.js]
[browser_inspector_infobar_01.js]
[browser_inspector_initialization.js]
skip-if = e10s && debug && os == 'win'
[browser_inspector_inspect-object-element.js]
[browser_inspector_invalidate.js]
[browser_inspector_keyboard-shortcuts-copy-outerhtml.js]

View File

@ -45,6 +45,7 @@ skip-if = e10s # scratchpad.xul is not loading in e10s window
[browser_markupview_copy_image_data.js]
[browser_markupview_css_completion_style_attribute.js]
[browser_markupview_dragdrop_autoscroll.js]
skip-if = e10s && os == 'win'
[browser_markupview_dragdrop_distance.js]
[browser_markupview_dragdrop_dragRootNode.js]
[browser_markupview_dragdrop_escapeKeyPress.js]

View File

@ -55,7 +55,7 @@ skip-if = true # Bug 1161817
[browser_perf-loading-01.js]
[browser_perf-loading-02.js]
[browser_perf-marker-details-01.js]
skip-if = os == 'linux' # Bug 1172120
skip-if = e10s || os == 'linux' # Bug 1172120
[browser_perf-markers-docload.js]
[browser_perf-options-01.js]
[browser_perf-options-02.js]

View File

@ -11,6 +11,7 @@ skip-if = e10s # Bug ??????
[browser_responsiveruleview.js]
skip-if = e10s # Bug ??????
[browser_responsiveui.js]
skip-if = e10s && os == 'win'
[browser_responsiveui_touch.js]
[browser_responsiveuiaddcustompreset.js]
[browser_responsive_devicewidth.js]

View File

@ -34,14 +34,26 @@ skip-if = true # Bug 942473, caused by Bug 940541
[browser_webgl-actor-test-05.js]
[browser_webgl-actor-test-06.js]
[browser_webgl-actor-test-07.js]
skip-if = e10s && os == 'win'
[browser_webgl-actor-test-08.js]
skip-if = e10s && os == 'win'
[browser_webgl-actor-test-09.js]
skip-if = e10s && os == 'win'
[browser_webgl-actor-test-10.js]
skip-if = e10s && os == 'win'
[browser_webgl-actor-test-11.js]
skip-if = e10s && os == 'win'
[browser_webgl-actor-test-12.js]
skip-if = e10s && os == 'win'
[browser_webgl-actor-test-13.js]
skip-if = e10s && os == 'win'
[browser_webgl-actor-test-14.js]
skip-if = e10s && os == 'win'
[browser_webgl-actor-test-15.js]
skip-if = e10s && os == 'win'
[browser_webgl-actor-test-16.js]
skip-if = e10s && os == 'win'
[browser_webgl-actor-test-17.js]
skip-if = e10s && os == 'win'
[browser_webgl-actor-test-18.js]
skip-if = e10s && os == 'win'

View File

@ -140,6 +140,7 @@ support-files =
test_bug1092055_shouldwarn.html
[browser_bug1045902_console_csp_ignore_reflected_xss_message.js]
skip-if = e10s && debug
[browser_bug664688_sandbox_update_after_navigation.js]
skip-if = e10s # Bug 1042253 - webconsole e10s tests (intermittent Linux debug)
[browser_bug_638949_copy_link_location.js]
@ -287,6 +288,7 @@ skip-if = true # Bug 1110500 - mouse event failure in test
skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
[browser_webconsole_bug_766001_JS_Console_in_Debugger.js]
[browser_webconsole_bug_770099_violation.js]
skip-if = e10s && os == 'win'
[browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js]
skip-if = buildapp == 'mulet'
[browser_webconsole_bug_804845_ctrl_key_nav.js]
@ -299,9 +301,11 @@ skip-if = buildapp == 'mulet'
[browser_webconsole_bug_1006027_message_timestamps_incorrect.js]
skip-if = e10s # Bug 1042253 - webconsole e10s tests (Linux debug intermittent)
[browser_webconsole_bug_1010953_cspro.js]
skip-if = e10s && os == 'win'
[browser_webconsole_certificate_messages.js]
skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
[browser_webconsole_show_subresource_security_errors.js]
skip-if = e10s && os == 'win'
[browser_webconsole_cached_autocomplete.js]
[browser_webconsole_change_font_size.js]
[browser_webconsole_chrome.js]

View File

@ -0,0 +1,30 @@
/* -*- 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 "mozilla/devtools/DominatorTree.h"
#include "mozilla/dom/DominatorTreeBinding.h"
namespace mozilla {
namespace devtools {
/*** Cycle Collection Boilerplate *****************************************************************/
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DominatorTree, mParent)
NS_IMPL_CYCLE_COLLECTING_ADDREF(DominatorTree)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DominatorTree)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DominatorTree)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
/* virtual */ JSObject*
DominatorTree::WrapObject(JSContext* aCx, JS::HandleObject aGivenProto)
{
return dom::DominatorTreeBinding::Wrap(aCx, this, aGivenProto);
}
} // namespace devtools
} // namespace mozilla

View File

@ -0,0 +1,50 @@
/* -*- 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_devtools_DominatorTree__
#define mozilla_devtools_DominatorTree__
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/RefCounted.h"
#include "js/UbiNodeDominatorTree.h"
#include "nsWrapperCache.h"
namespace mozilla {
namespace devtools {
class DominatorTree final : public nsISupports
, public nsWrapperCache
{
protected:
nsCOMPtr<nsISupports> mParent;
virtual ~DominatorTree() { }
private:
JS::ubi::DominatorTree mDominatorTree;
public:
explicit DominatorTree(JS::ubi::DominatorTree&& aDominatorTree, nsISupports* aParent)
: mParent(aParent)
, mDominatorTree(Move(aDominatorTree))
{
MOZ_ASSERT(aParent);
};
NS_DECL_CYCLE_COLLECTING_ISUPPORTS;
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DominatorTree);
nsISupports* GetParentObject() const { return mParent; }
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
};
} // namespace devtools
} // namespace mozilla
#endif // mozilla_devtools_DominatorTree__

View File

@ -52,6 +52,8 @@ using ::google::protobuf::io::ZeroCopyInputStream;
using JS::ubi::AtomOrTwoByteChars;
/*** Cycle Collection Boilerplate *****************************************************************/
NS_IMPL_CYCLE_COLLECTION_CLASS(HeapSnapshot)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(HeapSnapshot)
@ -381,6 +383,9 @@ HeapSnapshot::saveStackFrame(const protobuf::StackFrame& frame,
return true;
}
#undef GET_STRING_OR_REF_WITH_PROP_NAMES
#undef GET_STRING_OR_REF
static inline bool
StreamHasData(GzipInputStream& stream)
{
@ -515,8 +520,26 @@ HeapSnapshot::TakeCensus(JSContext* cx, JS::HandleObject options,
}
}
#undef GET_STRING_OR_REF_WITH_PROP_NAMES
#undef GET_STRING_OR_REF
already_AddRefed<DominatorTree>
HeapSnapshot::ComputeDominatorTree(ErrorResult& rv)
{
Maybe<JS::ubi::DominatorTree> maybeTree;
{
auto ccrt = CycleCollectedJSRuntime::Get();
MOZ_ASSERT(ccrt);
auto rt = ccrt->Runtime();
MOZ_ASSERT(rt);
JS::AutoCheckCannotGC nogc(rt);
maybeTree = JS::ubi::DominatorTree::Create(rt, nogc, getRoot());
}
if (maybeTree.isNothing()) {
rv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
return MakeAndAddRef<DominatorTree>(Move(*maybeTree), mParent);
}
/*** Saving Heap Snapshots ************************************************************************/

View File

@ -9,6 +9,7 @@
#include "js/HashTable.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/devtools/DeserializedNode.h"
#include "mozilla/devtools/DominatorTree.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/HashFunctions.h"
@ -150,6 +151,8 @@ public:
void TakeCensus(JSContext* cx, JS::HandleObject options,
JS::MutableHandleValue rval, ErrorResult& rv);
already_AddRefed<DominatorTree> ComputeDominatorTree(ErrorResult& rv);
dom::Nullable<uint64_t> GetCreationTime() {
static const uint64_t maxTime = uint64_t(1) << 53;
if (timestamp.isSome() && timestamp.ref() <= maxTime) {

View File

@ -15,6 +15,7 @@ EXPORTS.mozilla.devtools += [
'AutoMemMap.h',
'CoreDump.pb.h',
'DeserializedNode.h',
'DominatorTree.h',
'FileDescriptorOutputStream.h',
'HeapSnapshot.h',
'HeapSnapshotTempFileHelperChild.h',
@ -32,6 +33,7 @@ SOURCES += [
'AutoMemMap.cpp',
'CoreDump.pb.cc',
'DeserializedNode.cpp',
'DominatorTree.cpp',
'FileDescriptorOutputStream.cpp',
'HeapSnapshot.cpp',
'HeapSnapshotTempFileHelperParent.cpp',

View File

@ -3,5 +3,6 @@ tags = devtools devtools-memory
skip-if = buildapp == 'b2g' || os == 'android'
support-files =
[test_DominatorTree_01.html]
[test_SaveHeapSnapshot.html]

View File

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<!--
Sanity test that we can compute dominator trees from a heap snapshot in a web window.
-->
<head>
<meta charset="utf-8">
<title>ChromeUtils.saveHeapSnapshot test</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>
<pre id="test">
<script>
SimpleTest.waitForExplicitFinish();
window.onload = function() {
const path = ChromeUtils.saveHeapSnapshot({ runtime: true });
const snapshot = ChromeUtils.readHeapSnapshot(path);
const dominatorTree = snapshot.computeDominatorTree();
ok(dominatorTree);
ok(dominatorTree instanceof DominatorTree);
let threw = false;
try {
new DominatorTree();
} catch (e) {
threw = true;
}
ok(threw, "Constructor shouldn't be usable");
SimpleTest.finish();
};
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,47 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
console.log("Initializing worker.");
self.onmessage = e => {
console.log("Starting test.");
try {
const path = ThreadSafeChromeUtils.saveHeapSnapshot({ runtime: true });
const snapshot = ThreadSafeChromeUtils.readHeapSnapshot(path);
const dominatorTree = snapshot.computeDominatorTree();
ok(dominatorTree);
ok(dominatorTree instanceof DominatorTree);
let threw = false;
try {
new DominatorTree();
} catch (e) {
threw = true;
}
ok(threw, "Constructor shouldn't be usable");
} catch (e) {
ok(false, "Unexpected error inside worker:\n" + e.toString() + "\n" + e.stack);
} finally {
done();
}
};
// Proxy assertions to the main thread.
function ok(val, msg) {
console.log("ok(" + !!val + ", \"" + msg + "\")");
self.postMessage({
type: "assertion",
passed: !!val,
msg,
stack: Error().stack
});
}
// Tell the main thread we are done with the tests.
function done() {
console.log("done()");
self.postMessage({
type: "done"
});
}

View File

@ -0,0 +1,23 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Sanity test that we can compute dominator trees.
function run_test() {
const path = ChromeUtils.saveHeapSnapshot({ runtime: true });
const snapshot = ChromeUtils.readHeapSnapshot(path);
const dominatorTree = snapshot.computeDominatorTree();
ok(dominatorTree);
ok(dominatorTree instanceof DominatorTree);
let threw = false;
try {
new DominatorTree();
} catch (e) {
threw = true;
}
ok(threw, "Constructor shouldn't be usable");
do_test_finished();
}

View File

@ -0,0 +1,40 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test that we can compute dominator trees from a snapshot in a worker.
add_task(function* () {
const worker = new ChromeWorker("resource://test/dominator-tree-worker.js");
worker.postMessage({});
let assertionCount = 0;
worker.onmessage = e => {
if (e.data.type !== "assertion") {
return;
}
ok(e.data.passed, e.data.msg + "\n" + e.data.stack);
assertionCount++;
};
yield waitForDone(worker);
ok(assertionCount > 0);
worker.terminate();
});
function waitForDone(w) {
return new Promise((resolve, reject) => {
w.onerror = e => {
reject();
ok(false, "Error in worker: " + e);
};
w.addEventListener("message", function listener(e) {
if (e.data.type === "done") {
w.removeEventListener("message", listener, false);
resolve();
}
}, false);
});
}

View File

@ -7,6 +7,7 @@ skip-if = toolkit == 'android' || toolkit == 'gonk'
support-files =
Census.jsm
dominator-tree-worker.js
heap-snapshot-worker.js
Match.jsm
@ -27,6 +28,8 @@ support-files =
[test_census-tree-node-06.js]
[test_census-tree-node-07.js]
[test_census-tree-node-08.js]
[test_DominatorTree_01.js]
[test_DominatorTree_02.js]
[test_HeapAnalyses_getCreationTime_01.js]
[test_HeapAnalyses_readHeapSnapshot_01.js]
[test_HeapAnalyses_takeCensusDiff_01.js]

View File

@ -509,7 +509,6 @@ nsNodeSupportsWeakRefTearoff::GetWeakReference(nsIWeakReference** aInstancePtr)
nsINode::nsSlots* slots = mNode->Slots();
if (!slots->mWeakReference) {
slots->mWeakReference = new nsNodeWeakReference(mNode);
NS_ENSURE_TRUE(slots->mWeakReference, NS_ERROR_OUT_OF_MEMORY);
}
NS_ADDREF(*aInstancePtr = slots->mWeakReference);

View File

@ -167,10 +167,7 @@ nsresult
nsAttrValue::Init()
{
NS_ASSERTION(!sEnumTableArray, "nsAttrValue already initialized");
sEnumTableArray = new nsTArray<const EnumTable*>;
NS_ENSURE_TRUE(sEnumTableArray, NS_ERROR_OUT_OF_MEMORY);
return NS_OK;
}
@ -1850,14 +1847,8 @@ nsAttrValue::EnsureEmptyAtomArray()
return true;
}
AtomArray* array = new AtomArray;
if (!array) {
Reset();
return false;
}
MiscContainer* cont = EnsureEmptyMiscContainer();
cont->mValue.mAtomArray = array;
cont->mValue.mAtomArray = new AtomArray;
cont->mType = eAtomArray;
return true;

View File

@ -56,7 +56,6 @@ nsCCUncollectableMarker::Init()
}
nsCOMPtr<nsIObserver> marker = new nsCCUncollectableMarker;
NS_ENSURE_TRUE(marker, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIObserverService> obs =
mozilla::services::GetObserverService();

View File

@ -151,7 +151,6 @@ bool
ContentPermissionRequestParent::Recvprompt()
{
mProxy = new nsContentPermissionRequestProxy();
NS_ASSERTION(mProxy, "Alloc of request proxy failed");
if (NS_FAILED(mProxy->Init(mRequests, this))) {
mProxy->Cancel();
}

View File

@ -36,8 +36,6 @@ nsresult
NS_NewContentPolicy(nsIContentPolicy **aResult)
{
*aResult = new nsContentPolicy;
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}

View File

@ -1411,7 +1411,6 @@ nsDOMConstructor::Create(const char16_t* aName,
IsConstructable(aData);
*aResult = new nsDOMConstructor(aName, constructable, currentInner);
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(*aResult);
return NS_OK;
}

View File

@ -1898,7 +1898,6 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
NS_ENSURE_SUCCESS(rv, rv);
nsQueryContentEventResult* result = new nsQueryContentEventResult();
NS_ENSURE_TRUE(result, NS_ERROR_OUT_OF_MEMORY);
result->SetEventResult(widget, queryEvent);
NS_ADDREF(*aResult = result);
return NS_OK;

View File

@ -314,8 +314,6 @@ nsIdentifierMapEntry::AddContentChangeCallback(nsIDocument::IDTargetObserver aCa
{
if (!mChangeCallbacks) {
mChangeCallbacks = new nsTHashtable<ChangeCallbackEntry>;
if (!mChangeCallbacks)
return;
}
ChangeCallback cc = { aCallback, aData, aForImage };
@ -1247,9 +1245,6 @@ IMPL_SHIM(nsIApplicationCacheContainer)
return NS_NOINTERFACE; \
} \
nsCOMPtr<_i> shim = new _i##Shim(this, real); \
if (!shim) { \
return NS_ERROR_OUT_OF_MEMORY; \
} \
shim.forget(aSink); \
return NS_OK; \
} \
@ -10034,8 +10029,6 @@ nsIDocument::RegisterActivityObserver(nsISupports* aSupports)
{
if (!mActivityObservers) {
mActivityObservers = new nsTHashtable<nsPtrHashKey<nsISupports> >();
if (!mActivityObservers)
return;
}
mActivityObservers->PutEntry(aSupports);
}

View File

@ -1307,8 +1307,6 @@ nsresult
NS_NewTextEncoder(nsIDocumentEncoder** aResult)
{
*aResult = new nsDocumentEncoder;
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}
@ -2054,8 +2052,6 @@ nsresult
NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult)
{
*aResult = new nsHTMLCopyEncoder;
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}

View File

@ -190,7 +190,6 @@ nsresult
nsFocusManager::Init()
{
nsFocusManager* fm = new nsFocusManager();
NS_ENSURE_TRUE(fm, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(fm);
sInstance = fm;

View File

@ -76,8 +76,6 @@ NS_NewGenConImageContent(nsIContent** aResult, already_AddRefed<mozilla::dom::No
{
NS_PRECONDITION(aImageRequest, "Must have request!");
nsGenConImageContent *it = new nsGenConImageContent(aNodeInfo);
if (!it)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult = it);
nsresult rv = it->Init(aImageRequest);
if (NS_FAILED(rv))

View File

@ -343,7 +343,6 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount,
// Allocate new buffer
int32_t newLength = textLength - aCount + aLength;
char16_t* to = new char16_t[newLength];
NS_ENSURE_TRUE(to, NS_ERROR_OUT_OF_MEMORY);
// Copy over appropriate data
if (aOffset) {

View File

@ -988,7 +988,6 @@ nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd = new _cmdClass(); \
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd)); \
}
@ -996,7 +995,6 @@ nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd = new _cmdClass(); \
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));

View File

@ -385,10 +385,6 @@ nsImageLoadingContent::AddObserver(imgINotificationObserver* aObserver)
}
observer->mNext = new ImageObserver(aObserver);
if (! observer->mNext) {
return NS_ERROR_OUT_OF_MEMORY;
}
ReplayImageStatus(mCurrentRequest, aObserver);
ReplayImageStatus(mPendingRequest, aObserver);

View File

@ -189,7 +189,7 @@ nsresult nsNameSpaceManager::AddNameSpace(const nsAString& aURI,
"BAD! AddNameSpace not called in right order!");
nsString* uri = new nsString(aURI);
if (!uri || !mURIArray.AppendElement(uri)) {
if (!mURIArray.AppendElement(uri)) {
delete uri;
return NS_ERROR_OUT_OF_MEMORY;
}

View File

@ -2936,9 +2936,6 @@ nsObjectLoadingContent::AsyncStartPluginInstance()
}
nsCOMPtr<nsIRunnable> event = new nsAsyncInstantiateEvent(this);
if (!event) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = NS_DispatchToCurrentThread(event);
if (NS_SUCCEEDED(rv)) {
// Track pending events

View File

@ -480,8 +480,6 @@ nsScriptNameSpaceManager::RegisterDOMCIData(const char *aName,
"Someone tries to register classinfo data for a class that isn't new or external!");
s->mData = new nsExternalDOMClassInfoData;
NS_ENSURE_TRUE(s->mData, NS_ERROR_OUT_OF_MEMORY);
s->mType = nsGlobalNameStruct::eTypeExternalClassInfo;
s->mData->mName = aName;
s->mData->mNameUTF16 = className;

View File

@ -42,8 +42,6 @@ nsTextFragment::Init()
for (i = 0; i <= TEXTFRAG_MAX_NEWLINES; ++i) {
sSpaceSharedString[i] = new char[1 + i + TEXTFRAG_WHITE_AFTER_NEWLINE];
sTabSharedString[i] = new char[1 + i + TEXTFRAG_WHITE_AFTER_NEWLINE];
NS_ENSURE_TRUE(sSpaceSharedString[i] && sTabSharedString[i],
NS_ERROR_OUT_OF_MEMORY);
sSpaceSharedString[i][0] = ' ';
sTabSharedString[i][0] = ' ';
uint32_t j;

View File

@ -214,10 +214,6 @@ NS_NewAttributeContent(nsNodeInfoManager *aNodeInfoManager,
nsAttributeTextNode* textNode = new nsAttributeTextNode(ni,
aNameSpaceID,
aAttrName);
if (!textNode) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*aResult = textNode);
return NS_OK;

View File

@ -466,6 +466,38 @@ ErrorResult::operator=(ErrorResult&& aRHS)
return *this;
}
void
ErrorResult::CloneTo(ErrorResult& aRv) const
{
aRv.ClearUnionData();
aRv.mResult = mResult;
#ifdef DEBUG
aRv.mMightHaveUnreportedJSException = mMightHaveUnreportedJSException;
#endif
if (IsErrorWithMessage()) {
#ifdef DEBUG
aRv.mUnionState = HasMessage;
#endif
aRv.mMessage = new Message();
aRv.mMessage->mArgs = mMessage->mArgs;
aRv.mMessage->mErrorNumber = mMessage->mErrorNumber;
} else if (IsDOMException()) {
#ifdef DEBUG
aRv.mUnionState = HasDOMExceptionInfo;
#endif
aRv.mDOMExceptionInfo = new DOMExceptionInfo(mDOMExceptionInfo->mRv,
mDOMExceptionInfo->mMessage);
} else if (IsJSException()) {
#ifdef DEBUG
aRv.mUnionState = HasJSException;
#endif
JSContext* cx = nsContentUtils::RootingCxForThread();
JS::Rooted<JS::Value> exception(cx, mJSException);
aRv.ThrowJSException(cx, exception);
}
}
void
ErrorResult::SuppressException()
{

View File

@ -3285,6 +3285,13 @@ GetErrorPrototype(JSContext* aCx, JS::Handle<JSObject*> aForObj)
return JS_GetErrorPrototype(aCx);
}
inline
JSObject*
GetIteratorPrototype(JSContext* aCx, JS::Handle<JSObject*> aForObj)
{
return JS_GetIteratorPrototype(aCx);
}
// Resolve an id on the given global object that wants to be included in
// Exposed=System webidl annotations. False return value means exception
// thrown.

View File

@ -409,6 +409,10 @@ DOMInterfaces = {
}
},
'DominatorTree': {
'nativeType': 'mozilla::devtools::DominatorTree'
},
'DOMException': {
'binaryNames': {
'message': 'messageMoz',

View File

@ -580,6 +580,8 @@ def InterfacePrototypeObjectProtoGetter(descriptor):
protoGetter = "JS_GetArrayPrototype"
elif descriptor.interface.getExtendedAttribute("ExceptionClass"):
protoGetter = "GetErrorPrototype"
elif descriptor.interface.isIteratorInterface():
protoGetter = "GetIteratorPrototype"
else:
protoGetter = "JS_GetObjectPrototype"
protoHandleGetter = None
@ -2259,6 +2261,22 @@ class MethodDefiner(PropertyDefiner):
"condition": MemberCondition(None, None)
})
# Output an @@iterator for generated iterator interfaces. This should
# not be necessary, but
# https://bugzilla.mozilla.org/show_bug.cgi?id=1091945 means that
# %IteratorPrototype%[@@iterator] is a broken puppy.
if (not static and
not unforgeable and
descriptor.interface.isIteratorInterface()):
self.regular.append({
"name": "@@iterator",
"methodInfo": False,
"selfHostedName": "IteratorIdentity",
"length": 0,
"flags": "0",
"condition": MemberCondition(None, None)
})
# Generate the maplike/setlike iterator, if one wasn't already
# generated by a method. If we already have an @@iterator symbol, fail.
if descriptor.interface.maplikeOrSetlikeOrIterable:

View File

@ -115,6 +115,11 @@ public:
AssignErrorCode(rv);
}
// Duplicate our current state on the given ErrorResult object. Any existing
// errors or messages on the target will be suppressed before cloning. Our
// own error state remains unchanged.
void CloneTo(ErrorResult& aRv) const;
// Use SuppressException when you want to suppress any exception that might be
// on the ErrorResult. After this call, the ErrorResult will be back a "no
// exception thrown" state.

View File

@ -50,6 +50,9 @@
info("IterableSingle: Testing simple iterable creation and functionality");
itr = new TestInterfaceIterableSingle();
testExistence("IterableSingle: ", itr, base_properties);
var keys = [...itr.keys()];
var values = [...itr.values()];
var entries = [...itr.entries()];
var key_itr = itr.keys();
var value_itr = itr.values();
var entries_itr = itr.entries();
@ -58,9 +61,17 @@
var value = value_itr.next();
var entry = entries_itr.next();
is(key.value, i, "IterableSingle: Key iterator value should be " + i);
is(key.value, keys[i],
"IterableSingle: Key iterator value should match destructuring " + i);
is(value.value, key.value, "IterableSingle: Value iterator value should be " + key.value);
is(value.value, values[i],
"IterableSingle: Value iterator value should match destructuring " + i);
is(entry.value[0], i, "IterableSingle: Entry iterator value 0 should be " + i);
is(entry.value[1], i, "IterableSingle: Entry iterator value 1 should be " + i);
is(entry.value[0], entries[i][0],
"IterableSingle: Entry iterator value 0 should match destructuring " + i);
is(entry.value[1], entries[i][1],
"IterableSingle: Entry iterator value 1 should match destructuring " + i);
}
var key = key_itr.next();
var value = value_itr.next();
@ -80,6 +91,9 @@
itr = new TestInterfaceIterableDouble();
testExistence("IterableDouble: ", itr, base_properties);
var elements = [["a", "b"], ["c", "d"], ["e", "f"]]
var keys = [...itr.keys()];
var values = [...itr.values()];
var entries = [...itr.entries()];
var key_itr = itr.keys();
var value_itr = itr.values();
var entries_itr = itr.entries();
@ -88,9 +102,17 @@
var value = value_itr.next();
var entry = entries_itr.next();
is(key.value, elements[i][0], "IterableDouble: Key iterator value should be " + elements[i][0]);
is(key.value, keys[i],
"IterableDouble: Key iterator value should match destructuring " + i);
is(value.value, elements[i][1], "IterableDouble: Value iterator value should be " + elements[i][1]);
is(value.value, values[i],
"IterableDouble: Value iterator value should match destructuring " + i);
is(entry.value[0], elements[i][0], "IterableDouble: Entry iterator value 0 should be " + elements[i][0]);
is(entry.value[1], elements[i][1], "IterableDouble: Entry iterator value 1 should be " + elements[i][1]);
is(entry.value[0], entries[i][0],
"IterableDouble: Entry iterator value 0 should match destructuring " + i);
is(entry.value[1], entries[i][1],
"IterableDouble: Entry iterator value 1 should match destructuring " + i);
}
var key = key_itr.next();
var value = value_itr.next();

View File

@ -53,7 +53,7 @@ if (!('BrowserElementIsPreloaded' in this)) {
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js");
}
if (Services.prefs.getIntPref("dom.w3c_touch_events.enabled") == 1) {
if (Services.prefs.getIntPref("dom.w3c_touch_events.enabled") != 0) {
if (docShell.asyncPanZoomEnabled === false) {
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanningAPZDisabled.js");
ContentPanningAPZDisabled.init();

View File

@ -52,8 +52,8 @@ DeviceStorageRequestParent::Dispatch()
blobImpl->GetInternalStream(getter_AddRefs(stream), rv);
MOZ_ASSERT(!rv.Failed());
RefPtr<CancelableRunnable> r = new WriteFileEvent(this, dsf, stream,
DEVICE_STORAGE_REQUEST_CREATE);
RefPtr<CancelableRunnable> r = new WriteFileEvent(this, dsf.forget(), stream,
DEVICE_STORAGE_REQUEST_CREATE);
nsCOMPtr<nsIEventTarget> target
= do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
@ -77,8 +77,8 @@ DeviceStorageRequestParent::Dispatch()
blobImpl->GetInternalStream(getter_AddRefs(stream), rv);
MOZ_ASSERT(!rv.Failed());
RefPtr<CancelableRunnable> r = new WriteFileEvent(this, dsf, stream,
DEVICE_STORAGE_REQUEST_APPEND);
RefPtr<CancelableRunnable> r = new WriteFileEvent(this, dsf.forget(), stream,
DEVICE_STORAGE_REQUEST_APPEND);
nsCOMPtr<nsIEventTarget> target
= do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
@ -94,7 +94,7 @@ DeviceStorageRequestParent::Dispatch()
RefPtr<DeviceStorageFile> dsf =
new DeviceStorageFile(p.type(), p.storageName(), p.relpath());
RefPtr<CancelableRunnable> r = new CreateFdEvent(this, dsf);
RefPtr<CancelableRunnable> r = new CreateFdEvent(this, dsf.forget());
nsCOMPtr<nsIEventTarget> target
= do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
@ -109,7 +109,7 @@ DeviceStorageRequestParent::Dispatch()
RefPtr<DeviceStorageFile> dsf =
new DeviceStorageFile(p.type(), p.storageName(),
p.rootDir(), p.relpath());
RefPtr<CancelableRunnable> r = new ReadFileEvent(this, dsf);
RefPtr<CancelableRunnable> r = new ReadFileEvent(this, dsf.forget());
nsCOMPtr<nsIEventTarget> target
= do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
@ -124,7 +124,7 @@ DeviceStorageRequestParent::Dispatch()
RefPtr<DeviceStorageFile> dsf =
new DeviceStorageFile(p.type(), p.storageName(), p.relpath());
RefPtr<CancelableRunnable> r = new DeleteFileEvent(this, dsf);
RefPtr<CancelableRunnable> r = new DeleteFileEvent(this, dsf.forget());
nsCOMPtr<nsIEventTarget> target
= do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
@ -139,7 +139,7 @@ DeviceStorageRequestParent::Dispatch()
RefPtr<DeviceStorageFile> dsf =
new DeviceStorageFile(p.type(), p.storageName());
RefPtr<FreeSpaceFileEvent> r = new FreeSpaceFileEvent(this, dsf);
RefPtr<FreeSpaceFileEvent> r = new FreeSpaceFileEvent(this, dsf.forget());
nsCOMPtr<nsIEventTarget> target
= do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
@ -158,7 +158,7 @@ DeviceStorageRequestParent::Dispatch()
RefPtr<DeviceStorageFile> dsf =
new DeviceStorageFile(p.type(), p.storageName());
RefPtr<UsedSpaceFileEvent> r = new UsedSpaceFileEvent(this, dsf);
RefPtr<UsedSpaceFileEvent> r = new UsedSpaceFileEvent(this, dsf.forget());
usedSpaceCache->Dispatch(r);
break;
@ -171,7 +171,7 @@ DeviceStorageRequestParent::Dispatch()
RefPtr<DeviceStorageFile> dsf =
new DeviceStorageFile(p.type(), p.storageName());
RefPtr<PostFormatResultEvent> r
= new PostFormatResultEvent(this, dsf);
= new PostFormatResultEvent(this, dsf.forget());
DebugOnly<nsresult> rv = NS_DispatchToMainThread(r);
MOZ_ASSERT(NS_SUCCEEDED(rv));
break;
@ -184,7 +184,7 @@ DeviceStorageRequestParent::Dispatch()
RefPtr<DeviceStorageFile> dsf =
new DeviceStorageFile(p.type(), p.storageName());
RefPtr<PostMountResultEvent> r
= new PostMountResultEvent(this, dsf);
= new PostMountResultEvent(this, dsf.forget());
DebugOnly<nsresult> rv = NS_DispatchToMainThread(r);
MOZ_ASSERT(NS_SUCCEEDED(rv));
break;
@ -197,7 +197,7 @@ DeviceStorageRequestParent::Dispatch()
RefPtr<DeviceStorageFile> dsf =
new DeviceStorageFile(p.type(), p.storageName());
RefPtr<PostUnmountResultEvent> r
= new PostUnmountResultEvent(this, dsf);
= new PostUnmountResultEvent(this, dsf.forget());
DebugOnly<nsresult> rv = NS_DispatchToMainThread(r);
MOZ_ASSERT(NS_SUCCEEDED(rv));
break;
@ -210,7 +210,7 @@ DeviceStorageRequestParent::Dispatch()
= new DeviceStorageFile(p.type(), p.storageName(),
p.rootdir(), NS_LITERAL_STRING(""));
RefPtr<CancelableRunnable> r
= new EnumerateFileEvent(this, dsf, p.since());
= new EnumerateFileEvent(this, dsf.forget(), p.since());
nsCOMPtr<nsIEventTarget> target
= do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
@ -393,10 +393,15 @@ DeviceStorageRequestParent::ActorDestroy(ActorDestroyReason)
{
MutexAutoLock lock(mMutex);
mActorDestroyed = true;
int32_t count = mRunnables.Length();
for (int32_t index = 0; index < count; index++) {
mRunnables[index]->Cancel();
for (auto& runnable : mRunnables) {
runnable->Cancel();
}
// Ensure we clear all references to the runnables so that there won't
// be leak due to cyclic reference. Note that it is safe to release
// the references here, since if a runnable is not cancelled yet, the
// corresponding thread should still hold a reference to it, and thus
// the runnable will end up being released in that thread, not here.
mRunnables.Clear();
}
DeviceStorageRequestParent::PostFreeSpaceResultEvent::PostFreeSpaceResultEvent(
@ -419,19 +424,6 @@ DeviceStorageRequestParent::PostFreeSpaceResultEvent::CancelableRun() {
return NS_OK;
}
DeviceStorageRequestParent::PostUsedSpaceResultEvent::
PostUsedSpaceResultEvent(DeviceStorageRequestParent* aParent,
const nsAString& aType,
uint64_t aUsedSpace)
: CancelableRunnable(aParent)
, mType(aType)
, mUsedSpace(aUsedSpace)
{
}
DeviceStorageRequestParent::PostUsedSpaceResultEvent::
~PostUsedSpaceResultEvent() {}
nsresult
DeviceStorageRequestParent::PostUsedSpaceResultEvent::CancelableRun() {
MOZ_ASSERT(NS_IsMainThread());
@ -448,8 +440,6 @@ DeviceStorageRequestParent::PostErrorEvent::
CopyASCIItoUTF16(aError, mError);
}
DeviceStorageRequestParent::PostErrorEvent::~PostErrorEvent() {}
nsresult
DeviceStorageRequestParent::PostErrorEvent::CancelableRun() {
MOZ_ASSERT(NS_IsMainThread());
@ -459,14 +449,6 @@ DeviceStorageRequestParent::PostErrorEvent::CancelableRun() {
return NS_OK;
}
DeviceStorageRequestParent::PostSuccessEvent::
PostSuccessEvent(DeviceStorageRequestParent* aParent)
: CancelableRunnable(aParent)
{
}
DeviceStorageRequestParent::PostSuccessEvent::~PostSuccessEvent() {}
nsresult
DeviceStorageRequestParent::PostSuccessEvent::CancelableRun() {
MOZ_ASSERT(NS_IsMainThread());
@ -476,22 +458,6 @@ DeviceStorageRequestParent::PostSuccessEvent::CancelableRun() {
return NS_OK;
}
DeviceStorageRequestParent::PostBlobSuccessEvent::
PostBlobSuccessEvent(DeviceStorageRequestParent* aParent,
DeviceStorageFile* aFile,
uint32_t aLength,
nsACString& aMimeType,
uint64_t aLastModifiedDate)
: CancelableRunnable(aParent)
, mLength(aLength)
, mLastModificationDate(aLastModifiedDate)
, mFile(aFile)
, mMimeType(aMimeType)
{
}
DeviceStorageRequestParent::PostBlobSuccessEvent::~PostBlobSuccessEvent() {}
nsresult
DeviceStorageRequestParent::PostBlobSuccessEvent::CancelableRun() {
MOZ_ASSERT(NS_IsMainThread());
@ -520,21 +486,6 @@ DeviceStorageRequestParent::PostBlobSuccessEvent::CancelableRun() {
return NS_OK;
}
DeviceStorageRequestParent::PostEnumerationSuccessEvent::
PostEnumerationSuccessEvent(DeviceStorageRequestParent* aParent,
const nsAString& aStorageType,
const nsAString& aRelPath,
InfallibleTArray<DeviceStorageFileValue>& aPaths)
: CancelableRunnable(aParent)
, mStorageType(aStorageType)
, mRelPath(aRelPath)
, mPaths(aPaths)
{
}
DeviceStorageRequestParent::PostEnumerationSuccessEvent::
~PostEnumerationSuccessEvent() {}
nsresult
DeviceStorageRequestParent::PostEnumerationSuccessEvent::CancelableRun() {
MOZ_ASSERT(NS_IsMainThread());
@ -544,18 +495,6 @@ DeviceStorageRequestParent::PostEnumerationSuccessEvent::CancelableRun() {
return NS_OK;
}
DeviceStorageRequestParent::CreateFdEvent::
CreateFdEvent(DeviceStorageRequestParent* aParent,
DeviceStorageFile* aFile)
: CancelableRunnable(aParent)
, mFile(aFile)
{
}
DeviceStorageRequestParent::CreateFdEvent::~CreateFdEvent()
{
}
nsresult
DeviceStorageRequestParent::CreateFdEvent::CancelableRun()
{
@ -588,22 +527,6 @@ DeviceStorageRequestParent::CreateFdEvent::CancelableRun()
return NS_DispatchToMainThread(r);
}
DeviceStorageRequestParent::WriteFileEvent::
WriteFileEvent(DeviceStorageRequestParent* aParent,
DeviceStorageFile* aFile,
nsIInputStream* aInputStream,
int32_t aRequestType)
: CancelableRunnable(aParent)
, mFile(aFile)
, mInputStream(aInputStream)
, mRequestType(aRequestType)
{
}
DeviceStorageRequestParent::WriteFileEvent::~WriteFileEvent()
{
}
nsresult
DeviceStorageRequestParent::WriteFileEvent::CancelableRun()
{
@ -647,17 +570,6 @@ DeviceStorageRequestParent::WriteFileEvent::CancelableRun()
return NS_DispatchToMainThread(r);
}
DeviceStorageRequestParent::DeleteFileEvent::
DeleteFileEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile)
: CancelableRunnable(aParent)
, mFile(aFile)
{
}
DeviceStorageRequestParent::DeleteFileEvent::~DeleteFileEvent()
{
}
nsresult
DeviceStorageRequestParent::DeleteFileEvent::CancelableRun()
{
@ -683,18 +595,6 @@ DeviceStorageRequestParent::DeleteFileEvent::CancelableRun()
return NS_DispatchToMainThread(r);
}
DeviceStorageRequestParent::FreeSpaceFileEvent::
FreeSpaceFileEvent(DeviceStorageRequestParent* aParent,
DeviceStorageFile* aFile)
: CancelableRunnable(aParent)
, mFile(aFile)
{
}
DeviceStorageRequestParent::FreeSpaceFileEvent::~FreeSpaceFileEvent()
{
}
nsresult
DeviceStorageRequestParent::FreeSpaceFileEvent::CancelableRun()
{
@ -710,18 +610,6 @@ DeviceStorageRequestParent::FreeSpaceFileEvent::CancelableRun()
return NS_DispatchToMainThread(r);
}
DeviceStorageRequestParent::UsedSpaceFileEvent::
UsedSpaceFileEvent(DeviceStorageRequestParent* aParent,
DeviceStorageFile* aFile)
: CancelableRunnable(aParent)
, mFile(aFile)
{
}
DeviceStorageRequestParent::UsedSpaceFileEvent::~UsedSpaceFileEvent()
{
}
nsresult
DeviceStorageRequestParent::UsedSpaceFileEvent::CancelableRun()
{
@ -747,9 +635,9 @@ DeviceStorageRequestParent::UsedSpaceFileEvent::CancelableRun()
}
DeviceStorageRequestParent::ReadFileEvent::
ReadFileEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile)
: CancelableRunnable(aParent)
, mFile(aFile)
ReadFileEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile)
: CancelableFileEvent(aParent, Move(aFile))
{
nsCOMPtr<nsIMIMEService> mimeService
= do_GetService(NS_MIMESERVICE_CONTRACTID);
@ -761,10 +649,6 @@ DeviceStorageRequestParent::ReadFileEvent::
}
}
DeviceStorageRequestParent::ReadFileEvent::~ReadFileEvent()
{
}
nsresult
DeviceStorageRequestParent::ReadFileEvent::CancelableRun()
{
@ -798,25 +682,12 @@ DeviceStorageRequestParent::ReadFileEvent::CancelableRun()
return NS_DispatchToMainThread(r);
}
r = new PostBlobSuccessEvent(mParent, mFile, static_cast<uint64_t>(fileSize),
r = new PostBlobSuccessEvent(mParent, mFile.forget(),
static_cast<uint64_t>(fileSize),
mMimeType, modDate);
return NS_DispatchToMainThread(r);
}
DeviceStorageRequestParent::EnumerateFileEvent::
EnumerateFileEvent(DeviceStorageRequestParent* aParent,
DeviceStorageFile* aFile,
uint64_t aSince)
: CancelableRunnable(aParent)
, mFile(aFile)
, mSince(aSince)
{
}
DeviceStorageRequestParent::EnumerateFileEvent::~EnumerateFileEvent()
{
}
nsresult
DeviceStorageRequestParent::EnumerateFileEvent::CancelableRun()
{
@ -848,19 +719,6 @@ DeviceStorageRequestParent::EnumerateFileEvent::CancelableRun()
return NS_DispatchToMainThread(r);
}
DeviceStorageRequestParent::PostPathResultEvent::
PostPathResultEvent(DeviceStorageRequestParent* aParent,
const nsAString& aPath)
: CancelableRunnable(aParent)
, mPath(aPath)
{
}
DeviceStorageRequestParent::PostPathResultEvent::~PostPathResultEvent()
{
}
nsresult
DeviceStorageRequestParent::PostPathResultEvent::CancelableRun()
{
@ -871,19 +729,6 @@ DeviceStorageRequestParent::PostPathResultEvent::CancelableRun()
return NS_OK;
}
DeviceStorageRequestParent::PostFileDescriptorResultEvent::
PostFileDescriptorResultEvent(DeviceStorageRequestParent* aParent,
const FileDescriptor& aFileDescriptor)
: CancelableRunnable(aParent)
, mFileDescriptor(aFileDescriptor)
{
}
DeviceStorageRequestParent::PostFileDescriptorResultEvent::
~PostFileDescriptorResultEvent()
{
}
nsresult
DeviceStorageRequestParent::PostFileDescriptorResultEvent::CancelableRun()
{
@ -894,19 +739,6 @@ DeviceStorageRequestParent::PostFileDescriptorResultEvent::CancelableRun()
return NS_OK;
}
DeviceStorageRequestParent::PostFormatResultEvent::
PostFormatResultEvent(DeviceStorageRequestParent* aParent,
DeviceStorageFile* aFile)
: CancelableRunnable(aParent)
, mFile(aFile)
{
}
DeviceStorageRequestParent::PostFormatResultEvent::
~PostFormatResultEvent()
{
}
nsresult
DeviceStorageRequestParent::PostFormatResultEvent::CancelableRun()
{
@ -922,19 +754,6 @@ DeviceStorageRequestParent::PostFormatResultEvent::CancelableRun()
return NS_OK;
}
DeviceStorageRequestParent::PostMountResultEvent::
PostMountResultEvent(DeviceStorageRequestParent* aParent,
DeviceStorageFile* aFile)
: CancelableRunnable(aParent)
, mFile(aFile)
{
}
DeviceStorageRequestParent::PostMountResultEvent::
~PostMountResultEvent()
{
}
nsresult
DeviceStorageRequestParent::PostMountResultEvent::CancelableRun()
{
@ -950,19 +769,6 @@ DeviceStorageRequestParent::PostMountResultEvent::CancelableRun()
return NS_OK;
}
DeviceStorageRequestParent::PostUnmountResultEvent::
PostUnmountResultEvent(DeviceStorageRequestParent* aParent,
DeviceStorageFile* aFile)
: CancelableRunnable(aParent)
, mFile(aFile)
{
}
DeviceStorageRequestParent::PostUnmountResultEvent::
~PostUnmountResultEvent()
{
}
nsresult
DeviceStorageRequestParent::PostUnmountResultEvent::CancelableRun()
{

View File

@ -74,11 +74,22 @@ private:
bool mCanceled;
};
class CancelableFileEvent : public CancelableRunnable
{
protected:
CancelableFileEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile)
: CancelableRunnable(aParent)
, mFile(Move(aFile)) {}
RefPtr<DeviceStorageFile> mFile;
};
class PostErrorEvent : public CancelableRunnable
{
public:
PostErrorEvent(DeviceStorageRequestParent* aParent, const char* aError);
virtual ~PostErrorEvent();
virtual ~PostErrorEvent() {}
virtual nsresult CancelableRun();
private:
nsString mError;
@ -87,21 +98,28 @@ private:
class PostSuccessEvent : public CancelableRunnable
{
public:
explicit PostSuccessEvent(DeviceStorageRequestParent* aParent);
virtual ~PostSuccessEvent();
explicit PostSuccessEvent(DeviceStorageRequestParent* aParent)
: CancelableRunnable(aParent) {}
virtual ~PostSuccessEvent() {}
virtual nsresult CancelableRun();
};
class PostBlobSuccessEvent : public CancelableRunnable
class PostBlobSuccessEvent : public CancelableFileEvent
{
public:
PostBlobSuccessEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile, uint32_t aLength, nsACString& aMimeType, uint64_t aLastModifiedDate);
virtual ~PostBlobSuccessEvent();
PostBlobSuccessEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile,
uint32_t aLength, nsACString& aMimeType,
uint64_t aLastModifiedDate)
: CancelableFileEvent(aParent, Move(aFile))
, mLength(aLength)
, mLastModificationDate(aLastModifiedDate)
, mMimeType(aMimeType) {}
virtual ~PostBlobSuccessEvent() {}
virtual nsresult CancelableRun();
private:
uint32_t mLength;
uint64_t mLastModificationDate;
RefPtr<DeviceStorageFile> mFile;
nsCString mMimeType;
};
@ -111,8 +129,12 @@ private:
PostEnumerationSuccessEvent(DeviceStorageRequestParent* aParent,
const nsAString& aStorageType,
const nsAString& aRelPath,
InfallibleTArray<DeviceStorageFileValue>& aPaths);
virtual ~PostEnumerationSuccessEvent();
InfallibleTArray<DeviceStorageFileValue>& aPaths)
: CancelableRunnable(aParent)
, mStorageType(aStorageType)
, mRelPath(aRelPath)
, mPaths(aPaths) {}
virtual ~PostEnumerationSuccessEvent() {}
virtual nsresult CancelableRun();
private:
const nsString mStorageType;
@ -120,89 +142,97 @@ private:
InfallibleTArray<DeviceStorageFileValue> mPaths;
};
class CreateFdEvent : public CancelableRunnable
class CreateFdEvent : public CancelableFileEvent
{
public:
CreateFdEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
virtual ~CreateFdEvent();
CreateFdEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile)
: CancelableFileEvent(aParent, Move(aFile)) {}
virtual ~CreateFdEvent() {}
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
};
class WriteFileEvent : public CancelableRunnable
class WriteFileEvent : public CancelableFileEvent
{
public:
WriteFileEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile,
nsIInputStream* aInputStream, int32_t aRequestType);
virtual ~WriteFileEvent();
WriteFileEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile,
nsIInputStream* aInputStream, int32_t aRequestType)
: CancelableFileEvent(aParent, Move(aFile))
, mInputStream(aInputStream)
, mRequestType(aRequestType) {}
virtual ~WriteFileEvent() {}
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
nsCOMPtr<nsIInputStream> mInputStream;
int32_t mRequestType;
};
class DeleteFileEvent : public CancelableRunnable
class DeleteFileEvent : public CancelableFileEvent
{
public:
DeleteFileEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
virtual ~DeleteFileEvent();
DeleteFileEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile)
: CancelableFileEvent(aParent, Move(aFile)) {}
virtual ~DeleteFileEvent() {}
virtual nsresult CancelableRun();
};
class FreeSpaceFileEvent : public CancelableFileEvent
{
public:
FreeSpaceFileEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile)
: CancelableFileEvent(aParent, Move(aFile)) {}
virtual ~FreeSpaceFileEvent() {}
virtual nsresult CancelableRun();
};
class UsedSpaceFileEvent : public CancelableFileEvent
{
public:
UsedSpaceFileEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile)
: CancelableFileEvent(aParent, Move(aFile)) {}
virtual ~UsedSpaceFileEvent() {}
virtual nsresult CancelableRun();
};
class ReadFileEvent : public CancelableFileEvent
{
public:
ReadFileEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile);
virtual ~ReadFileEvent() {}
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
};
class FreeSpaceFileEvent : public CancelableRunnable
{
public:
FreeSpaceFileEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
virtual ~FreeSpaceFileEvent();
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
};
class UsedSpaceFileEvent : public CancelableRunnable
{
public:
UsedSpaceFileEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
virtual ~UsedSpaceFileEvent();
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
};
class ReadFileEvent : public CancelableRunnable
{
public:
ReadFileEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
virtual ~ReadFileEvent();
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
nsCString mMimeType;
};
class EnumerateFileEvent : public CancelableRunnable
class EnumerateFileEvent : public CancelableFileEvent
{
public:
EnumerateFileEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile, uint64_t aSince);
virtual ~EnumerateFileEvent();
EnumerateFileEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile,
uint64_t aSince)
: CancelableFileEvent(aParent, Move(aFile))
, mSince(aSince) {}
virtual ~EnumerateFileEvent() {}
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
uint64_t mSince;
};
class PostPathResultEvent : public CancelableRunnable
{
public:
PostPathResultEvent(DeviceStorageRequestParent* aParent, const nsAString& aPath);
virtual ~PostPathResultEvent();
PostPathResultEvent(DeviceStorageRequestParent* aParent,
const nsAString& aPath)
: CancelableRunnable(aParent)
, mPath(aPath) {}
virtual ~PostPathResultEvent() {}
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
nsString mPath;
};
@ -210,11 +240,12 @@ private:
{
public:
PostFileDescriptorResultEvent(DeviceStorageRequestParent* aParent,
const FileDescriptor& aFileDescriptor);
virtual ~PostFileDescriptorResultEvent();
const FileDescriptor& aFileDescriptor)
: CancelableRunnable(aParent)
, mFileDescriptor(aFileDescriptor) {}
virtual ~PostFileDescriptorResultEvent() {}
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
FileDescriptor mFileDescriptor;
};
@ -234,42 +265,45 @@ private:
public:
PostUsedSpaceResultEvent(DeviceStorageRequestParent* aParent,
const nsAString& aType,
uint64_t aUsedSpace);
virtual ~PostUsedSpaceResultEvent();
uint64_t aUsedSpace)
: CancelableRunnable(aParent)
, mType(aType)
, mUsedSpace(aUsedSpace) {}
virtual ~PostUsedSpaceResultEvent() {}
virtual nsresult CancelableRun();
private:
nsString mType;
uint64_t mUsedSpace;
};
class PostFormatResultEvent : public CancelableRunnable
class PostFormatResultEvent : public CancelableFileEvent
{
public:
PostFormatResultEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
virtual ~PostFormatResultEvent();
PostFormatResultEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile)
: CancelableFileEvent(aParent, Move(aFile)) {}
virtual ~PostFormatResultEvent() {}
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
};
class PostMountResultEvent : public CancelableRunnable
class PostMountResultEvent : public CancelableFileEvent
{
public:
PostMountResultEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
virtual ~PostMountResultEvent();
PostMountResultEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile)
: CancelableFileEvent(aParent, Move(aFile)) {}
virtual ~PostMountResultEvent() {}
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
};
class PostUnmountResultEvent : public CancelableRunnable
class PostUnmountResultEvent : public CancelableFileEvent
{
public:
PostUnmountResultEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
virtual ~PostUnmountResultEvent();
PostUnmountResultEvent(DeviceStorageRequestParent* aParent,
already_AddRefed<DeviceStorageFile>&& aFile)
: CancelableFileEvent(aParent, Move(aFile)) {}
virtual ~PostUnmountResultEvent() {}
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
};
protected:

View File

@ -642,9 +642,10 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
if (NS_SUCCEEDED(rv)) {
if (aTargets) {
aTargets->Clear();
aTargets->SetCapacity(chain.Length());
for (uint32_t i = 0; i < chain.Length(); ++i) {
aTargets->AppendElement(chain[i].CurrentTarget()->GetTargetForDOMEvent());
uint32_t numTargets = chain.Length();
EventTarget** targets = aTargets->AppendElements(numTargets);
for (uint32_t i = 0; i < numTargets; ++i) {
targets[i] = chain[i].CurrentTarget()->GetTargetForDOMEvent();
}
} else {
// Event target chain is created. Handle the chain.

View File

@ -181,7 +181,10 @@ TouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
int32_t flag = 0;
if (NS_SUCCEEDED(Preferences::GetInt("dom.w3c_touch_events.enabled", &flag))) {
if (flag == 2) {
#if defined(XP_WIN) || MOZ_WIDGET_GTK == 3
#if defined(MOZ_B2G) || defined(MOZ_WIDGET_ANDROID)
// Touch support is always enabled on B2G and android.
prefValue = true;
#elif defined(XP_WIN) || MOZ_WIDGET_GTK == 3
static bool sDidCheckTouchDeviceSupport = false;
static bool sIsTouchDeviceSupportPresent = false;
// On Windows and GTK3 we auto-detect based on device support.

View File

@ -3469,6 +3469,9 @@ void HTMLMediaElement::FirstFrameLoaded()
void HTMLMediaElement::NetworkError()
{
if (mDecoder) {
ShutdownDecoder();
}
Error(nsIDOMMediaError::MEDIA_ERR_NETWORK);
}

View File

@ -848,7 +848,6 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm,
*aFormSubmission = new nsFSURLEncoded(charset, method, doc,
aOriginatingElement);
}
NS_ENSURE_TRUE(*aFormSubmission, NS_ERROR_OUT_OF_MEMORY);
return NS_OK;
}

View File

@ -92,7 +92,7 @@ var DoPreloadPostfork = function(aCallback) {
} catch (e) {
}
if (Services.prefs.getIntPref("dom.w3c_touch_events.enabled") == 1) {
if (Services.prefs.getIntPref("dom.w3c_touch_events.enabled") != 0) {
try {
if (Services.prefs.getBoolPref("layers.async-pan-zoom.enabled") === false) {
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanningAPZDisabled.js", global);

View File

@ -21,7 +21,7 @@
"use strict";
let { MockFilePicker } =
Components.utils.import("resource://specialpowers/MockFilePicker.jsm", {});
Components.utils.import("chrome://specialpowers/content/MockFilePicker.jsm", {});
function parentReady(message) {
MockFilePicker.init(content);

View File

@ -298,8 +298,6 @@ nsJSONWriter::Write(const char16_t *aBuffer, uint32_t aLength)
if (!mDidWrite) {
mBuffer = new char16_t[JSON_STREAM_BUFSIZE];
if (!mBuffer)
return NS_ERROR_OUT_OF_MEMORY;
mDidWrite = true;
}
@ -481,9 +479,6 @@ nsresult
NS_NewJSON(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
nsJSON* json = new nsJSON();
if (!json)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(json);
*aResult = json;

View File

@ -410,8 +410,6 @@ nsresult nsJSChannel::Init(nsIURI *aURI)
// Create the nsIStreamIO layer used by the nsIStreamIOChannel.
mIOThunk = new nsJSThunk();
if (!mIOThunk)
return NS_ERROR_OUT_OF_MEMORY;
// Create a stock input stream channel...
// Remember, until AsyncOpen is called, the script will not be evaluated
@ -1129,8 +1127,6 @@ nsJSProtocolHandler::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
return NS_ERROR_NO_AGGREGATION;
nsJSProtocolHandler* ph = new nsJSProtocolHandler();
if (!ph)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(ph);
nsresult rv = ph->Init();
if (NS_SUCCEEDED(rv)) {

View File

@ -56,10 +56,6 @@
#include "DirectShowDecoder.h"
#include "DirectShowReader.h"
#endif
#ifdef MOZ_APPLEMEDIA
#include "AppleDecoder.h"
#include "AppleMP3Reader.h"
#endif
#ifdef MOZ_FMP4
#include "MP4Decoder.h"
#include "MP4Demuxer.h"
@ -370,38 +366,6 @@ IsMP3SupportedType(const nsACString& aType,
return MP3Decoder::CanHandleMediaType(aType, aCodecs);
}
#ifdef MOZ_APPLEMEDIA
static const char * const gAppleMP3Types[] = {
"audio/mp3",
"audio/mpeg",
nullptr,
};
static const char * const gAppleMP3Codecs[] = {
"mp3",
nullptr
};
static bool
IsAppleMediaSupportedType(const nsACString& aType,
const char * const ** aCodecs = nullptr)
{
if (MediaDecoder::IsAppleMP3Enabled()
&& CodecListContains(gAppleMP3Types, aType)) {
if (aCodecs) {
*aCodecs = gAppleMP3Codecs;
}
return true;
}
// TODO MP4
return false;
}
#endif
/* static */
bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType)
{
@ -473,9 +437,6 @@ DecoderTraits::CanHandleCodecsType(const char* aMIMEType,
#ifdef MOZ_DIRECTSHOW
DirectShowDecoder::GetSupportedCodecs(nsDependentCString(aMIMEType), &codecList);
#endif
#ifdef MOZ_APPLEMEDIA
IsAppleMediaSupportedType(nsDependentCString(aMIMEType), &codecList);
#endif
#ifdef MOZ_ANDROID_OMX
if (MediaDecoder::IsAndroidMediaEnabled()) {
EnsureAndroidMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), &codecList);
@ -560,11 +521,6 @@ DecoderTraits::CanHandleMediaType(const char* aMIMEType,
return CANPLAY_MAYBE;
}
#endif
#ifdef MOZ_APPLEMEDIA
if (IsAppleMediaSupportedType(nsDependentCString(aMIMEType), nullptr)) {
return CANPLAY_MAYBE;
}
#endif
#ifdef MOZ_ANDROID_OMX
if (MediaDecoder::IsAndroidMediaEnabled() &&
EnsureAndroidMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), nullptr)) {
@ -677,12 +633,6 @@ InstantiateDecoder(const nsACString& aType, MediaDecoderOwner* aOwner)
return decoder.forget();
}
#endif
#ifdef MOZ_APPLEMEDIA
if (IsAppleMediaSupportedType(aType)) {
decoder = new AppleDecoder(aOwner);
return decoder.forget();
}
#endif
return nullptr;
}
@ -756,11 +706,6 @@ MediaDecoderReader* DecoderTraits::CreateReader(const nsACString& aType, Abstrac
if (IsDirectShowSupportedType(aType)) {
decoderReader = new DirectShowReader(aDecoder);
} else
#endif
#ifdef MOZ_APPLEMEDIA
if (IsAppleMediaSupportedType(aType)) {
decoderReader = new AppleMP3Reader(aDecoder);
} else
#endif
if (false) {} // dummy if to take care of the dangling else
@ -801,9 +746,6 @@ bool DecoderTraits::IsSupportedInVideoDocument(const nsACString& aType)
#ifdef MOZ_DIRECTSHOW
IsDirectShowSupportedType(aType) ||
#endif
#ifdef MOZ_APPLEMEDIA
IsAppleMediaSupportedType(aType) ||
#endif
#ifdef NECKO_PROTOCOL_rtsp
IsRtspSupportedType(aType) ||
#endif

View File

@ -640,9 +640,6 @@ InitMediaCache()
return;
gMediaCache = new MediaCache();
if (!gMediaCache)
return;
nsresult rv = gMediaCache->Init();
if (NS_FAILED(rv)) {
delete gMediaCache;

View File

@ -1622,14 +1622,6 @@ MediaDecoder::IsAndroidMediaEnabled()
}
#endif
#ifdef MOZ_APPLEMEDIA
bool
MediaDecoder::IsAppleMP3Enabled()
{
return Preferences::GetBool("media.apple.mp3.enabled");
}
#endif
NS_IMETHODIMP
MediaMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData, bool aAnonymize)

View File

@ -722,10 +722,6 @@ private:
static bool IsWMFEnabled();
#endif
#ifdef MOZ_APPLEMEDIA
static bool IsAppleMP3Enabled();
#endif
// Return statistics. This is used for progress events and other things.
// This can be called from any thread. It's only a snapshot of the
// current state, since other threads might be changing the state

View File

@ -1478,7 +1478,6 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
MediaManager::MediaManager()
: mMediaThread(nullptr)
, mMutex("mozilla::MediaManager")
, mBackend(nullptr) {
mPrefs.mFreq = 1000; // 1KHz test tone
mPrefs.mWidth = 0; // adaptive default
@ -2400,10 +2399,10 @@ MediaManager::GetUserMediaDevices(nsPIDOMWindow* aWindow,
MediaEngine*
MediaManager::GetBackend(uint64_t aWindowId)
{
MOZ_ASSERT(MediaManager::IsInMediaThread());
// Plugin backends as appropriate. The default engine also currently
// includes picture support for Android.
// This IS called off main-thread.
MutexAutoLock lock(mMutex);
if (!mBackend) {
MOZ_RELEASE_ASSERT(!sInShutdown); // we should never create a new backend in shutdown
#if defined(MOZ_WEBRTC)
@ -2600,12 +2599,6 @@ MediaManager::Shutdown()
GetActiveWindows()->Clear();
mActiveCallbacks.Clear();
mCallIds.Clear();
{
MutexAutoLock lock(mMutex);
if (mBackend) {
mBackend->Shutdown(); // ok to invoke multiple times
}
}
// Because mMediaThread is not an nsThread, we must dispatch to it so it can
// clean up BackgroundChild. Continue stopping thread once this is done.
@ -2613,26 +2606,32 @@ MediaManager::Shutdown()
class ShutdownTask : public Task
{
public:
ShutdownTask(already_AddRefed<MediaEngine> aBackend,
ShutdownTask(MediaManager* aManager,
nsRunnable* aReply)
: mReply(aReply)
, mBackend(aBackend) {}
: mManager(aManager)
, mReply(aReply) {}
private:
virtual void
Run()
{
LOG(("MediaManager Thread Shutdown"));
MOZ_ASSERT(MediaManager::IsInMediaThread());
// Must shutdown backend on MediaManager thread, since that's where we started it from!
{
if (mManager->mBackend) {
mManager->mBackend->Shutdown(); // ok to invoke multiple times
}
}
mozilla::ipc::BackgroundChild::CloseForCurrentThread();
// must explicitly do this before dispatching the reply, since the reply may kill us with Stop()
mBackend = nullptr; // last reference, will invoke Shutdown() again
mManager->mBackend = nullptr; // last reference, will invoke Shutdown() again
if (NS_FAILED(NS_DispatchToMainThread(mReply.forget()))) {
LOG(("Will leak thread: DispatchToMainthread of reply runnable failed in MediaManager shutdown"));
}
}
RefPtr<MediaManager> mManager;
RefPtr<nsRunnable> mReply;
RefPtr<MediaEngine> mBackend;
};
// Post ShutdownTask to execute on mMediaThread and pass in a lambda
@ -2645,14 +2644,8 @@ MediaManager::Shutdown()
// note that this == sSingleton
RefPtr<MediaManager> that(sSingleton);
// Release the backend (and call Shutdown()) from within the MediaManager thread
RefPtr<MediaEngine> temp;
{
MutexAutoLock lock(mMutex);
temp = mBackend.forget();
}
// Don't use MediaManager::PostTask() because we're sInShutdown=true here!
mMediaThread->message_loop()->PostTask(FROM_HERE, new ShutdownTask(
temp.forget(),
mMediaThread->message_loop()->PostTask(FROM_HERE, new ShutdownTask(this,
media::NewRunnableFrom([this, that]() mutable {
LOG(("MediaManager shutdown lambda running, releasing MediaManager singleton and thread"));
if (mMediaThread) {

View File

@ -533,8 +533,7 @@ private:
nsAutoPtr<base::Thread> mMediaThread;
nsCOMPtr<nsIAsyncShutdownBlocker> mShutdownBlocker;
Mutex mMutex;
// protected with mMutex:
// ONLY accessed from MediaManagerThread
RefPtr<MediaEngine> mBackend;
static StaticRefPtr<MediaManager> sSingleton;

View File

@ -549,8 +549,6 @@ nsresult ChannelMediaResource::OpenChannel(nsIStreamListener** aStreamListener)
}
mListener = new Listener(this);
NS_ENSURE_TRUE(mListener, NS_ERROR_OUT_OF_MEMORY);
if (aStreamListener) {
*aStreamListener = mListener;
NS_ADDREF(*aStreamListener);

View File

@ -1,30 +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 "AppleDecoder.h"
#include "AppleMP3Reader.h"
#include "MediaDecoderStateMachine.h"
namespace mozilla {
AppleDecoder::AppleDecoder(MediaDecoderOwner* aOwner)
: MediaDecoder(aOwner)
{
}
MediaDecoder *
AppleDecoder::Clone(MediaDecoderOwner* aOwner)
{
return new AppleDecoder(aOwner);
}
MediaDecoderStateMachine *
AppleDecoder::CreateStateMachine()
{
// TODO MP4
return new MediaDecoderStateMachine(this, new AppleMP3Reader(this));
}
} // namespace mozilla

View File

@ -1,24 +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/. */
#ifndef __AppleDecoder_h__
#define __AppleDecoder_h__
#include "MediaDecoder.h"
namespace mozilla {
class AppleDecoder : public MediaDecoder
{
public:
explicit AppleDecoder(MediaDecoderOwner* aOwner);
virtual MediaDecoder* Clone(MediaDecoderOwner* aOwner) override;
virtual MediaDecoderStateMachine* CreateStateMachine() override;
};
} // namespace mozilla
#endif // __AppleDecoder_h__

View File

@ -1,543 +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 "AppleMP3Reader.h"
#include "nsISeekableStream.h"
#include "MediaDecoder.h"
// Number of bytes we will read and pass to the audio parser in each
// |DecodeAudioData| call.
#define AUDIO_READ_BYTES 4096
// Maximum number of audio frames we will accept from the audio decoder in one
// go. Carefully select this to work well with both the mp3 1152 max frames
// per block and power-of-2 allocation sizes. Since we must pre-allocate the
// buffer we cannot use AudioCompactor without paying for an additional
// allocation and copy. Therefore, choosing a value that divides exactly into
// 1152 is most memory efficient.
#define MAX_AUDIO_FRAMES 128
using namespace mozilla::media;
namespace mozilla {
extern LazyLogModule gMediaDecoderLog;
#define LOGE(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Error, (__VA_ARGS__))
#define LOGW(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Warning, (__VA_ARGS__))
#define LOGD(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
#define PROPERTY_ID_FORMAT "%c%c%c%c"
#define PROPERTY_ID_PRINT(x) ((x) >> 24), \
((x) >> 16) & 0xff, \
((x) >> 8) & 0xff, \
(x) & 0xff
AppleMP3Reader::AppleMP3Reader(AbstractMediaDecoder *aDecoder)
: MediaDecoderReader(aDecoder)
, mStreamReady(false)
, mAudioFramesPerCompressedPacket(0)
, mCurrentAudioFrame(0)
, mAudioChannels(0)
, mAudioSampleRate(0)
, mAudioFileStream(nullptr)
, mAudioConverter(nullptr)
, mMP3FrameParser(mDecoder->GetResource()->GetLength())
, mResource(mDecoder->GetResource())
{
MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread");
}
AppleMP3Reader::~AppleMP3Reader()
{
MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread");
}
/*
* The Apple audio decoding APIs are very callback-happy. When the parser has
* some metadata, it will call back to here.
*/
static void _AudioMetadataCallback(void *aThis,
AudioFileStreamID aFileStream,
AudioFileStreamPropertyID aPropertyID,
UInt32 *aFlags)
{
((AppleMP3Reader*)aThis)->AudioMetadataCallback(aFileStream, aPropertyID,
aFlags);
}
/*
* Similar to above, this is called when the parser has enough data to parse
* one or more samples.
*/
static void _AudioSampleCallback(void *aThis,
UInt32 aNumBytes, UInt32 aNumPackets,
const void *aData,
AudioStreamPacketDescription *aPackets)
{
((AppleMP3Reader*)aThis)->AudioSampleCallback(aNumBytes, aNumPackets,
aData, aPackets);
}
/*
* If we're not at end of stream, read |aNumBytes| from the media resource,
* put it in |aData|, and return true.
* Otherwise, put as much data as is left into |aData|, set |aNumBytes| to the
* amount of data we have left, and return false.
*/
nsresult
AppleMP3Reader::Read(uint32_t *aNumBytes, char *aData)
{
nsresult rv = mResource.Read(aData, *aNumBytes, aNumBytes);
if (NS_FAILED(rv)) {
*aNumBytes = 0;
return NS_ERROR_FAILURE;
}
// XXX Maybe return a better value than NS_ERROR_FAILURE?
return *aNumBytes ? NS_OK : NS_ERROR_FAILURE;
}
nsresult
AppleMP3Reader::Init()
{
AudioFileTypeID fileType = kAudioFileMP3Type;
OSStatus rv = AudioFileStreamOpen(this,
_AudioMetadataCallback,
_AudioSampleCallback,
fileType,
&mAudioFileStream);
if (rv) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
struct PassthroughUserData {
AppleMP3Reader *mReader;
UInt32 mNumPackets;
UInt32 mDataSize;
const void *mData;
AudioStreamPacketDescription *mPacketDesc;
bool mDone;
};
// Error value we pass through the decoder to signal that nothing has gone wrong
// during decoding, but more data is needed.
const UInt32 kNeedMoreData = 'MOAR';
/*
* This function is called from |AudioConverterFillComplexBuffer|, which is
* called from |AudioSampleCallback| below, which in turn is called by
* |AudioFileStreamParseBytes|, which is called by |DecodeAudioData|.
*
* Mercifully, this is all synchronous.
*
* This callback is run when the AudioConverter (decoder) wants more MP3 packets
* to decode.
*/
/* static */ OSStatus
AppleMP3Reader::PassthroughInputDataCallback(AudioConverterRef aAudioConverter,
UInt32 *aNumDataPackets /* in/out */,
AudioBufferList *aData /* in/out */,
AudioStreamPacketDescription **aPacketDesc,
void *aUserData)
{
if (!aPacketDesc) {
return kAudioFileStreamError_UnspecifiedError;
}
PassthroughUserData *userData = (PassthroughUserData *)aUserData;
if (userData->mDone) {
// We make sure this callback is run _once_, with all the data we received
// from |AudioFileStreamParseBytes|. When we return an error, the decoder
// simply passes the return value on to the calling method,
// |AudioSampleCallback|; and flushes all of the audio frames it had
// buffered. It does not change the decoder's state.
LOGD("requested too much data; returning\n");
*aNumDataPackets = 0;
return kNeedMoreData;
}
userData->mDone = true;
LOGD("AudioConverter wants %u packets of audio data\n", *aNumDataPackets);
*aNumDataPackets = userData->mNumPackets;
*aPacketDesc = userData->mPacketDesc;
aData->mBuffers[0].mNumberChannels = userData->mReader->mAudioChannels;
aData->mBuffers[0].mDataByteSize = userData->mDataSize;
aData->mBuffers[0].mData = const_cast<void *>(userData->mData);
return 0;
}
/*
* This callback is called when |AudioFileStreamParseBytes| has enough data to
* extract one or more MP3 packets.
*/
void
AppleMP3Reader::AudioSampleCallback(UInt32 aNumBytes,
UInt32 aNumPackets,
const void *aData,
AudioStreamPacketDescription *aPackets)
{
LOGD("got %u bytes, %u packets\n", aNumBytes, aNumPackets);
// 1 frame per packet * num channels * 32-bit float
uint32_t decodedSize = MAX_AUDIO_FRAMES * mAudioChannels *
sizeof(AudioDataValue);
// descriptions for _decompressed_ audio packets. ignored.
nsAutoArrayPtr<AudioStreamPacketDescription>
packets(new AudioStreamPacketDescription[MAX_AUDIO_FRAMES]);
// This API insists on having MP3 packets spoon-fed to it from a callback.
// This structure exists only to pass our state and the result of the parser
// on to the callback above.
PassthroughUserData userData = { this, aNumPackets, aNumBytes, aData, aPackets, false };
do {
// Decompressed audio buffer
auto decoded = MakeUnique<uint8_t[]>(decodedSize);
AudioBufferList decBuffer;
decBuffer.mNumberBuffers = 1;
decBuffer.mBuffers[0].mNumberChannels = mAudioChannels;
decBuffer.mBuffers[0].mDataByteSize = decodedSize;
decBuffer.mBuffers[0].mData = decoded.get();
// in: the max number of packets we can handle from the decoder.
// out: the number of packets the decoder is actually returning.
UInt32 numFrames = MAX_AUDIO_FRAMES;
OSStatus rv = AudioConverterFillComplexBuffer(mAudioConverter,
PassthroughInputDataCallback,
&userData,
&numFrames /* in/out */,
&decBuffer,
packets.get());
if (rv && rv != kNeedMoreData) {
LOGE("Error decoding audio stream: %x\n", rv);
break;
}
// If we decoded zero frames then AudiOConverterFillComplexBuffer is out
// of data to provide. We drained its internal buffer completely on the
// last pass.
if (numFrames == 0 && rv == kNeedMoreData) {
LOGD("FillComplexBuffer out of data exactly\n");
break;
}
int64_t time = FramesToUsecs(mCurrentAudioFrame, mAudioSampleRate).value();
int64_t duration = FramesToUsecs(numFrames, mAudioSampleRate).value();
LOGD("pushed audio at time %lfs; duration %lfs\n",
(double)time / USECS_PER_S, (double)duration / USECS_PER_S);
auto samples = UniquePtr<AudioDataValue[]>(reinterpret_cast<AudioDataValue*>
(decoded.release()));
AudioData *audio = new AudioData(mResource.Tell(),
time, duration, numFrames,
Move(samples),
mAudioChannels, mAudioSampleRate);
mAudioQueue.Push(audio);
mCurrentAudioFrame += numFrames;
if (rv == kNeedMoreData) {
// No error; we just need more data.
LOGD("FillComplexBuffer out of data\n");
break;
}
} while (true);
}
bool
AppleMP3Reader::DecodeAudioData()
{
MOZ_ASSERT(OnTaskQueue());
// Read AUDIO_READ_BYTES if we can
char bytes[AUDIO_READ_BYTES];
uint32_t numBytes = AUDIO_READ_BYTES;
nsresult readrv = Read(&numBytes, bytes);
// This function calls |AudioSampleCallback| above, synchronously, when it
// finds compressed MP3 frame.
OSStatus rv = AudioFileStreamParseBytes(mAudioFileStream,
numBytes,
bytes,
0 /* flags */);
if (NS_FAILED(readrv)) {
mAudioQueue.Finish();
return false;
}
// DataUnavailable just means there wasn't enough data to demux anything.
// We should have more to push into the demuxer next time we're called.
if (rv && rv != kAudioFileStreamError_DataUnavailable) {
LOGE("AudioFileStreamParseBytes returned unknown error %x", rv);
return false;
}
return true;
}
bool
AppleMP3Reader::DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold)
{
MOZ_ASSERT(OnTaskQueue());
return false;
}
bool
AppleMP3Reader::IsMediaSeekable()
{
// not used
return true;
}
/*
* Query the MP3 parser for a piece of metadata.
*/
static nsresult
GetProperty(AudioFileStreamID aAudioFileStream,
AudioFileStreamPropertyID aPropertyID, void *aData)
{
UInt32 size;
Boolean writeable;
OSStatus rv = AudioFileStreamGetPropertyInfo(aAudioFileStream, aPropertyID,
&size, &writeable);
if (rv) {
LOGW("Couldn't get property " PROPERTY_ID_FORMAT "\n",
PROPERTY_ID_PRINT(aPropertyID));
return NS_ERROR_FAILURE;
}
rv = AudioFileStreamGetProperty(aAudioFileStream, aPropertyID,
&size, aData);
return NS_OK;
}
nsresult
AppleMP3Reader::ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags)
{
MOZ_ASSERT(OnTaskQueue());
*aTags = nullptr;
/*
* Feed bytes into the parser until we have all the metadata we need to
* set up the decoder. When the parser has enough data, it will
* synchronously call back to |AudioMetadataCallback| below.
*/
OSStatus rv;
nsresult readrv;
uint32_t offset = 0;
do {
char bytes[AUDIO_READ_BYTES];
uint32_t numBytes = AUDIO_READ_BYTES;
readrv = Read(&numBytes, bytes);
rv = AudioFileStreamParseBytes(mAudioFileStream,
numBytes,
bytes,
0 /* flags */);
mMP3FrameParser.Parse(reinterpret_cast<uint8_t*>(bytes), numBytes, offset);
offset += numBytes;
// We have to do our decoder setup from the callback. When it's done it will
// set mStreamReady.
} while (!mStreamReady && !rv && NS_SUCCEEDED(readrv));
if (rv) {
LOGE("Error decoding audio stream metadata\n");
return NS_ERROR_FAILURE;
}
if (!mAudioConverter) {
LOGE("Failed to setup the AudioToolbox audio decoder\n");
return NS_ERROR_FAILURE;
}
if (!mMP3FrameParser.IsMP3()) {
LOGE("Frame parser failed to parse MP3 stream\n");
return NS_ERROR_FAILURE;
}
if (mStreamReady) {
aInfo->mAudio.mRate = mAudioSampleRate;
aInfo->mAudio.mChannels = mAudioChannels;
}
// This special snowflake reader doesn't seem to set *aInfo = mInfo like all
// the others. Yuck.
mDuration = mMP3FrameParser.GetDuration();
mInfo.mMetadataDuration.emplace(TimeUnit::FromMicroseconds(mDuration));
aInfo->mMetadataDuration.emplace(TimeUnit::FromMicroseconds(mDuration));
return NS_OK;
}
void
AppleMP3Reader::AudioMetadataCallback(AudioFileStreamID aFileStream,
AudioFileStreamPropertyID aPropertyID,
UInt32 *aFlags)
{
if (aPropertyID == kAudioFileStreamProperty_ReadyToProducePackets) {
/*
* The parser is ready to send us packets of MP3 audio.
*
* We need to set the decoder up here, because if
* |AudioFileStreamParseBytes| has enough audio data, then it will call
* |AudioSampleCallback| before we get back to |ReadMetadata|.
*/
SetupDecoder();
mStreamReady = true;
}
}
void
AppleMP3Reader::SetupDecoder()
{
// Get input format description from demuxer
AudioStreamBasicDescription inputFormat, outputFormat;
GetProperty(mAudioFileStream, kAudioFileStreamProperty_DataFormat, &inputFormat);
memset(&outputFormat, 0, sizeof(outputFormat));
// Set output format
#if defined(MOZ_SAMPLE_TYPE_FLOAT32)
outputFormat.mBitsPerChannel = 32;
outputFormat.mFormatFlags = kLinearPCMFormatFlagIsFloat;
#elif defined(MOZ_SAMPLE_TYPE_S16)
outputFormat.mBitsPerChannel = 32;
outputFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger;
#else
#error Unknown audio sample type
#endif
mAudioSampleRate = outputFormat.mSampleRate = inputFormat.mSampleRate;
mAudioChannels
= outputFormat.mChannelsPerFrame = inputFormat.mChannelsPerFrame;
mAudioFramesPerCompressedPacket = inputFormat.mFramesPerPacket;
outputFormat.mFormatID = kAudioFormatLinearPCM;
// Set up the decoder so it gives us one sample per frame; this way, it will
// pass us all the samples it has in one go. Also makes it much easier to
// deinterlace.
outputFormat.mFramesPerPacket = 1;
outputFormat.mBytesPerPacket = outputFormat.mBytesPerFrame
= outputFormat.mChannelsPerFrame * outputFormat.mBitsPerChannel / 8;
OSStatus rv = AudioConverterNew(&inputFormat,
&outputFormat,
&mAudioConverter);
if (rv) {
LOGE("Error constructing audio format converter: %x\n", rv);
mAudioConverter = nullptr;
return;
}
}
RefPtr<MediaDecoderReader::SeekPromise>
AppleMP3Reader::Seek(int64_t aTime, int64_t aEndTime)
{
MOZ_ASSERT(OnTaskQueue());
// Find the exact frame/packet that contains |aTime|.
mCurrentAudioFrame = aTime * mAudioSampleRate / USECS_PER_S;
SInt64 packet = mCurrentAudioFrame / mAudioFramesPerCompressedPacket;
// |AudioFileStreamSeek| will pass back through |byteOffset| the byte offset
// into the stream it expects next time it reads.
SInt64 byteOffset;
UInt32 flags = 0;
OSStatus rv = AudioFileStreamSeek(mAudioFileStream,
packet,
&byteOffset,
&flags);
if (rv) {
LOGE("Couldn't seek demuxer. Error code %x\n", rv);
return SeekPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
}
LOGD("computed byte offset = %lld; estimated = %s\n",
byteOffset,
(flags & kAudioFileStreamSeekFlag_OffsetIsEstimated) ? "YES" : "NO");
mResource.Seek(nsISeekableStream::NS_SEEK_SET, byteOffset);
ResetDecode();
return SeekPromise::CreateAndResolve(aTime, __func__);
}
void
AppleMP3Reader::NotifyDataArrivedInternal()
{
MOZ_ASSERT(OnTaskQueue());
if (!mMP3FrameParser.NeedsData()) {
return;
}
AutoPinned<MediaResource> resource(mResource.GetResource());
nsTArray<MediaByteRange> byteRanges;
nsresult rv = resource->GetCachedRanges(byteRanges);
if (NS_FAILED(rv)) {
return;
}
IntervalSet<int64_t> intervals;
for (auto& range : byteRanges) {
intervals += mFilter.NotifyDataArrived(range.Length(), range.mStart);
}
for (const auto& interval : intervals) {
RefPtr<MediaByteBuffer> bytes =
resource->MediaReadAt(interval.mStart, interval.Length());
NS_ENSURE_TRUE_VOID(bytes);
mMP3FrameParser.Parse(bytes->Elements(), interval.Length(), interval.mStart);
if (!mMP3FrameParser.IsMP3()) {
return;
}
}
uint64_t duration = mMP3FrameParser.GetDuration();
if (duration != mDuration) {
LOGD("Updating media duration to %lluus\n", duration);
MOZ_ASSERT(mDecoder);
mDuration = duration;
mDecoder->DispatchUpdateEstimatedMediaDuration(duration);
}
}
} // namespace mozilla

View File

@ -1,86 +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/. */
#ifndef __AppleMP3Reader_h__
#define __AppleMP3Reader_h__
#include "MediaDecoderReader.h"
#include "MediaResource.h"
#include "MP3FrameParser.h"
#include "VideoUtils.h"
#include <AudioToolbox/AudioToolbox.h>
namespace mozilla {
class AppleMP3Reader : public MediaDecoderReader
{
public:
explicit AppleMP3Reader(AbstractMediaDecoder *aDecoder);
virtual ~AppleMP3Reader() override;
virtual nsresult Init() override;
nsresult PushDataToDemuxer();
virtual bool DecodeAudioData() override;
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold) override;
virtual nsresult ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags) override;
virtual RefPtr<SeekPromise>
Seek(int64_t aTime, int64_t aEndTime) override;
void AudioSampleCallback(UInt32 aNumBytes,
UInt32 aNumPackets,
const void *aData,
AudioStreamPacketDescription *aPackets);
void AudioMetadataCallback(AudioFileStreamID aFileStream,
AudioFileStreamPropertyID aPropertyID,
UInt32 *aFlags);
protected:
virtual void NotifyDataArrivedInternal() override;
public:
virtual bool IsMediaSeekable() override;
private:
void SetupDecoder();
nsresult Read(uint32_t *aNumBytes, char *aData);
static OSStatus PassthroughInputDataCallback(AudioConverterRef aAudioConverter,
UInt32 *aNumDataPackets,
AudioBufferList *aData,
AudioStreamPacketDescription **aPacketDesc,
void *aUserData);
// Initialisation has to be done in a callback, so we store the result here.
bool mStreamReady;
// Number of audio samples in an audio packet. Constant over all packets in a
// stream.
UInt32 mAudioFramesPerCompressedPacket;
// Store the next audio frame to be played; so we can keep time when seeking.
UInt64 mCurrentAudioFrame;
UInt32 mAudioChannels;
UInt32 mAudioSampleRate;
uint64_t mDuration;
AudioFileStreamID mAudioFileStream;
AudioConverterRef mAudioConverter;
MP3FrameParser mMP3FrameParser;
MediaResourceIndex mResource;
NotifyDataArrivedFilter mFilter;
};
} // namespace mozilla
#endif // __AppleMP3Reader_h__

View File

@ -1,19 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
EXPORTS += [
'AppleDecoder.h',
'AppleMP3Reader.h',
]
UNIFIED_SOURCES += [
'AppleDecoder.cpp',
'AppleMP3Reader.cpp',
]
FINAL_LIBRARY = 'xul'
OS_LIBS += ['-framework AudioToolbox']

View File

@ -58,9 +58,6 @@ if CONFIG['MOZ_ANDROID_OMX']:
if CONFIG['MOZ_FMP4']:
DIRS += ['fmp4']
if CONFIG['MOZ_APPLEMEDIA']:
DIRS += ['apple']
if CONFIG['MOZ_WEBRTC']:
DIRS += ['bridge']
@ -301,6 +298,11 @@ if CONFIG['MOZ_WEBRTC']:
DEFINES['MOZILLA_INTERNAL_API'] = True
if CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['WEBRTC_WIN'] = True
else:
DEFINES['WEBRTC_POSIX'] = True
if CONFIG['MOZ_OMX_DECODER']:
DEFINES['MOZ_OMX_DECODER'] = True

View File

@ -51,12 +51,18 @@ enum BufferState
bool
OMXCodecReservation::ReserveOMXCodec()
{
if (mClient) {
// Already tried reservation.
return false;
if (!mClient) {
mClient = new mozilla::MediaSystemResourceClient(mType);
} else {
if (mOwned) {
//CODEC_ERROR("OMX Reservation: (%d) already owned", (int) mType);
return true;
}
//CODEC_ERROR("OMX Reservation: (%d) already NOT owned", (int) mType);
}
mClient = new mozilla::MediaSystemResourceClient(mType);
return mClient->AcquireSyncNoWait(); // don't wait if resrouce is not available
mOwned = mClient->AcquireSyncNoWait(); // don't wait if resource is not available
//CODEC_ERROR("OMX Reservation: (%d) Acquire was %s", (int) mType, mOwned ? "Successful" : "Failed");
return mOwned;
}
void
@ -65,7 +71,12 @@ OMXCodecReservation::ReleaseOMXCodec()
if (!mClient) {
return;
}
mClient->ReleaseResource();
//CODEC_ERROR("OMX Reservation: Releasing resource: (%d) %s", (int) mType, mOwned ? "Owned" : "Not owned");
if (mOwned) {
mClient->ReleaseResource();
mClient = nullptr;
mOwned = false;
}
}
OMXAudioEncoder*

View File

@ -26,7 +26,7 @@ namespace android {
class OMXCodecReservation : public RefBase
{
public:
OMXCodecReservation(bool aEncoder)
OMXCodecReservation(bool aEncoder) : mOwned(false)
{
mType = aEncoder ? mozilla::MediaSystemResourceType::VIDEO_ENCODER :
mozilla::MediaSystemResourceType::VIDEO_DECODER;
@ -45,6 +45,7 @@ public:
private:
mozilla::MediaSystemResourceType mType;
bool mOwned; // We already own this resource
RefPtr<mozilla::MediaSystemResourceClient> mClient;
};

View File

@ -13,7 +13,7 @@
#include "FFmpegLog.h"
#include "FFmpegDataDecoder.h"
#include "prsystem.h"
#include "FFmpegDecoderModule.h"
#include "FFmpegRuntimeLinker.h"
namespace mozilla
{
@ -89,7 +89,7 @@ FFmpegDataDecoder<LIBAV_VER>::InitDecoder()
// FFmpeg takes this as a suggestion for what format to use for audio samples.
uint32_t major, minor;
FFmpegDecoderModule<LIBAV_VER>::GetVersion(major, minor);
FFmpegRuntimeLinker::GetVersion(major, minor);
// LibAV 0.8 produces rubbish float interlaved samples, request 16 bits audio.
mCodecContext->request_sample_fmt = major == 53 && minor <= 34 ?
AV_SAMPLE_FMT_S16 : AV_SAMPLE_FMT_FLT;

View File

@ -26,15 +26,6 @@ public:
return pdm.forget();
}
static bool
GetVersion(uint32_t& aMajor, uint32_t& aMinor)
{
uint32_t version = avcodec_version();
aMajor = (version >> 16) & 0xff;
aMinor = (version >> 8) & 0xff;
return true;
}
FFmpegDecoderModule() {}
virtual ~FFmpegDecoderModule() {}

View File

@ -16,11 +16,9 @@ AV_FUNC(avcodec_alloc_context3, 0)
AV_FUNC(avcodec_get_edge_width, 0)
AV_FUNC(avcodec_open2, 0)
AV_FUNC(av_init_packet, 0)
AV_FUNC(av_dict_get, 0)
AV_FUNC(av_parser_init, 0)
AV_FUNC(av_parser_close, 0)
AV_FUNC(av_parser_parse2, 0)
AV_FUNC(avcodec_version, 0)
AV_FUNC(avcodec_register_all, 0)
/* libavutil */

View File

@ -4,14 +4,11 @@
* 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 <dlfcn.h>
#include "FFmpegRuntimeLinker.h"
#include "mozilla/ArrayUtils.h"
#include "FFmpegLog.h"
#include "mozilla/Preferences.h"
#define NUM_ELEMENTS(X) (sizeof(X) / sizeof((X)[0]))
#include "prlink.h"
namespace mozilla
{
@ -19,35 +16,33 @@ namespace mozilla
FFmpegRuntimeLinker::LinkStatus FFmpegRuntimeLinker::sLinkStatus =
LinkStatus_INIT;
struct AvCodecLib
{
const char* Name;
already_AddRefed<PlatformDecoderModule> (*Factory)();
uint32_t Version;
};
template <int V> class FFmpegDecoderModule
{
public:
static already_AddRefed<PlatformDecoderModule> Create();
};
static const AvCodecLib sLibs[] = {
{ "libavcodec-ffmpeg.so.56", FFmpegDecoderModule<55>::Create, 55 },
{ "libavcodec.so.56", FFmpegDecoderModule<55>::Create, 55 },
{ "libavcodec.so.55", FFmpegDecoderModule<55>::Create, 55 },
{ "libavcodec.so.54", FFmpegDecoderModule<54>::Create, 54 },
{ "libavcodec.so.53", FFmpegDecoderModule<53>::Create, 53 },
{ "libavcodec.56.dylib", FFmpegDecoderModule<55>::Create, 55 },
{ "libavcodec.55.dylib", FFmpegDecoderModule<55>::Create, 55 },
{ "libavcodec.54.dylib", FFmpegDecoderModule<54>::Create, 54 },
{ "libavcodec.53.dylib", FFmpegDecoderModule<53>::Create, 53 },
static const char* sLibs[] = {
#if defined(XP_DARWIN)
"libavcodec.56.dylib",
"libavcodec.55.dylib",
"libavcodec.54.dylib",
"libavcodec.53.dylib",
#else
"libavcodec-ffmpeg.so.56",
"libavcodec.so.56",
"libavcodec.so.55",
"libavcodec.so.54",
"libavcodec.so.53",
#endif
};
void* FFmpegRuntimeLinker::sLinkedLib = nullptr;
const AvCodecLib* FFmpegRuntimeLinker::sLib = nullptr;
PRLibrary* FFmpegRuntimeLinker::sLinkedLib = nullptr;
const char* FFmpegRuntimeLinker::sLib = nullptr;
static unsigned (*avcodec_version)() = nullptr;
#define AV_FUNC(func, ver) void (*func)();
#define LIBAVCODEC_ALLVERSION
#include "FFmpegFunctionList.h"
#undef LIBAVCODEC_ALLVERSION
@ -63,10 +58,13 @@ FFmpegRuntimeLinker::Link()
MOZ_ASSERT(NS_IsMainThread());
for (size_t i = 0; i < ArrayLength(sLibs); i++) {
const AvCodecLib* lib = &sLibs[i];
sLinkedLib = dlopen(lib->Name, RTLD_NOW | RTLD_LOCAL);
const char* lib = sLibs[i];
PRLibSpec lspec;
lspec.type = PR_LibSpec_Pathname;
lspec.value.pathname = lib;
sLinkedLib = PR_LoadLibraryWithFlags(lspec, PR_LD_NOW | PR_LD_LOCAL);
if (sLinkedLib) {
if (Bind(lib->Name, lib->Version)) {
if (Bind(lib)) {
sLib = lib;
sLinkStatus = LinkStatus_SUCCEEDED;
return true;
@ -78,7 +76,7 @@ FFmpegRuntimeLinker::Link()
FFMPEG_LOG("H264/AAC codecs unsupported without [");
for (size_t i = 0; i < ArrayLength(sLibs); i++) {
FFMPEG_LOG("%s %s", i ? "," : "", sLibs[i].Name);
FFMPEG_LOG("%s %s", i ? "," : "", sLibs[i]);
}
FFMPEG_LOG(" ]\n");
@ -89,12 +87,23 @@ FFmpegRuntimeLinker::Link()
}
/* static */ bool
FFmpegRuntimeLinker::Bind(const char* aLibName, uint32_t Version)
FFmpegRuntimeLinker::Bind(const char* aLibName)
{
avcodec_version = (typeof(avcodec_version))PR_FindSymbol(sLinkedLib,
"avcodec_version");
uint32_t major, minor;
if (!GetVersion(major, minor)) {
return false;
}
if (major > 55) {
// All major greater than 56 currently use the same ABI as 55.
major = 55;
}
#define LIBAVCODEC_ALLVERSION
#define AV_FUNC(func, ver) \
if (ver == 0 || ver == Version) { \
if (!(func = (typeof(func))dlsym(sLinkedLib, #func))) { \
if (ver == 0 || ver == major) { \
if (!(func = (typeof(func))PR_FindSymbol(sLinkedLib, #func))) { \
FFMPEG_LOG("Couldn't load function " #func " from %s.", aLibName); \
return false; \
} \
@ -111,7 +120,17 @@ FFmpegRuntimeLinker::CreateDecoderModule()
if (!Link()) {
return nullptr;
}
RefPtr<PlatformDecoderModule> module = sLib->Factory();
uint32_t major, minor;
if (!GetVersion(major, minor)) {
return nullptr;
}
RefPtr<PlatformDecoderModule> module;
switch (major) {
case 53: module = FFmpegDecoderModule<53>::Create(); break;
case 54: module = FFmpegDecoderModule<54>::Create(); break;
default: module = FFmpegDecoderModule<55>::Create(); break;
}
return module.forget();
}
@ -119,11 +138,24 @@ FFmpegRuntimeLinker::CreateDecoderModule()
FFmpegRuntimeLinker::Unlink()
{
if (sLinkedLib) {
dlclose(sLinkedLib);
PR_UnloadLibrary(sLinkedLib);
sLinkedLib = nullptr;
sLib = nullptr;
sLinkStatus = LinkStatus_INIT;
avcodec_version = nullptr;
}
}
/* static */ bool
FFmpegRuntimeLinker::GetVersion(uint32_t& aMajor, uint32_t& aMinor)
{
if (!avcodec_version) {
return false;
}
uint32_t version = avcodec_version();
aMajor = (version >> 16) & 0xff;
aMinor = (version >> 8) & 0xff;
return true;
}
} // namespace mozilla

View File

@ -10,23 +10,24 @@
#include "PlatformDecoderModule.h"
#include <stdint.h>
struct PRLibrary;
namespace mozilla
{
struct AvCodecLib;
class FFmpegRuntimeLinker
{
public:
static bool Link();
static void Unlink();
static already_AddRefed<PlatformDecoderModule> CreateDecoderModule();
static bool GetVersion(uint32_t& aMajor, uint32_t& aMinor);
private:
static void* sLinkedLib;
static const AvCodecLib* sLib;
static PRLibrary* sLinkedLib;
static const char* sLib;
static bool Bind(const char* aLibName, uint32_t Version);
static bool Bind(const char* aLibName);
static enum LinkStatus {
LinkStatus_INIT = 0,

View File

@ -647,7 +647,7 @@ bool
CamerasChild::RecvDeliverFrame(const int& capEngine,
const int& capId,
mozilla::ipc::Shmem&& shmem,
const int& size,
const size_t& size,
const uint32_t& time_stamp,
const int64_t& ntp_time,
const int64_t& render_time)

View File

@ -85,7 +85,7 @@ public:
// IPC messages recevied, received on the PBackground thread
// these are the actual callbacks with data
virtual bool RecvDeliverFrame(const int&, const int&, mozilla::ipc::Shmem&&,
const int&, const uint32_t&, const int64_t&,
const size_t&, const uint32_t&, const int64_t&,
const int64_t&) override;
virtual bool RecvFrameSizeChange(const int&, const int&,
const int& w, const int& h) override;
@ -159,9 +159,9 @@ private:
Mutex mRequestMutex;
// Hold to wait for an async response to our calls
Monitor mReplyMonitor;
// Async resposne valid?
// Async response valid?
bool mReceivedReply;
// Aynsc reponses data contents;
// Async responses data contents;
bool mReplySuccess;
int mReplyInteger;
webrtc::CaptureCapability mReplyCapability;

Some files were not shown because too many files have changed in this diff Show More