This commit is contained in:
Ryan VanderMeulen 2015-07-29 13:55:46 -04:00
Родитель d94d3f12b3 0cdb86e630
Коммит e61fe71db0
232 изменённых файлов: 4107 добавлений и 1800 удалений

Просмотреть файл

@ -19,6 +19,8 @@ DocAccessibleParent::RecvShowEvent(const ShowEventData& aData)
if (mShutdown)
return true;
CheckDocTree();
if (aData.NewTree().IsEmpty()) {
NS_ERROR("no children being added");
return false;
@ -48,6 +50,8 @@ DocAccessibleParent::RecvShowEvent(const ShowEventData& aData)
}
#endif
CheckDocTree();
return true;
}
@ -118,6 +122,8 @@ DocAccessibleParent::RecvHideEvent(const uint64_t& aRootID)
parent->RemoveChild(root);
root->Shutdown();
CheckDocTree();
return true;
}
@ -190,9 +196,12 @@ DocAccessibleParent::RecvBindChildDoc(PDocAccessibleParent* aChildDoc, const uin
if (!aID)
return false;
CheckDocTree();
auto childDoc = static_cast<DocAccessibleParent*>(aChildDoc);
bool result = AddChildDoc(childDoc, aID, false);
MOZ_ASSERT(result);
CheckDocTree();
return result;
}

Просмотреть файл

@ -627,9 +627,7 @@ pref("app.update.socket.maxErrors", 20);
pref("app.update.log", true);
// SystemUpdate API
#ifdef MOZ_WIDGET_GONK
pref("dom.system_update.active", "@mozilla.org/updates/update-prompt;1");
#endif
#else
// Explicitly disable the shutdown watchdog. It's enabled by default.
// When the updater is disabled, we want to know about shutdown hangs.

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="21256d7665f972255d198f8af81a8df4bd0e0fc4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="21256d7665f972255d198f8af81a8df4bd0e0fc4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -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="21256d7665f972255d198f8af81a8df4bd0e0fc4"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="8bc59310552179f9a8bc6cdd0188e2475df52fb7"/>

Просмотреть файл

@ -17,7 +17,7 @@
</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="21256d7665f972255d198f8af81a8df4bd0e0fc4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5bb657ada461be666c35f419dbe072ed2ce632fc"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="21256d7665f972255d198f8af81a8df4bd0e0fc4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="07c383a786f188904311a37f6062c2cb84c9b61d">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="21256d7665f972255d198f8af81a8df4bd0e0fc4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -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="21256d7665f972255d198f8af81a8df4bd0e0fc4"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="8bc59310552179f9a8bc6cdd0188e2475df52fb7"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="21256d7665f972255d198f8af81a8df4bd0e0fc4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "21256d7665f972255d198f8af81a8df4bd0e0fc4",
"git_revision": "088f350b39baf8f86c7c1161fd4be178ce822b7b",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "5ec7add1a5ed54e7c57e9fd24704624a9e84139a",
"revision": "97666dae0fe5da2a0da4f57f41fcb12e9c2fe709",
"repo_path": "integration/gaia-central"
}

Просмотреть файл

@ -17,7 +17,7 @@
</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="21256d7665f972255d198f8af81a8df4bd0e0fc4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5bb657ada461be666c35f419dbe072ed2ce632fc"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="07c383a786f188904311a37f6062c2cb84c9b61d">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="21256d7665f972255d198f8af81a8df4bd0e0fc4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -709,9 +709,13 @@
@RESPATH@/components/nsUrlClassifierHashCompleter.js
@RESPATH@/components/nsUrlClassifierListManager.js
@RESPATH@/components/nsUrlClassifierLib.js
@RESPATH@/components/PrivateBrowsingTrackingProtectionWhitelist.js
@RESPATH@/components/url-classifier.xpt
; Private Browsing
@RESPATH@/components/privatebrowsing.xpt
@RESPATH@/components/PrivateBrowsing.manifest
@RESPATH@/components/PrivateBrowsingTrackingProtectionWhitelist.js
; GNOME hooks
#ifdef MOZ_ENABLE_GNOME_COMPONENT
@RESPATH@/components/@DLL_PREFIX@mozgnome@DLL_SUFFIX@

Просмотреть файл

@ -2,6 +2,9 @@ ac_add_options --with-google-oauth-api-keyfile=/builds/google-oauth-api.key
. $topsrcdir/build/unix/mozconfig.tsan
export PKG_CONFIG_LIBDIR=/usr/lib64/pkgconfig:/usr/share/pkgconfig
. $topsrcdir/build/unix/mozconfig.gtk
# Need this to prevent name conflicts with the normal nightly build packages
export MOZ_PKG_SPECIAL=tsan

Просмотреть файл

@ -8,5 +8,12 @@
"algorithm": "sha512",
"filename": "clang.tar.bz2",
"unpack": true
},
{
"size": 4431740,
"digest": "68fc56b0fb0cdba629b95683d6649ff76b00dccf97af90960c3d7716f6108b2162ffd5ffcd5c3a60a21b28674df688fe4dabc67345e2da35ec5abeae3d48c8e3",
"algorithm": "sha512",
"filename": "gtk3.tar.xz",
"unpack": true
}
]

Просмотреть файл

@ -0,0 +1,34 @@
[
{
"clang_version": "r183744"
},
{
"size": 70350828,
"digest": "6cd04e8ec44c6fef159349c22bd0476891e4a2d46479f9586283eaf3305e42f79c720d40dfec0e78d8899c1651189b12e285de60862ffd0612b0dac7a0c336c6",
"algorithm": "sha512",
"unpack": true,
"filename": "clang.tar.bz2"
},
{
"size": 2581027,
"digest": "9b59abef2bd4ae3a5b792de96e1336d879c1c5b6b07382797ae1bcc299e74ddf805bc95b7bc813cf3b4586db5eb4d0f41d09b2f85f0629cf27e57a4de851129c",
"algorithm": "sha512",
"unpack": true,
"filename": "cctools.tar.gz"
},
{
"size": 35215976,
"visibility": "internal",
"digest": "8be736545ddab25ebded188458ce974d5c9a7e29f3c50d2ebfbcb878f6aff853dd2ff5a3528bdefc64396a10101a1b50fd2fe52000140df33643cebe1ea759da",
"algorithm": "sha512",
"unpack": true,
"filename": "MacOSX10.7.sdk.tar.bz2"
},
{
"size": 167175,
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
"algorithm": "sha512",
"unpack": true,
"filename": "sccache.tar.bz2"
}
]

Просмотреть файл

@ -42,7 +42,6 @@ const TESTS = [
file: "test-bug-595934-workers.html",
category: "Web Worker",
matchString: "fooBarWorker",
expectError: true,
},
{
// #4

Просмотреть файл

@ -638,10 +638,14 @@
@RESPATH@/components/nsUrlClassifierHashCompleter.js
@RESPATH@/components/nsUrlClassifierListManager.js
@RESPATH@/components/nsUrlClassifierLib.js
@RESPATH@/components/PrivateBrowsingTrackingProtectionWhitelist.js
@RESPATH@/components/url-classifier.xpt
#endif
; Private Browsing
@RESPATH@/components/privatebrowsing.xpt
@RESPATH@/components/PrivateBrowsing.manifest
@RESPATH@/components/PrivateBrowsingTrackingProtectionWhitelist.js
; ANGLE GLES-on-D3D rendering library
#ifdef MOZ_ANGLE_RENDERER
@BINPATH@/libEGL.dll

Просмотреть файл

@ -173,59 +173,59 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
ICU_CROSS_BUILD_OPT=""
if test "$CROSS_COMPILE"; then
# Remove _DEPEND_CFLAGS from HOST_FLAGS to avoid configure error
HOST_ICU_CFLAGS="$HOST_CFLAGS"
HOST_ICU_CXXFLAGS="$HOST_CXXFLAGS"
# Remove _DEPEND_CFLAGS from HOST_FLAGS to avoid configure error
HOST_ICU_CFLAGS="$HOST_CFLAGS"
HOST_ICU_CXXFLAGS="$HOST_CXXFLAGS"
HOST_ICU_CFLAGS=`echo $HOST_ICU_CFLAGS | sed "s|$_DEPEND_CFLAGS||g"`
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CFXXLAGS | sed "s|$_DEPEND_CFLAGS||g"`
HOST_ICU_CFLAGS=`echo $HOST_ICU_CFLAGS | sed "s|$_DEPEND_CFLAGS||g"`
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CFXXLAGS | sed "s|$_DEPEND_CFLAGS||g"`
# ICU requires RTTI
if test "$GNU_CC"; then
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
elif test "$_MSC_VER"; then
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
fi
# ICU requires RTTI
if test "$GNU_CC"; then
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
elif test "$_MSC_VER"; then
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
fi
HOST_ICU_BUILD_OPTS=""
if test -n "$MOZ_DEBUG"; then
HOST_ICU_BUILD_OPTS="$HOST_ICU_BUILD_OPTS --enable-debug"
fi
HOST_ICU_BUILD_OPTS=""
if test -n "$MOZ_DEBUG"; then
HOST_ICU_BUILD_OPTS="$HOST_ICU_BUILD_OPTS --enable-debug"
fi
abs_srcdir=`(cd $srcdir; pwd)`
mkdir -p $_objdir/intl/icu/host
(export AR="$HOST_AR"
export RANLIB="$HOST_RANLIB"
export CC="$HOST_CC"
export CXX="$HOST_CXX"
export CPP="$HOST_CPP"
export LD="$HOST_LD"
export CFLAGS="$HOST_ICU_CFLAGS $HOST_OPTIMIZE_FLAGS"
export CPPFLAGS="$ICU_CPPFLAGS"
export CXXFLAGS="$HOST_ICU_CXXFLAGS $HOST_OPTIMIZE_FLAGS"
export LDFLAGS="$HOST_LDFLAGS"
ac_configure_args="$HOST_ICU_BUILD_OPTS"
ac_configure_args="$ac_configure_args --enable-static --disable-shared --enable-extras=no --enable-icuio=no --enable-layout=no --enable-tests=no --enable-samples=no"
AC_OUTPUT_SUBDIRS_NOW(intl/icu/source:intl/icu/host)
) || exit 1
# generate config/icucross.mk
$GMAKE -C $_objdir/intl/icu/host/ config/icucross.mk
abs_srcdir=`(cd $srcdir; pwd)`
mkdir -p $_objdir/intl/icu/host
(export AR="$HOST_AR"
export RANLIB="$HOST_RANLIB"
export CC="$HOST_CC"
export CXX="$HOST_CXX"
export CPP="$HOST_CPP"
export LD="$HOST_LD"
export CFLAGS="$HOST_ICU_CFLAGS $HOST_OPTIMIZE_FLAGS"
export CPPFLAGS="$ICU_CPPFLAGS"
export CXXFLAGS="$HOST_ICU_CXXFLAGS $HOST_OPTIMIZE_FLAGS"
export LDFLAGS="$HOST_LDFLAGS"
ac_configure_args="$HOST_ICU_BUILD_OPTS"
ac_configure_args="$ac_configure_args --enable-static --disable-shared --enable-extras=no --enable-icuio=no --enable-layout=no --enable-tests=no --enable-samples=no"
AC_OUTPUT_SUBDIRS_NOW(intl/icu/source:intl/icu/host)
) || exit 1
# generate config/icucross.mk
$GMAKE -C $_objdir/intl/icu/host/ config/icucross.mk
# --with-cross-build requires absolute path
ICU_HOST_PATH=`cd $_objdir/intl/icu/host && pwd`
ICU_CROSS_BUILD_OPT="--with-cross-build=$ICU_HOST_PATH --disable-tools"
ICU_TARGET_OPT="--build=$build --host=$target"
# --with-cross-build requires absolute path
ICU_HOST_PATH=`cd $_objdir/intl/icu/host && pwd`
ICU_CROSS_BUILD_OPT="--with-cross-build=$ICU_HOST_PATH --disable-tools"
ICU_TARGET_OPT="--build=$build --host=$target"
else
# CROSS_COMPILE isn't set build and target are i386 and x86-64.
# So we must set target for --build and --host.
ICU_TARGET_OPT="--build=$target --host=$target"
# CROSS_COMPILE isn't set build and target are i386 and x86-64.
# So we must set target for --build and --host.
ICU_TARGET_OPT="--build=$target --host=$target"
fi
if test -z "$MOZ_SHARED_ICU"; then
# To reduce library size, use static linking
ICU_LINK_OPTS="--enable-static --disable-shared"
# To reduce library size, use static linking
ICU_LINK_OPTS="--enable-static --disable-shared"
else
ICU_LINK_OPTS="--disable-static --enable-shared"
ICU_LINK_OPTS="--disable-static --enable-shared"
fi
# Force the ICU static libraries to be position independent code
ICU_CFLAGS="$DSO_PIC_CFLAGS $CFLAGS"
@ -233,64 +233,64 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
ICU_BUILD_OPTS=""
if test -n "$MOZ_DEBUG" -o "MOZ_DEBUG_SYMBOLS"; then
ICU_CFLAGS="$ICU_CFLAGS $MOZ_DEBUG_FLAGS"
ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_DEBUG_FLAGS"
if test -n "$CROSS_COMPILE" -a "$OS_TARGET" = "Darwin" \
-a "$HOST_OS_ARCH" != "Darwin"
then
# Bug 951758: Cross-OSX builds with non-Darwin hosts have issues
# with -g and friends (like -gdwarf and -gfull) because they try
# to run dsymutil
changequote(,)
ICU_CFLAGS=`echo $ICU_CFLAGS | sed 's|-g[^ \t]*||g'`
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-g[^ \t]*||g'`
changequote([,])
fi
ICU_CFLAGS="$ICU_CFLAGS $MOZ_DEBUG_FLAGS"
ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_DEBUG_FLAGS"
if test -n "$CROSS_COMPILE" -a "$OS_TARGET" = "Darwin" \
-a "$HOST_OS_ARCH" != "Darwin"
then
# Bug 951758: Cross-OSX builds with non-Darwin hosts have issues
# with -g and friends (like -gdwarf and -gfull) because they try
# to run dsymutil
changequote(,)
ICU_CFLAGS=`echo $ICU_CFLAGS | sed 's|-g[^ \t]*||g'`
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-g[^ \t]*||g'`
changequote([,])
fi
ICU_LDFLAGS="$MOZ_DEBUG_LDFLAGS"
if test -z "$MOZ_DEBUG"; then
# To generate debug symbols, it requires MOZ_DEBUG_FLAGS.
# But, not debug build.
ICU_CFLAGS="$ICU_CFLAGS -UDEBUG -DNDEBUG"
ICU_CXXFLAGS="$ICU_CXXFLAGS -UDEBUG -DNDEBUG"
elif test -z "$MOZ_NO_DEBUG_RTL"; then
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --enable-debug"
fi
ICU_LDFLAGS="$MOZ_DEBUG_LDFLAGS"
if test -z "$MOZ_DEBUG"; then
# To generate debug symbols, it requires MOZ_DEBUG_FLAGS.
# But, not debug build.
ICU_CFLAGS="$ICU_CFLAGS -UDEBUG -DNDEBUG"
ICU_CXXFLAGS="$ICU_CXXFLAGS -UDEBUG -DNDEBUG"
elif test -z "$MOZ_NO_DEBUG_RTL"; then
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --enable-debug"
fi
fi
if test -z "$MOZ_OPTIMIZE"; then
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --disable-release"
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --disable-release"
else
ICU_CFLAGS="$ICU_CFLAGS $MOZ_OPTIMIZE_FLAGS"
ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_OPTIMIZE_FLAGS"
ICU_CFLAGS="$ICU_CFLAGS $MOZ_OPTIMIZE_FLAGS"
ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_OPTIMIZE_FLAGS"
fi
if test "$am_cv_langinfo_codeset" = "no"; then
# ex. Android
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_HAVE_NL_LANGINFO_CODESET=0"
# ex. Android
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_HAVE_NL_LANGINFO_CODESET=0"
fi
# ICU requires RTTI
if test "$GNU_CC"; then
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
else
if test "$_MSC_VER"; then
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
fi
if test "$_MSC_VER"; then
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
fi
# Add RTL flags for MSVCRT.DLL
if test -n "$MOZ_DEBUG" -a -z "$MOZ_NO_DEBUG_RTL"; then
ICU_CFLAGS="$ICU_CFLAGS -MDd"
ICU_CXXFLAGS="$ICU_CXXFLAGS -MDd"
else
ICU_CFLAGS="$ICU_CFLAGS -MD"
ICU_CXXFLAGS="$ICU_CXXFLAGS -MD"
fi
# Add RTL flags for MSVCRT.DLL
if test -n "$MOZ_DEBUG" -a -z "$MOZ_NO_DEBUG_RTL"; then
ICU_CFLAGS="$ICU_CFLAGS -MDd"
ICU_CXXFLAGS="$ICU_CXXFLAGS -MDd"
else
ICU_CFLAGS="$ICU_CFLAGS -MD"
ICU_CXXFLAGS="$ICU_CXXFLAGS -MD"
fi
# add disable optimize flag for workaround for bug 899948
if test -z "$MOZ_OPTIMIZE"; then
ICU_CFLAGS="$ICU_CFLAGS -Od"
ICU_CXXFLAGS="$ICU_CXXFLAGS -Od"
fi
# add disable optimize flag for workaround for bug 899948
if test -z "$MOZ_OPTIMIZE"; then
ICU_CFLAGS="$ICU_CFLAGS -Od"
ICU_CXXFLAGS="$ICU_CXXFLAGS -Od"
fi
fi
if test -n "$gonkdir"; then

Просмотреть файл

@ -0,0 +1,50 @@
# 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/.
MOZ_AUTOMATION_L10N_CHECK=0
#TODO: bug 935237 - fix packaging
MOZ_AUTOMATION_PACKAGE=0
#TODO: bug 543111 - fix Breakpad
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
if [ "x$IS_NIGHTLY" = "xyes" ]; then
# Some nightlies (eg: Mulet) don't want these set.
MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-1}
MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
fi
. "$topsrcdir/build/mozconfig.common"
#TODO: bug 543111 - fix Breakpad
ac_add_options --disable-crashreporter
# ld needs libLTO.so from llvm
mk_add_options "export LD_LIBRARY_PATH=$topsrcdir/clang/lib"
CROSS_CCTOOLS_PATH=$topsrcdir/cctools
CROSS_SYSROOT=$topsrcdir/MacOSX10.7.sdk
CROSS_PRIVATE_FRAMEWORKS=$CROSS_SYSROOT/System/Library/PrivateFrameworks
FLAGS="-target x86_64-apple-darwin10 -mlinker-version=136 -B $CROSS_CCTOOLS_PATH/bin -isysroot $CROSS_SYSROOT"
export CC="$topsrcdir/clang/bin/clang $FLAGS"
export CXX="$topsrcdir/clang/bin/clang++ $FLAGS"
export CPP="$topsrcdir/clang/bin/clang $FLAGS -E"
export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config
export LDFLAGS="-Wl,-syslibroot,$CROSS_SYSROOT -Wl,-dead_strip"
export TOOLCHAIN_PREFIX=$CROSS_CCTOOLS_PATH/bin/x86_64-apple-darwin10-
#TODO: bug 1184202 - would be nice if these could be detected with TOOLCHAIN_PREFIX automatically
export AR=${TOOLCHAIN_PREFIX}ar
export RANLIB=${TOOLCHAIN_PREFIX}ranlib
export STRIP=${TOOLCHAIN_PREFIX}strip
export OTOOL=${TOOLCHAIN_PREFIX}otool
export HOST_CC=gcc
export HOST_CXX=g++
export HOST_LDFLAGS="-g"
ac_add_options --target=x86_64-apple-darwin
ac_add_options --with-macos-private-frameworks=$CROSS_PRIVATE_FRAMEWORKS
. "$topsrcdir/build/mozconfig.cache"
export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token

Просмотреть файл

@ -0,0 +1,37 @@
# 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/.
MOZ_AUTOMATION_L10N_CHECK=0
if [ "x$IS_NIGHTLY" = "xyes" ]; then
# Some nightlies (eg: Mulet) don't want these set.
MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-1}
MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
fi
. "$topsrcdir/build/mozconfig.common"
if [ -d "$topsrcdir/clang" ]; then
# mozilla-central based build
export CC=$topsrcdir/clang/bin/clang
export CXX=$topsrcdir/clang/bin/clang++
export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config
elif [ -d "$topsrcdir/../clang" ]; then
# comm-central based build
export CC=$topsrcdir/../clang/bin/clang
export CXX=$topsrcdir/../clang/bin/clang++
export LLVMCONFIG=$topsrcdir/../clang/bin/llvm-config
fi
# If not set use the system default clang
if [ -z "$CC" ]; then
export CC=clang
fi
# If not set use the system default clang++
if [ -z "$CXX" ]; then
export CXX=clang++
fi
export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token

Просмотреть файл

@ -1,37 +1,5 @@
# 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/.
MOZ_AUTOMATION_L10N_CHECK=0
if [ "x$IS_NIGHTLY" = "xyes" ]; then
# Some nightlies (eg: Mulet) don't want these set.
MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-1}
MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
if test `uname -s` = Linux; then
. $topsrcdir/build/macosx/cross-mozconfig.common
else
. $topsrcdir/build/macosx/local-mozconfig.common
fi
. "$topsrcdir/build/mozconfig.common"
if [ -d "$topsrcdir/clang" ]; then
# mozilla-central based build
export CC=$topsrcdir/clang/bin/clang
export CXX=$topsrcdir/clang/bin/clang++
export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config
elif [ -d "$topsrcdir/../clang" ]; then
# comm-central based build
export CC=$topsrcdir/../clang/bin/clang
export CXX=$topsrcdir/../clang/bin/clang++
export LLVMCONFIG=$topsrcdir/../clang/bin/llvm-config
fi
# If not set use the system default clang
if [ -z "$CC" ]; then
export CC=clang
fi
# If not set use the system default clang++
if [ -z "$CXX" ]; then
export CXX=clang++
fi
export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token

Просмотреть файл

@ -761,16 +761,6 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
// the methods that work on chains of nested URIs and they will only look
// at the flags for our one URI.
// Special case: moz-extension has a whitelist of URIs that are loadable by
// anyone.
if (targetScheme.EqualsLiteral("moz-extension") && GetAddonPolicyService()) {
bool loadable = false;
rv = GetAddonPolicyService()->ExtensionURILoadableByAnyone(targetBaseURI, &loadable);
if (NS_SUCCEEDED(rv) && loadable) {
return NS_OK;
}
}
// Check for system target URI
rv = DenyAccessIfURIHasFlags(targetBaseURI,
nsIProtocolHandler::URI_DANGEROUS_TO_LOAD);

Просмотреть файл

@ -89,10 +89,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1161831
ifr.onload = function() {
ok(true, 'Loaded ' + url);
var prin = SpecialPowers.wrap(ifr.contentWindow).document.nodePrincipal;
is(prin.originNoSuffix, url, 'Principal origin is correct: ' + url);
function stripTrailingSlash(s) { return s.replace(/\/$/, ''); };
is(stripTrailingSlash(prin.URI.spec), url, 'Principal uri is correct: ' + url);
function stripPath(s) { return s.replace(/(.*\/\/.+)\/.*/, '$1'); };
is(prin.originNoSuffix, stripPath(url), 'Principal origin is correct: ' + prin.originNoSuffix);
is(prin.originAttributes.addonId, 'imaginaryaddon-' + url[url.indexOf('/') + 2], 'addonId is correct');
is(SpecialPowers.wrap(ifr.contentWindow).document.title, 'resource test file',
'document looks right');
if (/_blank/.test(url)) {
is(SpecialPowers.wrap(ifr.contentWindow).document.documentElement.innerHTML,
'<head></head><body></body>', 'blank document looks right');
} else {
is(SpecialPowers.wrap(ifr.contentWindow).document.title, 'resource test file',
'document looks right');
}
ifr.remove();
resolve();
};
@ -104,7 +112,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1161831
} catch (e) {
ifr.remove();
threw = true;
ok(/denied|insecure/.test(e), "exceiton correct: " + e);
ok(/denied|insecure/.test(e), "exception correct: " + e);
}
is(threw, !!shouldThrow, "Correct throwing behavior for: " + url);
!threw || resolve();
@ -126,6 +134,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1161831
.then(testLoad.bind(null, 'moz-extension://liebchen', navigateWithLocation))
.then(testLoad.bind(null, 'moz-extension://liebchen', navigateWithSrc))
.then(testLoad.bind(null, 'moz-extension://cherise', navigateWithSrc))
.then(testLoad.bind(null, 'moz-extension://cherise/_blank.html', navigateWithSrc))
.then(SimpleTest.finish.bind(SimpleTest),
function(e) { ok(false, "rejected promise: " + e); SimpleTest.finish() }
);

Просмотреть файл

@ -4345,10 +4345,7 @@ cairo-cocoa)
CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
MOZ_USER_DIR="Mozilla"
MOZ_FS_LAYOUT=bundle
# skip event loop instrumentation on UIKit for now
if test "$MOZ_WIDGET_TOOLKIT" == "cocoa"; then
MOZ_INSTRUMENT_EVENT_LOOP=1
fi
MOZ_INSTRUMENT_EVENT_LOOP=1
;;
cairo-uikit)
@ -9216,22 +9213,6 @@ if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
MOZ_SUBCONFIGURE_FFI()
fi
# Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
# "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
# Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
# the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
# (apparently) only need this hack when egrep's "pattern" is particularly long
# (as in the following code) and the first egrep on our $PATH is Apple's. See
# bug 655339.
case "$host" in
*-apple-darwin11*)
FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
;;
*)
FIXED_EGREP="egrep"
;;
esac
# Run jemalloc configure script
if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then

Просмотреть файл

@ -5,7 +5,7 @@
"use strict";
/* static functions */
const DEBUG = false;
const DEBUG = true;
function debug(aStr) {
DEBUG && dump("AlarmService: " + aStr + "\n");

Просмотреть файл

@ -98,7 +98,7 @@ public:
virtual const nsTArray<nsRefPtr<BlobImpl>>* GetSubBlobImpls() const override
{
return &mBlobImpls;
return mBlobImpls.Length() ? &mBlobImpls : nullptr;
}
virtual void GetMozFullPathInternal(nsAString& aFullPath,

Просмотреть файл

@ -3475,17 +3475,16 @@ nsPIDOMWindow::SetFrameElementInternal(Element* aFrameElement)
mOuterWindow->SetFrameElementInternal(aFrameElement);
}
void
bool
nsPIDOMWindow::AddAudioContext(AudioContext* aAudioContext)
{
MOZ_ASSERT(IsInnerWindow());
mAudioContexts.AppendElement(aAudioContext);
// Return true if the context should be muted and false if not.
nsIDocShell* docShell = GetDocShell();
if (docShell && !docShell->GetAllowMedia() && !aAudioContext->IsOffline()) {
aAudioContext->Mute();
}
return docShell && !docShell->GetAllowMedia() && !aAudioContext->IsOffline();
}
void

Просмотреть файл

@ -718,7 +718,7 @@ public:
const nsAString& aPopupWindowFeatures) = 0;
// Inner windows only.
void AddAudioContext(mozilla::dom::AudioContext* aAudioContext);
bool AddAudioContext(mozilla::dom::AudioContext* aAudioContext);
void RemoveAudioContext(mozilla::dom::AudioContext* aAudioContext);
void MuteAudioContexts();
void UnmuteAudioContexts();

Просмотреть файл

@ -745,13 +745,7 @@ nsPerformance::InsertUserEntry(PerformanceEntry* aEntry)
// If we have no URI, just put in "none".
uri.AssignLiteral("none");
}
PERFLOG("Performance Entry: %s|%s|%s|%f|%f|%" PRIu64 "\n",
uri.get(),
NS_ConvertUTF16toUTF8(aEntry->GetEntryType()).get(),
NS_ConvertUTF16toUTF8(aEntry->GetName()).get(),
aEntry->StartTime(),
aEntry->Duration(),
static_cast<uint64_t>(PR_Now() / PR_USEC_PER_MSEC));
PerformanceBase::LogEntry(aEntry, uri);
}
PerformanceBase::InsertUserEntry(aEntry);
@ -980,6 +974,18 @@ PerformanceBase::ClearMeasures(const Optional<nsAString>& aName)
ClearUserEntries(aName, NS_LITERAL_STRING("measure"));
}
void
PerformanceBase::LogEntry(PerformanceEntry* aEntry, const nsACString& aOwner) const
{
PERFLOG("Performance Entry: %s|%s|%s|%f|%f|%" PRIu64 "\n",
aOwner.BeginReading(),
NS_ConvertUTF16toUTF8(aEntry->GetEntryType()).get(),
NS_ConvertUTF16toUTF8(aEntry->GetName()).get(),
aEntry->StartTime(),
aEntry->Duration(),
static_cast<uint64_t>(PR_Now() / PR_USEC_PER_MSEC));
}
void
PerformanceBase::InsertUserEntry(PerformanceEntry* aEntry)
{

Просмотреть файл

@ -350,6 +350,8 @@ protected:
return mResourceEntries.Length() >= mResourceTimingBufferSize;
}
void LogEntry(PerformanceEntry* aEntry, const nsACString& aOwner) const;
private:
nsTArray<nsRefPtr<PerformanceEntry>> mUserEntries;
nsTArray<nsRefPtr<PerformanceEntry>> mResourceEntries;

Просмотреть файл

@ -101,8 +101,8 @@ DebugWrapperTraceCallback(JS::GCCellPtr aPtr, const char* aName, void* aClosure)
{
DebugWrapperTraversalCallback* callback =
static_cast<DebugWrapperTraversalCallback*>(aClosure);
if (aPtr.isObject()) {
callback->NoteJSObject(aPtr.toObject());
if (aPtr.is<JSObject>()) {
callback->NoteJSObject(&aPtr.as<JSObject>());
}
}

Просмотреть файл

@ -322,8 +322,10 @@ private:
nsScriptObjectTracer* aTracer);
#ifdef DEBUG
public:
void CheckCCWrapperTraversal(void* aScriptObjectHolder,
nsScriptObjectTracer* aTracer);
private:
#endif // DEBUG
/**

Просмотреть файл

@ -0,0 +1,21 @@
<!DOCTYPE html>
<embed type="application/x-test" width="200" height="200"></embed>
<script>
var plugin = document.querySelector("embed");
onload = function() {
plugin.startAudioPlayback();
};
function stopAudio() {
plugin.stopAudioPlayback();
}
function pluginMuted() {
return plugin.audioMuted();
}
function toggleMuteState(muted) {
var Ci = SpecialPowers.Ci;
var utils = SpecialPowers.wrap(window).top
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
utils.audioMuted = muted;
}
</script>

Просмотреть файл

@ -240,6 +240,7 @@ support-files =
file_audioLoop.html
file_webaudioLoop.html
file_webaudioLoop2.html
file_pluginAudio.html
referrer_helper.js
referrer_testserver.sjs
script_postmessages_fileList.js
@ -301,6 +302,8 @@ skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e1
[test_open_null_features.html]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Fails on b2g-desktop, tracked in bug 1011874
[test_postMessage_solidus.html]
[test_pluginAudioNotification.html]
skip-if = (buildapp == 'b2g' || buildapp == 'mulet' || toolkit == 'android') # Plugins don't work on Android and/or B2G/Mulet
[test_screen_orientation.html]
[test_settimeout_extra_arguments.html]
[test_settimeout_inner.html]

Просмотреть файл

@ -0,0 +1,117 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for audio controller in windows</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<pre id="test">
</pre>
<iframe></iframe>
<script type="application/javascript">
// Copied from /dom/plugins/test/mochitest/utils.js
function getTestPlugin(pluginName) {
var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
.getService(SpecialPowers.Ci.nsIPluginHost);
var tags = ph.getPluginTags();
var name = pluginName || "Test Plug-in";
for (var tag of tags) {
if (tag.name == name) {
return tag;
}
}
ok(false, "Could not find plugin tag with plugin name '" + name + "'");
return null;
}
// Copied from /dom/plugins/test/mochitest/utils.js
function setTestPluginEnabledState(newEnabledState, pluginName) {
var oldEnabledState = SpecialPowers.setTestPluginEnabledState(newEnabledState, pluginName);
if (!oldEnabledState) {
return;
}
var plugin = getTestPlugin(pluginName);
while (plugin.enabledState != newEnabledState) {
// Run a nested event loop to wait for the preference change to
// propagate to the child. Yuck!
SpecialPowers.Services.tm.currentThread.processNextEvent(true);
}
SimpleTest.registerCleanupFunction(function() {
SpecialPowers.setTestPluginEnabledState(oldEnabledState, pluginName);
});
}
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
SimpleTest.waitForExplicitFinish();
var expectedNotification = null;
var iframe = null;
var observer = {
observe: function(subject, topic, data) {
is(topic, "media-playback", "media-playback received");
is(data, expectedNotification, "This is the right notification");
SimpleTest.executeSoon(runTest);
}
};
var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
.getService(SpecialPowers.Ci.nsIObserverService);
var tests = [
function() {
iframe = document.querySelector("iframe");
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
},
function() {
observerService.addObserver(observer, "media-playback", false);
ok(true, "Observer set");
runTest();
},
function() {
expectedNotification = 'active';
iframe.src = "file_pluginAudio.html";
},
function() {
ok(!iframe.contentWindow.pluginMuted(), "Plugin should not be muted");
iframe.contentWindow.toggleMuteState(true);
ok(iframe.contentWindow.pluginMuted(), "Plugin should be muted");
iframe.contentWindow.toggleMuteState(false);
ok(!iframe.contentWindow.pluginMuted(), "Plugin should not be muted");
runTest();
},
function() {
expectedNotification = 'inactive';
iframe.contentWindow.stopAudio();
},
function() {
observerService.removeObserver(observer, "media-playback");
ok(true, "Observer removed");
runTest();
}
];
function runTest() {
if (!tests.length) {
SimpleTest.finish();
return;
}
var test = tests.shift();
test();
}
onload = runTest;
</script>
</body>
</html>

Просмотреть файл

@ -879,6 +879,56 @@ struct TypeNeedsOuterization
IsBaseOf<nsGlobalWindow, T>::value || IsSame<EventTarget, T>::value;
};
#ifdef DEBUG
template<typename T, bool isISupports=IsBaseOf<nsISupports, T>::value>
struct CheckWrapperCacheTracing
{
static inline void Check(T* aObject)
{
}
};
template<typename T>
struct CheckWrapperCacheTracing<T, true>
{
static void Check(T* aObject)
{
// Rooting analysis thinks QueryInterface may GC, but we're dealing with
// a subset of QueryInterface, C++ only types here.
JS::AutoSuppressGCAnalysis nogc;
nsWrapperCache* wrapperCacheFromQI = nullptr;
aObject->QueryInterface(NS_GET_IID(nsWrapperCache),
reinterpret_cast<void**>(&wrapperCacheFromQI));
MOZ_ASSERT(wrapperCacheFromQI,
"Missing nsWrapperCache from QueryInterface implementation?");
if (!wrapperCacheFromQI->GetWrapperPreserveColor()) {
// Can't assert that we trace the wrapper, since we don't have any
// wrapper to trace.
return;
}
nsISupports* ccISupports = nullptr;
aObject->QueryInterface(NS_GET_IID(nsCycleCollectionISupports),
reinterpret_cast<void**>(&ccISupports));
MOZ_ASSERT(ccISupports,
"nsWrapperCache object which isn't cycle collectable?");
nsXPCOMCycleCollectionParticipant* participant = nullptr;
CallQueryInterface(ccISupports, &participant);
MOZ_ASSERT(participant, "Can't QI to CycleCollectionParticipant?");
bool wasPreservingWrapper = wrapperCacheFromQI->PreservingWrapper();
wrapperCacheFromQI->SetPreservingWrapper(true);
wrapperCacheFromQI->CheckCCWrapperTraversal(ccISupports, participant);
wrapperCacheFromQI->SetPreservingWrapper(wasPreservingWrapper);
}
};
#endif
template <class T, GetOrCreateReflectorWrapBehavior wrapBehavior>
MOZ_ALWAYS_INLINE bool
DoGetOrCreateDOMReflector(JSContext* cx, T* value,
@ -903,6 +953,12 @@ DoGetOrCreateDOMReflector(JSContext* cx, T* value,
// figure out whether WrapObject() threw.
return false;
}
#ifdef DEBUG
if (IsBaseOf<nsWrapperCache, T>::value) {
CheckWrapperCacheTracing<T>::Check(value);
}
#endif
}
#ifdef DEBUG

Просмотреть файл

@ -700,15 +700,19 @@ BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId)
// Signal
JS::Rooted<JS::Value> value(nsContentUtils::RootingCxForThread());
voiceInfo->GetRelSignalStrength(&value);
NS_ENSURE_TRUE_VOID(value.isNumber());
mSignal = (int)ceil(value.toNumber() / 20.0);
if (value.isNumber()) {
mSignal = (int)ceil(value.toNumber() / 20.0);
}
UpdateDeviceCIND();
// Operator name
nsCOMPtr<nsIMobileNetworkInfo> network;
voiceInfo->GetNetwork(getter_AddRefs(network));
NS_ENSURE_TRUE_VOID(network);
if (!network) {
BT_LOGD("Unable to get network information");
return;
}
network->GetLongName(mOperatorName);
// According to GSM 07.07, "<format> indicates if the format is alphanumeric

Просмотреть файл

@ -1008,6 +1008,11 @@ BluetoothAdapter::HandlePropertyChanged(const BluetoothValue& aValue)
}
}
if (types.IsEmpty()) {
// No adapter attribute changed
return;
}
DispatchAttributeEvent(types);
}
@ -1134,7 +1139,7 @@ BluetoothAdapter::HandleDeviceUnpaired(const BluetoothValue& aValue)
void
BluetoothAdapter::DispatchAttributeEvent(const Sequence<nsString>& aTypes)
{
NS_ENSURE_TRUE_VOID(aTypes.Length());
MOZ_ASSERT(!aTypes.IsEmpty());
BluetoothAttributeEventInit init;
init.mAttrs = aTypes;

Просмотреть файл

@ -285,6 +285,8 @@ private:
/**
* Fire BluetoothAttributeEvent to trigger onattributechanged event handler.
*
* @param aTypes [in] Array of changed attributes. Must be non-empty.
*/
void DispatchAttributeEvent(const Sequence<nsString>& aTypes);

Просмотреть файл

@ -293,13 +293,18 @@ BluetoothDevice::HandlePropertyChanged(const BluetoothValue& aValue)
}
}
if (types.IsEmpty()) {
// No device attribute changed
return;
}
DispatchAttributeEvent(types);
}
void
BluetoothDevice::DispatchAttributeEvent(const Sequence<nsString>& aTypes)
{
NS_ENSURE_TRUE_VOID(aTypes.Length());
MOZ_ASSERT(!aTypes.IsEmpty());
BluetoothAttributeEventInit init;
init.mAttrs = aTypes;

Просмотреть файл

@ -117,6 +117,8 @@ private:
/**
* Fire BluetoothAttributeEvent to trigger onattributechanged event handler.
*
* @param aTypes [in] Array of changed attributes. Must be non-empty.
*/
void DispatchAttributeEvent(const Sequence<nsString>& aTypes);

Просмотреть файл

@ -651,9 +651,10 @@ BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId)
JS::Rooted<JS::Value> value(nsContentUtils::RootingCxForThread());
voiceInfo->GetRelSignalStrength(&value);
NS_ENSURE_TRUE_VOID(value.isNumber());
uint8_t signal = ceil(value.toNumber() / 20.0);
UpdateCIND(CINDType::SIGNAL, signal);
if (value.isNumber()) {
uint8_t signal = ceil(value.toNumber() / 20.0);
UpdateCIND(CINDType::SIGNAL, signal);
}
/**
* Possible return values for mode are:
@ -667,7 +668,10 @@ BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId)
nsCOMPtr<nsIMobileNetworkInfo> network;
voiceInfo->GetNetwork(getter_AddRefs(network));
NS_ENSURE_TRUE_VOID(network);
if (!network) {
BT_LOGD("Unable to get network information");
return;
}
network->GetLongName(mOperatorName);
// According to GSM 07.07, "<format> indicates if the format is alphanumeric

19
dom/cache/PrincipalVerifier.cpp поставляемый
Просмотреть файл

@ -131,6 +131,19 @@ PrincipalVerifier::VerifyOnMainThread()
return;
}
nsCOMPtr<nsIScriptSecurityManager> ssm = nsContentUtils::GetSecurityManager();
if (NS_WARN_IF(!ssm)) {
DispatchToInitiatingThread(NS_ERROR_ILLEGAL_DURING_SHUTDOWN);
return;
}
// Verify if a child process uses system principal, which is not allowed
// to prevent system principal is spoofed.
if (NS_WARN_IF(actor && ssm->IsSystemPrincipal(principal))) {
DispatchToInitiatingThread(NS_ERROR_FAILURE);
return;
}
// Verify that a child process claims to own the app for this principal
if (NS_WARN_IF(actor && !AssertAppPrincipal(actor, principal))) {
DispatchToInitiatingThread(NS_ERROR_FAILURE);
@ -138,12 +151,6 @@ PrincipalVerifier::VerifyOnMainThread()
}
actor = nullptr;
nsCOMPtr<nsIScriptSecurityManager> ssm = nsContentUtils::GetSecurityManager();
if (NS_WARN_IF(!ssm)) {
DispatchToInitiatingThread(NS_ERROR_ILLEGAL_DURING_SHUTDOWN);
return;
}
#ifdef DEBUG
// Sanity check principal origin by using it to construct a URI and security
// checking it. Don't do this for the system principal, though, as its origin

Просмотреть файл

@ -1825,6 +1825,12 @@ WebGLContext::TexImageFromVideoElement(const TexImageTarget texImageTarget,
GLenum format, GLenum type,
mozilla::dom::Element& elt)
{
if (type == LOCAL_GL_HALF_FLOAT_OES &&
!gl->IsExtensionSupported(gl::GLContext::OES_texture_half_float))
{
type = LOCAL_GL_HALF_FLOAT;
}
if (!ValidateTexImageFormatAndType(format, type,
WebGLTexImageFunc::TexImage,
WebGLTexDimensions::Tex2D))

Просмотреть файл

@ -112,13 +112,26 @@ function next() {
SimpleTest.waitForFocus(resolve, win, true);
}).then(() => {
return new Promise(resolve => {
function listener() {
var retried = false;
function listener(evt) {
if (!retried && evt.type == "mozfullscreenerror") {
todo(false, "Failed to enter fullscreen, but try again");
retried = true;
SimpleTest.waitForFocus(() => {
win.document.documentElement.mozRequestFullScreen();
}, win, true);
return;
}
win.removeEventListener("mozfullscreenchange", listener);
win.removeEventListener("mozfullscreenerror", listener);
is(evt.type, "mozfullscreenchange", "Should get fullscreenchange");
ok(win.document.mozFullScreen, "Should have entered fullscreen");
ok(win.fullScreen, "The window should be in fullscreen");
test.actionFunc(win).then(resolve);
}
info("About to enter fullscreen");
win.addEventListener("mozfullscreenchange", listener);
win.addEventListener("mozfullscreenerror", listener);
win.document.documentElement.mozRequestFullScreen();
});
}).then(() => {

Просмотреть файл

@ -682,7 +682,8 @@ IDBCursor::Delete(JSContext* aCx, ErrorResult& aRv)
if (IsSourceDeleted() ||
!mHaveValue ||
mType == Type_ObjectStoreKey ||
mType == Type_IndexKey) {
mType == Type_IndexKey ||
mContinueCalled) {
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
return nullptr;
}

Просмотреть файл

@ -1075,6 +1075,8 @@ BlobDataFromBlobImpl(BlobImpl* aBlobImpl, BlobData& aBlobData)
const nsTArray<nsRefPtr<BlobImpl>>* subBlobs = aBlobImpl->GetSubBlobImpls();
if (subBlobs) {
MOZ_ASSERT(subBlobs->Length());
aBlobData = nsTArray<BlobData>();
nsTArray<BlobData>& subBlobDatas = aBlobData.get_ArrayOfBlobData();
@ -1098,8 +1100,6 @@ BlobDataFromBlobImpl(BlobImpl* aBlobImpl, BlobData& aBlobData)
return;
}
MOZ_ASSERT(aBlobImpl->IsMemoryFile());
ErrorResult rv;
nsCOMPtr<nsIInputStream> inputStream;
aBlobImpl->GetInternalStream(getter_AddRefs(inputStream), rv);

Просмотреть файл

@ -14,12 +14,14 @@
#include <string>
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
#include "mozilla/Scoped.h"
#ifdef XP_WIN
#include "windows.h"
#ifdef MOZ_SANDBOX
#include "mozilla/Scoped.h"
#include <intrin.h>
#include <assert.h>
#endif
#endif
#if defined(HASH_NODE_ID_WITH_DEVICE_ID)
// In order to provide EME plugins with a "device binding" capability,
@ -196,11 +198,7 @@ GMPLoaderImpl::Load(const char* aUTF8LibPath,
nodeId = std::string(aOriginSalt, aOriginSalt + aOriginSaltLen);
}
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
// If the GMP DLL is a side-by-side assembly with static imports then the DLL
// loader will attempt to create an activation context which will fail because
// of the sandbox. If we create an activation context before we start the
// sandbox then this one will get picked up by the DLL loader.
#ifdef XP_WIN
int pathLen = MultiByteToWideChar(CP_UTF8, 0, aUTF8LibPath, -1, nullptr, 0);
if (pathLen == 0) {
return false;
@ -211,11 +209,17 @@ GMPLoaderImpl::Load(const char* aUTF8LibPath,
return false;
}
#ifdef MOZ_SANDBOX
// If the GMP DLL is a side-by-side assembly with static imports then the DLL
// loader will attempt to create an activation context which will fail because
// of the sandbox. If we create an activation context before we start the
// sandbox then this one will get picked up by the DLL loader.
ACTCTX actCtx = { sizeof(actCtx) };
actCtx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
actCtx.lpSource = widePath;
actCtx.lpResourceName = ISOLATIONAWARE_MANIFEST_RESOURCE_ID;
ScopedActCtxHandle actCtxHandle(CreateActCtx(&actCtx));
#endif
#endif
// Start the sandbox now that we've generated the device bound node id.

Просмотреть файл

@ -261,55 +261,86 @@ public:
, mMonitor("MP4ContainerParser Index Monitor")
{}
bool HasAtom(const mp4_demuxer::AtomType& aAtom, const MediaByteBuffer* aData) {
mp4_demuxer::ByteReader reader(aData);
while (reader.Remaining() >= 8) {
uint64_t size = reader.ReadU32();
const uint8_t* typec = reader.Peek(4);
uint32_t type = reader.ReadU32();
MSE_DEBUGV(MP4ContainerParser ,"Checking atom:'%c%c%c%c'",
typec[0], typec[1], typec[2], typec[3]);
if (mp4_demuxer::AtomType(type) == aAtom) {
reader.DiscardRemaining();
return true;
}
if (size == 1) {
// 64 bits size.
if (!reader.CanReadType<uint64_t>()) {
break;
}
size = reader.ReadU64();
} else if (size == 0) {
// Atom extends to the end of the buffer, it can't have what we're
// looking for.
break;
}
if (reader.Remaining() < size - 8) {
// Incomplete atom.
break;
}
reader.Read(size - 8);
}
reader.DiscardRemaining();
return false;
}
bool IsInitSegmentPresent(MediaByteBuffer* aData) override
{
ContainerParser::IsInitSegmentPresent(aData);
// Each MP4 atom has a chunk size and chunk type. The root chunk in an MP4
// file is the 'ftyp' atom followed by a file type. We just check for a
// vaguely valid 'ftyp' atom.
return HasAtom(mp4_demuxer::AtomType("ftyp"), aData);
AtomParser parser(mType, aData);
return parser.StartWithInitSegment();
}
bool IsMediaSegmentPresent(MediaByteBuffer* aData) override
{
ContainerParser::IsMediaSegmentPresent(aData);
return HasAtom(mp4_demuxer::AtomType("moof"), aData);
AtomParser parser(mType, aData);
return parser.StartWithMediaSegment();
}
private:
class AtomParser {
public:
AtomParser(const nsACString& aType, const MediaByteBuffer* aData)
{
const nsCString mType(aType); // for logging macro.
mp4_demuxer::ByteReader reader(aData);
mp4_demuxer::AtomType initAtom("ftyp");
mp4_demuxer::AtomType mediaAtom("moof");
while (reader.Remaining() >= 8) {
uint64_t size = reader.ReadU32();
const uint8_t* typec = reader.Peek(4);
uint32_t type = reader.ReadU32();
MSE_DEBUGV(AtomParser ,"Checking atom:'%c%c%c%c'",
typec[0], typec[1], typec[2], typec[3]);
if (mInitOffset.isNothing() &&
mp4_demuxer::AtomType(type) == initAtom) {
mInitOffset = Some(reader.Offset());
}
if (mMediaOffset.isNothing() &&
mp4_demuxer::AtomType(type) == mediaAtom) {
mMediaOffset = Some(reader.Offset());
}
if (mInitOffset.isSome() && mMediaOffset.isSome()) {
// We have everything we need.
break;
}
if (size == 1) {
// 64 bits size.
if (!reader.CanReadType<uint64_t>()) {
break;
}
size = reader.ReadU64();
} else if (size == 0) {
// Atom extends to the end of the buffer, it can't have what we're
// looking for.
break;
}
if (reader.Remaining() < size - 8) {
// Incomplete atom.
break;
}
reader.Read(size - 8);
}
reader.DiscardRemaining();
}
bool StartWithInitSegment()
{
return mInitOffset.isSome() &&
(mMediaOffset.isNothing() || mInitOffset.ref() < mMediaOffset.ref());
}
bool StartWithMediaSegment()
{
return mMediaOffset.isSome() &&
(mInitOffset.isNothing() || mMediaOffset.ref() < mInitOffset.ref());
}
private:
Maybe<size_t> mInitOffset;
Maybe<size_t> mMediaOffset;
};
public:
bool ParseStartAndEndTimestamps(MediaByteBuffer* aData,
int64_t& aStart, int64_t& aEnd) override
{

Просмотреть файл

@ -781,9 +781,8 @@ void
TrackBuffersManager::InitializationSegmentReceived()
{
MOZ_ASSERT(mParser->HasCompleteInitData());
mInitData = mParser->InitData();
mCurrentInputBuffer = new SourceBufferResource(mType);
mCurrentInputBuffer->AppendData(mInitData);
mCurrentInputBuffer->AppendData(mParser->InitData());
uint32_t length =
mParser->InitSegmentRange().mEnd - (mProcessedInput - mInputBuffer->Length());
if (mInputBuffer->Length() == length) {
@ -878,7 +877,7 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
}
// 4. Let active track flag equal false.
mActiveTrack = false;
bool activeTrack = false;
// Increase our stream id.
uint32_t streamID = sStreamSourceID++;
@ -911,7 +910,7 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
// 7. If audioTracks.length equals 0, then run the following steps:
// 1. Set the enabled property on new audio track to true.
// 2. Set active track flag to true.
mActiveTrack = true;
activeTrack = true;
// 8. Add new audio track to the audioTracks attribute on this SourceBuffer object.
// 9. Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the AudioTrackList object referenced by the audioTracks attribute on this SourceBuffer object.
// 10. Add new audio track to the audioTracks attribute on the HTMLMediaElement.
@ -943,7 +942,7 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
// 7. If videoTracks.length equals 0, then run the following steps:
// 1. Set the selected property on new video track to true.
// 2. Set active track flag to true.
mActiveTrack = true;
activeTrack = true;
// 8. Add new video track to the videoTracks attribute on this SourceBuffer object.
// 9. Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the VideoTrackList object referenced by the videoTracks attribute on this SourceBuffer object.
// 10. Add new video track to the videoTracks attribute on the HTMLMediaElement.
@ -956,6 +955,9 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
// 4. For each text track in the initialization segment, run following steps:
// 5. If active track flag equals true, then run the following steps:
// This is handled by SourceBuffer once the promise is resolved.
if (activeTrack) {
mActiveTrack = true;
}
// 6. Set first initialization segment received flag to true.
mFirstInitializationSegmentReceived = true;
@ -985,6 +987,9 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
mInfo = info;
}
// We now have a valid init data ; we can store it for later use.
mInitData = mParser->InitData();
// 3. Remove the initialization segment bytes from the beginning of the input buffer.
// This step has already been done in InitializationSegmentReceived when we
// transferred the content into mCurrentInputBuffer.

Просмотреть файл

@ -105,3 +105,5 @@ skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac"))
skip-if = true # Disabled due to bug 1124493 and friends. WebM MSE is deprioritized.
[test_WaitingOnMissingData_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_WaitingToEndedTransition_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+

Просмотреть файл

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>MSE: |waiting| event when source data is missing</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="mediasource.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test"><script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
runWithMSE(function(ms, el) {
el.controls = true;
once(ms, 'sourceopen').then(function() {
ok(true, "Receive a sourceopen event");
var audiosb = ms.addSourceBuffer("audio/mp4");
var videosb = ms.addSourceBuffer("video/mp4");
fetchAndLoad(audiosb, 'bipbop/bipbop_audio', ['init'], '.mp4')
.then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', ['init'], '.mp4'))
.then(fetchAndLoad.bind(null, audiosb, 'bipbop/bipbop_audio', range(1, 5), '.m4s'))
.then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', range(1, 6), '.m4s'))
.then(function() {
// HTMLMediaElement fires 'waiting' if somebody invokes |play()| before the MDSM
// has notified it of available data. Make sure that we get 'playing' before
// we starting waiting for 'waiting'.
info("Invoking play()");
var p = once(el, 'playing');
el.play();
return p;
}).then(function() {
ok(true, "Video playing. It should play for a bit, then fire 'waiting'");
var p = once(el, 'waiting');
el.play();
return p;
}).then(function() {
// currentTime is based on the current video frame, so if the audio ends just before
// the next video frame, currentTime can be up to 1 frame's worth earlier than
// min(audioEnd, videoEnd).
isfuzzy(el.currentTime, Math.min(audiosb.buffered.end(0), videosb.buffered.end(0)) - 1/60,
1/30, "Got a waiting event at " + el.currentTime);
}).then(function() {
var p = once(el, 'ended');
ms.endOfStream();
return p;
}).then(function() {
is(el.duration, 4.005, "Video has correct duration: " + el.duration);
is(el.currentTime, el.duration, "Video has correct currentTime.");
SimpleTest.finish();
});
});
});
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,9 @@
<!DOCTYPE html>
<script>
var r0=new AudioContext();
var r5=r0.createOscillator();
var r6=r0.createPeriodicWave(new Float32Array(1),new Float32Array(1));
r5.frequency.value = 4294967295;
r5.start(0);
r5.setPeriodicWave(r6);
</script>

Просмотреть файл

@ -67,6 +67,7 @@ load 952756.html
load 966636.html
load 986901.html
load 990794.html
load 995289.html
load 1012609.html
load 1015662.html
load 1020205.html

Просмотреть файл

@ -101,12 +101,17 @@ AudioContext::AudioContext(nsPIDOMWindow* aWindow,
, mIsShutDown(false)
, mCloseCalled(false)
{
aWindow->AddAudioContext(this);
bool mute = aWindow->AddAudioContext(this);
// Note: AudioDestinationNode needs an AudioContext that must already be
// bound to the window.
mDestination = new AudioDestinationNode(this, aIsOffline, aChannel,
aNumberOfChannels, aLength, aSampleRate);
// The context can't be muted until it has a destination.
if (mute) {
Mute();
}
}
void

Просмотреть файл

@ -324,10 +324,14 @@ WaveShaperNode::SetCurve(const Nullable<Float32Array>& aCurve, ErrorResult& aRv)
return;
}
mCurve = floats.Obj();
if (!curve.SetLength(argLength, fallible)) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
curve.SetLength(argLength);
PodCopy(curve.Elements(), floats.Data(), floats.Length());
mCurve = floats.Obj();
} else {
mCurve = nullptr;
}

Просмотреть файл

@ -147,7 +147,7 @@ void PeriodicWave::waveDataForFundamentalFrequency(float fundamentalFrequency, f
higherWaveData = m_bandLimitedTables[rangeIndex1]->Elements();
// Ranges from 0 -> 1 to interpolate between lower -> higher.
tableInterpolationFactor = pitchRange - rangeIndex1;
tableInterpolationFactor = rangeIndex2 - pitchRange;
}
unsigned PeriodicWave::maxNumberOfPartials() const

Просмотреть файл

@ -159,6 +159,7 @@ skip-if = (toolkit == 'gonk' && !debug) || android_version == '10' || android_ve
[test_stereoPannerNode.html]
[test_stereoPannerNodePassThrough.html]
[test_periodicWave.html]
[test_periodicWaveBandLimiting.html]
[test_scriptProcessorNode.html]
[test_scriptProcessorNodeChannelCount.html]
[test_scriptProcessorNodePassThrough.html]

Просмотреть файл

@ -0,0 +1,86 @@
<!DOCTYPE html>
<title>Test effect of band limiting on PeriodicWave signals</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
const sampleRate = 48000;
const bufferSize = 12800;
const epsilon = 0.01;
// "All implementations must support arrays up to at least 8192", but the
// linear interpolation of the current implementation distorts the higher
// frequency components too much to pass this test.
const frequencyIndexMax = 100;
// A set of oscillators are created near the Nyquist frequency.
// These are factors giving each oscillator frequency relative to the Nyquist.
// The first is an octave below Nyquist and the last is just above.
const OCTAVE_BELOW = 0;
const HALF_BELOW = 1;
const NEAR_BELOW = 2;
const ABOVE = 3;
const oscillatorFactors = [0.5, Math.sqrt(0.5), 0.99, 1.01];
const oscillatorCount = oscillatorFactors.length;
// Return magnitude relative to unit sine wave
function magnitude(array) {
var mag = 0
for (var i = 0; i < array.length; ++i) {
sample = array[i];
mag += sample * sample;
}
return Math.sqrt(2 * mag / array.length);
}
function test_frequency_index(frequencyIndex) {
var context =
new OfflineAudioContext(oscillatorCount, bufferSize, sampleRate);
var merger = context.createChannelMerger(oscillatorCount);
merger.connect(context.destination);
var real = new Float32Array(frequencyIndex + 1);
real[frequencyIndex] = 1;
var image = new Float32Array(real.length);
var wave = context.createPeriodicWave(real, image);
for (var i = 0; i < oscillatorCount; ++i) {
var oscillator = context.createOscillator();
oscillator.frequency.value =
oscillatorFactors[i] * sampleRate / (2 * frequencyIndex);
oscillator.connect(merger, 0, i);
oscillator.setPeriodicWave(wave);
oscillator.start(0);
}
return context.startRendering().
then((buffer) => {
assert_equals(buffer.numberOfChannels, oscillatorCount);
var magnitudes = [];
for (var i = 0; i < oscillatorCount; ++i) {
magnitudes[i] = magnitude(buffer.getChannelData(i));
}
// Unaffected by band-limiting one octave below Nyquist.
assert_approx_equals(magnitudes[OCTAVE_BELOW], 1, epsilon,
"magnitude with frequency octave below Nyquist");
// Still at least half the amplitude at half octave below Nyquist.
assert_greater_than(magnitudes[HALF_BELOW], 0.5 * (1 - epsilon),
"magnitude with frequency half octave below Nyquist");
// Approaching zero or zero near Nyquist.
assert_less_than(magnitudes[NEAR_BELOW], 0.1,
"magnitude with frequency near Nyquist");
assert_equals(magnitudes[ABOVE], 0,
"magnitude with frequency above Nyquist");
});
}
// The 5/4 ratio with rounding up provides sampling across a range of
// octaves and offsets within octaves.
for (var frequencyIndex = 1;
frequencyIndex < frequencyIndexMax;
frequencyIndex = Math.floor((5 * frequencyIndex + 3) / 4)) {
promise_test(() => test_frequency_index(frequencyIndex),
"Frequency " + frequencyIndex);
}
</script>

Просмотреть файл

@ -132,6 +132,8 @@ SapiCallback::OnSpeechEvent(const SPEVENT& speechEvent)
mTask->DispatchBoundary(NS_LITERAL_STRING("sentence"),
GetTickCount() - mStartingTime, mCurrentIndex);
break;
default:
break;
}
}
@ -180,7 +182,7 @@ SapiService::Init()
if (Preferences::GetBool("media.webspeech.synth.test")) {
// When enabled, we shouldn't add OS backend (Bug 1160844)
return nullptr;
return false;
}
if (FAILED(CoCreateInstance(CLSID_SpVoice, nullptr, CLSCTX_ALL, IID_ISpVoice,

Просмотреть файл

@ -411,7 +411,9 @@ typedef enum {
, NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
, NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated
Cocoa text input specification. */
#endif
, NPNVmuteAudioBool = 4000 /* Request that the browser wants to mute or unmute the plugin */
#if defined(XP_MACOSX)
, NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports
CA model compositing */
#endif

Просмотреть файл

@ -106,6 +106,8 @@ using mozilla::plugins::PluginModuleContentParent;
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
#endif
#include "nsIAudioChannelAgent.h"
using namespace mozilla;
using namespace mozilla::plugins::parent;
@ -2402,6 +2404,46 @@ _setvalue(NPP npp, NPPVariable variable, void *result)
return inst->SetUsesDOMForCursor(useDOMForCursor);
}
case NPPVpluginIsPlayingAudio: {
bool isMuted = !result;
nsNPAPIPluginInstance* inst = (nsNPAPIPluginInstance*) npp->ndata;
MOZ_ASSERT(inst);
if (isMuted && !inst->HasAudioChannelAgent()) {
return NPERR_NO_ERROR;
}
nsCOMPtr<nsIAudioChannelAgent> agent;
nsresult rv = inst->GetOrCreateAudioChannelAgent(getter_AddRefs(agent));
if (NS_WARN_IF(NS_FAILED(rv))) {
return NPERR_NO_ERROR;
}
MOZ_ASSERT(agent);
if (isMuted) {
rv = agent->NotifyStoppedPlaying();
if (NS_WARN_IF(NS_FAILED(rv))) {
return NPERR_NO_ERROR;
}
} else {
float volume = 0.0;
bool muted = true;
rv = agent->NotifyStartedPlaying(&volume, &muted);
if (NS_WARN_IF(NS_FAILED(rv))) {
return NPERR_NO_ERROR;
}
rv = inst->WindowVolumeChanged(volume, muted);
if (NS_WARN_IF(NS_FAILED(rv))) {
return NPERR_NO_ERROR;
}
}
return NPERR_NO_ERROR;
}
#ifndef MOZ_WIDGET_ANDROID
// On android, their 'drawing model' uses the same constant!
case NPPVpluginDrawingModel: {

Просмотреть файл

@ -40,6 +40,7 @@
#include "mozilla/unused.h"
#include "nsILoadContext.h"
#include "mozilla/dom/HTMLObjectElementBinding.h"
#include "AudioChannelService.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -169,7 +170,7 @@ using namespace mozilla::layers;
static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID);
NS_IMPL_ISUPPORTS0(nsNPAPIPluginInstance)
NS_IMPL_ISUPPORTS(nsNPAPIPluginInstance, nsIAudioChannelAgentCallback)
nsNPAPIPluginInstance::nsNPAPIPluginInstance()
: mDrawingModel(kDefaultDrawingModel)
@ -253,6 +254,7 @@ nsNPAPIPluginInstance::Destroy()
{
Stop();
mPlugin = nullptr;
mAudioChannelAgent = nullptr;
#if MOZ_WIDGET_ANDROID
if (mContentSurface)
@ -1788,3 +1790,71 @@ nsNPAPIPluginInstance::GetRunID(uint32_t* aRunID)
return library->GetRunID(aRunID);
}
nsresult
nsNPAPIPluginInstance::GetOrCreateAudioChannelAgent(nsIAudioChannelAgent** aAgent)
{
if (!mAudioChannelAgent) {
nsresult rv;
mAudioChannelAgent = do_CreateInstance("@mozilla.org/audiochannelagent;1", &rv);
if (NS_WARN_IF(!mAudioChannelAgent)) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsPIDOMWindow> window = GetDOMWindow();
if (NS_WARN_IF(!window)) {
return NS_ERROR_FAILURE;
}
rv = mAudioChannelAgent->Init(window->GetCurrentInnerWindow(),
(int32_t)AudioChannelService::GetDefaultAudioChannel(),
this);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
nsCOMPtr<nsIAudioChannelAgent> agent = mAudioChannelAgent;
agent.forget(aAgent);
return NS_OK;
}
NS_IMETHODIMP
nsNPAPIPluginInstance::WindowVolumeChanged(float aVolume, bool aMuted)
{
// We just support mute/unmute
nsresult rv = SetMuted(aMuted);
NS_WARN_IF(NS_FAILED(rv));
return rv;
}
NS_IMETHODIMP
nsNPAPIPluginInstance::WindowAudioCaptureChanged()
{
return NS_OK;
}
nsresult
nsNPAPIPluginInstance::SetMuted(bool aIsMuted)
{
if (RUNNING != mRunning)
return NS_OK;
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance informing plugin of mute state change this=%p\n",this));
if (!mPlugin || !mPlugin->GetLibrary())
return NS_ERROR_FAILURE;
NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
if (!pluginFunctions->setvalue)
return NS_ERROR_FAILURE;
PluginDestructionGuard guard(this);
NPError error;
NPBool value = static_cast<NPBool>(aIsMuted);
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVmuteAudioBool, &value), this,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE;
}

Просмотреть файл

@ -17,6 +17,7 @@
#include "nsHashKeys.h"
#include <prinrval.h>
#include "js/TypeDecls.h"
#include "nsIAudioChannelAgent.h"
#ifdef MOZ_WIDGET_ANDROID
#include "nsAutoPtr.h"
#include "nsIRunnable.h"
@ -74,13 +75,14 @@ public:
bool needUnschedule;
};
class nsNPAPIPluginInstance : public nsISupports
class nsNPAPIPluginInstance final : public nsIAudioChannelAgentCallback
{
private:
typedef mozilla::PluginLibrary PluginLibrary;
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIAUDIOCHANNELAGENTCALLBACK
nsresult Initialize(nsNPAPIPlugin *aPlugin, nsPluginInstanceOwner* aOwner, const nsACString& aMIMEType);
nsresult Start();
@ -117,6 +119,15 @@ public:
nsPluginInstanceOwner* GetOwner();
void SetOwner(nsPluginInstanceOwner *aOwner);
bool HasAudioChannelAgent() const
{
return !!mAudioChannelAgent;
}
nsresult GetOrCreateAudioChannelAgent(nsIAudioChannelAgent** aAgent);
nsresult SetMuted(bool aIsMuted);
nsNPAPIPlugin* GetPlugin();
nsresult GetNPP(NPP * aNPP);
@ -404,6 +415,8 @@ private:
uint32_t mCachedParamLength;
char **mCachedParamNames;
char **mCachedParamValues;
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
};
// On Android, we need to guard against plugin code leaking entries in the local

Просмотреть файл

@ -87,6 +87,8 @@ child:
intr NPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId()
returns (nsCString plug_id, NPError result);
intr NPP_SetValue_NPNVmuteAudioBool(bool muted) returns (NPError result);
intr NPP_HandleEvent(NPRemoteEvent event)
returns (int16_t handled);
// special cases where we need to a shared memory buffer
@ -150,6 +152,8 @@ parent:
returns (NPError result);
intr NPN_SetValue_NPPVpluginEventModel(int eventModel)
returns (NPError result);
intr NPN_SetValue_NPPVpluginIsPlayingAudio(bool isAudioPlaying)
returns (NPError result);
intr NPN_GetURL(nsCString url, nsCString target)
returns (NPError result);

Просмотреть файл

@ -626,6 +626,14 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue)
}
#endif
case NPPVpluginIsPlayingAudio: {
NPError rv = NPERR_GENERIC_ERROR;
if (!CallNPN_SetValue_NPPVpluginIsPlayingAudio((NPBool)(intptr_t)aValue, &rv)) {
return NPERR_GENERIC_ERROR;
}
return rv;
}
default:
MOZ_LOG(GetPluginLog(), LogLevel::Warning,
("In PluginInstanceChild::NPN_SetValue: Unhandled NPPVariable %i (%s)",
@ -765,6 +773,20 @@ PluginInstanceChild::AnswerNPP_SetValue_NPNVprivateModeBool(const bool& value,
return true;
}
bool
PluginInstanceChild::AnswerNPP_SetValue_NPNVmuteAudioBool(const bool& value,
NPError* result)
{
if (!mPluginIface->setvalue) {
*result = NPERR_GENERIC_ERROR;
return true;
}
NPBool v = value;
*result = mPluginIface->setvalue(GetNPP(), NPNVmuteAudioBool, &v);
return true;
}
bool
PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
int16_t* handled)

Просмотреть файл

@ -80,6 +80,8 @@ protected:
NPError* aResult) override;
virtual bool
AnswerNPP_SetValue_NPNVprivateModeBool(const bool& value, NPError* result) override;
virtual bool
AnswerNPP_SetValue_NPNVmuteAudioBool(const bool& value, NPError* result) override;
virtual bool
AnswerNPP_HandleEvent(const NPRemoteEvent& event, int16_t* handled) override;

Просмотреть файл

@ -440,6 +440,15 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginEventModel(
#endif
}
bool
PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginIsPlayingAudio(
const bool& isAudioPlaying, NPError* result)
{
*result = mNPNIface->setvalue(mNPP, NPPVpluginIsPlayingAudio,
(void*)(intptr_t)isAudioPlaying);
return true;
}
bool
PluginInstanceParent::AnswerNPN_GetURL(const nsCString& url,
const nsCString& target,
@ -1142,15 +1151,22 @@ PluginInstanceParent::NPP_GetValue(NPPVariable aVariable,
NPError
PluginInstanceParent::NPP_SetValue(NPNVariable variable, void* value)
{
NPError result;
switch (variable) {
case NPNVprivateModeBool:
NPError result;
if (!CallNPP_SetValue_NPNVprivateModeBool(*static_cast<NPBool*>(value),
&result))
return NPERR_GENERIC_ERROR;
return result;
case NPNVmuteAudioBool:
if (!CallNPP_SetValue_NPNVmuteAudioBool(*static_cast<NPBool*>(value),
&result))
return NPERR_GENERIC_ERROR;
return result;
default:
NS_ERROR("Unhandled NPNVariable in NPP_SetValue");
MOZ_LOG(GetPluginLog(), LogLevel::Warning,

Просмотреть файл

@ -128,6 +128,9 @@ public:
virtual bool
AnswerNPN_SetValue_NPPVpluginEventModel(const int& eventModel,
NPError* result) override;
virtual bool
AnswerNPN_SetValue_NPPVpluginIsPlayingAudio(const bool& isAudioPlaying,
NPError* result) override;
virtual bool
AnswerNPN_GetURL(const nsCString& url, const nsCString& target,

Просмотреть файл

@ -419,3 +419,14 @@ x86-only on some OSes:
Returns the contents scale factor. On platforms without support for this query
always returns 1.0 (a double value). Likewise on hardware without HiDPI mode
support.
== Plugin audio channel support ==
* startAudioPlayback()
Simulates the plugin starting to play back audio.
* stopAudioPlayback()
Simulates the plugin stopping to play back audio.
* audioMuted()
Returns the last value set by NPP_SetValue(NPNVmuteAudioBool).

Просмотреть файл

@ -168,6 +168,9 @@ static bool getNPNVdocumentOrigin(NPObject* npobj, const NPVariant* args, uint32
static bool getMouseUpEventCount(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool queryContentsScaleFactor(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool echoString(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool startAudioPlayback(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool stopAudioPlayback(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool getAudioMuted(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static const NPUTF8* sPluginMethodIdentifierNames[] = {
"npnEvaluateTest",
@ -234,6 +237,9 @@ static const NPUTF8* sPluginMethodIdentifierNames[] = {
"getMouseUpEventCount",
"queryContentsScaleFactor",
"echoString",
"startAudioPlayback",
"stopAudioPlayback",
"audioMuted",
};
static NPIdentifier sPluginMethodIdentifiers[MOZ_ARRAY_LENGTH(sPluginMethodIdentifierNames)];
static const ScriptableFunction sPluginMethodFunctions[] = {
@ -301,6 +307,9 @@ static const ScriptableFunction sPluginMethodFunctions[] = {
getMouseUpEventCount,
queryContentsScaleFactor,
echoString,
startAudioPlayback,
stopAudioPlayback,
getAudioMuted,
};
static_assert(MOZ_ARRAY_LENGTH(sPluginMethodIdentifierNames) ==
@ -784,6 +793,8 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
instanceData->npnNewStream = false;
instanceData->invalidateDuringPaint = false;
instanceData->slowPaint = false;
instanceData->playingAudio = false;
instanceData->audioMuted = false;
instanceData->writeCount = 0;
instanceData->writeReadyCount = 0;
memset(&instanceData->window, 0, sizeof(instanceData->window));
@ -1440,6 +1451,11 @@ NPP_SetValue(NPP instance, NPNVariable variable, void* value)
instanceData->lastReportedPrivateModeState = bool(*static_cast<NPBool*>(value));
return NPERR_NO_ERROR;
}
if (variable == NPNVmuteAudioBool) {
InstanceData* instanceData = (InstanceData*)(instance->pdata);
instanceData->audioMuted = bool(*static_cast<NPBool*>(value));
return NPERR_NO_ERROR;
}
return NPERR_GENERIC_ERROR;
}
@ -3707,3 +3723,45 @@ bool echoString(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVar
return true;
}
static bool
toggleAudioPlayback(NPObject* npobj, uint32_t argCount, bool playingAudio, NPVariant* result)
{
if (argCount != 0) {
return false;
}
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
id->playingAudio = playingAudio;
NPN_SetValue(npp, NPPVpluginIsPlayingAudio, (void*)playingAudio);
VOID_TO_NPVARIANT(*result);
return true;
}
static bool
startAudioPlayback(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
return toggleAudioPlayback(npobj, argCount, true, result);
}
static bool
stopAudioPlayback(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
return toggleAudioPlayback(npobj, argCount, false, result);
}
static bool
getAudioMuted(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (argCount != 0) {
return false;
}
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
BOOLEAN_TO_NPVARIANT(id->audioMuted, *result);
return true;
}

Просмотреть файл

@ -106,6 +106,8 @@ typedef struct InstanceData {
bool asyncCallbackResult;
bool invalidateDuringPaint;
bool slowPaint;
bool playingAudio;
bool audioMuted;
int32_t winX;
int32_t winY;
int32_t lastMouseX;

Просмотреть файл

@ -4,6 +4,8 @@
"use strict";
this.EXPORTED_SYMBOLS = [];
const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");

Просмотреть файл

@ -39,6 +39,7 @@ interface IDBCursor {
IDBRequest delete ();
};
[Exposed=(Window,Worker)]
interface IDBCursorWithValue : IDBCursor {
[Throws]
readonly attribute any value;

Просмотреть файл

@ -64,6 +64,16 @@ Performance::GetPerformanceTimingFromString(const nsAString& aProperty)
return 0;
}
void
Performance::InsertUserEntry(PerformanceEntry* aEntry)
{
if (mWorkerPrivate->PerformanceLoggingEnabled()) {
PerformanceBase::LogEntry(aEntry,
NS_ConvertUTF16toUTF8(mWorkerPrivate->ScriptURL()));
}
PerformanceBase::InsertUserEntry(aEntry);
}
DOMHighResTimeStamp
Performance::DeltaFromNavigationStart(DOMHighResTimeStamp aTime)
{

Просмотреть файл

@ -26,6 +26,8 @@ public:
private:
~Performance();
void InsertUserEntry(PerformanceEntry* aEntry) override;
WorkerPrivate* mWorkerPrivate;
public:

Просмотреть файл

@ -158,6 +158,7 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 1,
#define PREF_DOM_CACHES_ENABLED "dom.caches.enabled"
#define PREF_DOM_CACHES_TESTING_ENABLED "dom.caches.testing.enabled"
#define PREF_WORKERS_PERFORMANCE_LOGGING_ENABLED "dom.performance.enable_user_timing_logging"
#define PREF_DOM_WORKERNOTIFICATION_ENABLED "dom.webnotifications.enabled"
#define PREF_WORKERS_LATEST_JS_VERSION "dom.workers.latestJSVersion"
#define PREF_INTL_ACCEPT_LANGUAGES "intl.accept_languages"
@ -1940,6 +1941,10 @@ RuntimeService::Init()
WorkerPrefChanged,
PREF_DOM_CACHES_TESTING_ENABLED,
reinterpret_cast<void *>(WORKERPREF_DOM_CACHES_TESTING))) ||
NS_FAILED(Preferences::RegisterCallbackAndCall(
WorkerPrefChanged,
PREF_WORKERS_PERFORMANCE_LOGGING_ENABLED,
reinterpret_cast<void *>(WORKERPREF_PERFORMANCE_LOGGING_ENABLED))) ||
NS_FAILED(Preferences::RegisterCallbackAndCall(
WorkerPrefChanged,
PREF_SERVICEWORKERS_TESTING_ENABLED,
@ -2147,6 +2152,10 @@ RuntimeService::Cleanup()
WorkerPrefChanged,
PREF_DOM_CACHES_TESTING_ENABLED,
reinterpret_cast<void *>(WORKERPREF_DOM_CACHES_TESTING))) ||
NS_FAILED(Preferences::UnregisterCallback(
WorkerPrefChanged,
PREF_WORKERS_PERFORMANCE_LOGGING_ENABLED,
reinterpret_cast<void *>(WORKERPREF_PERFORMANCE_LOGGING_ENABLED))) ||
NS_FAILED(Preferences::UnregisterCallback(
WorkerPrefChanged,
PREF_INTERCEPTION_OPAQUE_ENABLED,
@ -2708,6 +2717,7 @@ RuntimeService::WorkerPrefChanged(const char* aPrefName, void* aClosure)
case WORKERPREF_DOM_CACHES:
case WORKERPREF_DOM_CACHES_TESTING:
case WORKERPREF_DOM_WORKERNOTIFICATION:
case WORKERPREF_PERFORMANCE_LOGGING_ENABLED:
#ifdef DUMP_CONTROLLED_BY_PREF
case WORKERPREF_DUMP:
#endif

Просмотреть файл

@ -1565,7 +1565,7 @@ public:
init.mFilename = aFilename;
init.mLineno = aLineNumber;
init.mCancelable = true;
init.mBubbles = true;
init.mBubbles = false;
if (aTarget) {
nsRefPtr<ErrorEvent> event =

Просмотреть файл

@ -1321,6 +1321,13 @@ public:
return mPreferences[WORKERPREF_DOM_CACHES_TESTING];
}
bool
PerformanceLoggingEnabled() const
{
AssertIsOnWorkerThread();
return mPreferences[WORKERPREF_PERFORMANCE_LOGGING_ENABLED];
}
bool
OnLine() const
{

Просмотреть файл

@ -205,6 +205,7 @@ enum WorkerPreference
WORKERPREF_DOM_CACHES_TESTING, // dom.caches.testing.enabled
WORKERPREF_SERVICEWORKERS_TESTING, // dom.serviceWorkers.testing.enabled
WORKERPREF_INTERCEPTION_OPAQUE_ENABLED, // dom.serviceWorkers.interception.opaque.enabled
WORKERPREF_PERFORMANCE_LOGGING_ENABLED, // dom.performance.enable_user_timing_logging
WORKERPREF_COUNT
};

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<script>
function boom()
{
var w = new Worker("data:text/javascript;charset=UTF-8,");
w.postMessage(new Blob([], {}));
}
</script>
<body onload="boom();"></body>

Просмотреть файл

@ -1 +1,2 @@
load 943516.html
load 1158031.html

Просмотреть файл

@ -131,6 +131,8 @@ var interfaceNamesInGlobalScope =
"Headers",
// IMPORTANT: Do not change this list without review from a DOM peer!
"IDBCursor",
// IMPORTANT: Do not change this list without review from a DOM peer!
"IDBCursorWithValue",
// IMPORTANT: Do not change this list without review from a DOM peer!
"IDBDatabase",
// IMPORTANT: Do not change this list without review from a DOM peer!

Просмотреть файл

@ -123,6 +123,8 @@ var interfaceNamesInGlobalScope =
"Headers",
// IMPORTANT: Do not change this list without review from a DOM peer!
"IDBCursor",
// IMPORTANT: Do not change this list without review from a DOM peer!
"IDBCursorWithValue",
// IMPORTANT: Do not change this list without review from a DOM peer!
"IDBDatabase",
// IMPORTANT: Do not change this list without review from a DOM peer!

Просмотреть файл

@ -77,7 +77,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
static void
UnmarkXBLJSObject(JS::GCCellPtr aPtr, const char* aName, void* aClosure)
{
JS::ExposeObjectToActiveJS(aPtr.toObject());
JS::ExposeObjectToActiveJS(&aPtr.as<JSObject>());
}
static PLDHashOperator

Просмотреть файл

@ -107,7 +107,7 @@ nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
nsAutoCString script(js_buffer, length);
JS::RootedValue v(cx);
rv = xpc->EvalInSandboxObject(NS_ConvertUTF8toUTF16(script), filename, cx,
autoconfigSb, &v);
autoconfigSb, JSVERSION_LATEST, &v);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;

Просмотреть файл

@ -525,23 +525,6 @@ GfxPatternToCairoPattern(const Pattern& aPattern,
matrix = &pattern.mMatrix;
const std::vector<GradientStop>& stops = cairoStops->GetStops();
if (stops.size() >= 2 && stops.front().offset == stops.back().offset) {
// Certain Cairo backends that use pixman to implement gradients can have jagged
// edges occur with hard stops. Such hard stops are used for implementing certain
// types of CSS borders. Work around this by turning these hard-stops into half-pixel
// gradients to anti-alias them. See bug 1033375
Matrix patternToDevice = aTransform * pattern.mMatrix;
Float gradLength = (patternToDevice * pattern.mEnd - patternToDevice * pattern.mBegin).Length();
if (gradLength > 0) {
Float aaOffset = 0.25 / gradLength;
CairoPatternAddGradientStop(pat, stops.front(), -aaOffset);
for (size_t i = 1; i < stops.size()-1; ++i) {
CairoPatternAddGradientStop(pat, stops[i]);
}
CairoPatternAddGradientStop(pat, stops.back(), aaOffset);
break;
}
}
for (size_t i = 0; i < stops.size(); ++i) {
CairoPatternAddGradientStop(pat, stops[i]);
}

Просмотреть файл

@ -621,7 +621,9 @@ Factory::SetDirect3D10Device(ID3D10Device1 *aDevice)
// do not throw on failure; return error codes and disconnect the device
// On Windows 8 error codes are the default, but on Windows 7 the
// default is to throw (or perhaps only with some drivers?)
aDevice->SetExceptionMode(0);
if (aDevice) {
aDevice->SetExceptionMode(0);
}
mD3D10Device = aDevice;
}

Просмотреть файл

@ -213,8 +213,7 @@ _cairo_box_intersects_line_segment (cairo_box_t *box, cairo_line_t *line)
xlen = - xlen;
}
if ((t1 < 0 || t1 > xlen) &&
(t2 < 0 || t2 > xlen))
if (t1 > xlen || t2 < 0)
return FALSE;
} else {
/* Fully vertical line -- check that X is in bounds */
@ -232,8 +231,7 @@ _cairo_box_intersects_line_segment (cairo_box_t *box, cairo_line_t *line)
ylen = - ylen;
}
if ((t3 < 0 || t3 > ylen) &&
(t4 < 0 || t4 > ylen))
if (t3 > ylen || t4 < 0)
return FALSE;
} else {
/* Fully horizontal line -- check Y */

Просмотреть файл

@ -342,11 +342,11 @@ TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
#ifdef XP_WIN
LayersBackend parentBackend = aAllocator->GetCompositorBackendType();
if (parentBackend == LayersBackend::LAYERS_D3D11 &&
(aMoz2DBackend == gfx::BackendType::DIRECT2D ||
aMoz2DBackend == gfx::BackendType::DIRECT2D1_1) &&
gfxWindowsPlatform::GetPlatform()->GetD3D10Device() &&
((aMoz2DBackend == gfx::BackendType::DIRECT2D && Factory::GetDirect3D10Device()) ||
(aMoz2DBackend == gfx::BackendType::DIRECT2D1_1 && Factory::GetDirect3D11Device())) &&
aSize.width <= maxTextureSize &&
aSize.height <= maxTextureSize) {
aSize.height <= maxTextureSize)
{
texture = new TextureClientD3D11(aAllocator, aFormat, aTextureFlags);
}
if (parentBackend == LayersBackend::LAYERS_D3D9 &&

Просмотреть файл

@ -499,12 +499,6 @@ gfxASurface::GetSubpixelAntialiasingEnabled()
#endif
}
gfxMemoryLocation
gfxASurface::GetMemoryLocation() const
{
return gfxMemoryLocation::IN_PROCESS_HEAP;
}
int32_t
gfxASurface::BytePerPixelFromFormat(gfxImageFormat format)
{

Просмотреть файл

@ -159,12 +159,6 @@ public:
// to a sub-class of gfxASurface.)
virtual bool SizeOfIsMeasured() const { return false; }
/**
* Where does this surface's memory live? By default, we say it's in this
* process's heap.
*/
virtual gfxMemoryLocation GetMemoryLocation() const;
static int32_t BytePerPixelFromFormat(gfxImageFormat format);
virtual const mozilla::gfx::IntSize GetSize() const;

Просмотреть файл

@ -2237,7 +2237,7 @@ gfxPlatform::ShouldUseLayersAcceleration()
if (gfxPrefs::LayersAccelerationForceEnabled()) {
return true;
}
if (gfxPlatform::GetPlatform()->AccelerateLayersByDefault()) {
if (AccelerateLayersByDefault()) {
return true;
}
if (acceleratedEnv && *acceleratedEnv != '0') {

Просмотреть файл

@ -92,15 +92,4 @@ enum class gfxContentType {
SENTINEL = 0xffff
};
/**
* The memory used by a gfxASurface (as reported by KnownMemoryUsed()) can
* either live in this process's heap, in this process but outside the
* heap, or in another process altogether.
*/
enum class gfxMemoryLocation {
IN_PROCESS_HEAP,
IN_PROCESS_NONHEAP,
OUT_OF_PROCESS
};
#endif /* GFX_TYPES_H */

Просмотреть файл

@ -373,18 +373,18 @@ public:
NS_IMPL_ISUPPORTS(D3D9SharedTextureReporter, nsIMemoryReporter)
gfxWindowsPlatform::gfxWindowsPlatform()
: mD3D11DeviceInitialized(false)
: mRenderMode(RENDER_GDI)
, mIsWARP(false)
, mHasDeviceReset(false)
, mDoesD3D11TextureSharingWork(false)
, mAcceleration(FeatureStatus::Unused)
, mD3D11Status(FeatureStatus::Unused)
, mD2DStatus(FeatureStatus::Unused)
, mD2D1Status(FeatureStatus::Unused)
{
mUseClearTypeForDownloadableFonts = UNINITIALIZED_VALUE;
mUseClearTypeAlways = UNINITIALIZED_VALUE;
mUsingGDIFonts = false;
/*
* Initialize COM
*/
@ -392,10 +392,16 @@ gfxWindowsPlatform::gfxWindowsPlatform()
RegisterStrongMemoryReporter(new GfxD2DVramReporter());
if (gfxPrefs::Direct2DUse1_1()) {
InitD3D11Devices();
// Set up the D3D11 feature levels we can ask for.
if (IsWin8OrLater()) {
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_11_1);
}
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_11_0);
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_10_1);
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_10_0);
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_9_3);
InitializeDevices();
UpdateRenderMode();
RegisterStrongMemoryReporter(new GPUAdapterReporter());
@ -438,161 +444,106 @@ gfxWindowsPlatform::CanUseHardwareVideoDecoding()
return !IsWARP() && gfxPlatform::CanUseHardwareVideoDecoding();
}
FeatureStatus
gfxWindowsPlatform::InitD2DSupport()
{
#ifdef CAIRO_HAS_D2D_SURFACE
bool d2dBlocked = false;
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT2D, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
d2dBlocked = true;
}
}
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
d2dBlocked = true;
}
}
}
// If D2D is blocked or D3D9 is prefered, and D2D is not force-enabled, then
// we don't attempt to use D2D.
if (!gfxPrefs::Direct2DForceEnabled()) {
if (d2dBlocked) {
return FeatureStatus::Blacklisted;
}
if (gfxPrefs::LayersPreferD3D9()) {
return FeatureStatus::Disabled;
}
}
// Do not ever try to use D2D if it's explicitly disabled or if we're not
// using DWrite fonts.
if (gfxPrefs::Direct2DDisabled() || mUsingGDIFonts) {
return FeatureStatus::Disabled;
}
if (!IsVistaOrLater() || !GetD3D11Device()) {
return FeatureStatus::Unavailable;
}
if (!mDoesD3D11TextureSharingWork) {
return FeatureStatus::Failed;
}
if (InSafeMode()) {
return FeatureStatus::Blocked;
}
VerifyD2DDevice(gfxPrefs::Direct2DForceEnabled());
if (!mD3D10Device || !GetD3D11Device()) {
return FeatureStatus::Failed;
}
mRenderMode = RENDER_DIRECT2D;
mUseDirectWrite = true;
return FeatureStatus::Available;
#else
return FeatureStatus::Unavailable;
#endif
}
void
bool
gfxWindowsPlatform::InitDWriteSupport()
{
#ifdef CAIRO_HAS_DWRITE_FONT
// Enable when it's preffed on -and- we're using Vista or higher. Or when
// we're going to use D2D.
if (mDWriteFactory || (!mUseDirectWrite || !IsVistaOrLater())) {
return;
}
MOZ_ASSERT(!mDWriteFactory && IsVistaOrLater());
mozilla::ScopedGfxFeatureReporter reporter("DWrite");
decltype(DWriteCreateFactory)* createDWriteFactory = (decltype(DWriteCreateFactory)*)
GetProcAddress(LoadLibraryW(L"dwrite.dll"), "DWriteCreateFactory");
if (!createDWriteFactory) {
return;
return false;
}
// I need a direct pointer to be able to cast to IUnknown**, I also need to
// remember to release this because the nsRefPtr will AddRef it.
IDWriteFactory *factory;
RefPtr<IDWriteFactory> factory;
HRESULT hr = createDWriteFactory(
DWRITE_FACTORY_TYPE_SHARED,
__uuidof(IDWriteFactory),
reinterpret_cast<IUnknown**>(&factory));
if (SUCCEEDED(hr) && factory) {
mDWriteFactory = factory;
factory->Release();
hr = mDWriteFactory->CreateTextAnalyzer(getter_AddRefs(mDWriteAnalyzer));
(IUnknown **)((IDWriteFactory **)byRef(factory)));
if (FAILED(hr) || !factory) {
return false;
}
mDWriteFactory = factory;
SetupClearTypeParams();
reporter.SetSuccessful();
return true;
}
if (hr == S_OK) {
reporter.SetSuccessful();
bool
gfxWindowsPlatform::HandleDeviceReset()
{
DeviceResetReason resetReason = DeviceResetReason::OK;
if (!DidRenderingDeviceReset(&resetReason)) {
return false;
}
#endif
Telemetry::Accumulate(Telemetry::DEVICE_RESET_REASON, uint32_t(resetReason));
// Remove devices and adapters.
mD3D10Device = nullptr;
mD3D11Device = nullptr;
mD3D11ContentDevice = nullptr;
mD3D11ImageBridgeDevice = nullptr;
mAdapter = nullptr;
Factory::SetDirect3D11Device(nullptr);
Factory::SetDirect3D10Device(nullptr);
// Reset local state. Note: we leave feature status variables as-is. They
// will be recomputed by InitializeDevices().
mIsWARP = false;
mHasDeviceReset = false;
mDoesD3D11TextureSharingWork = false;
mDeviceResetReason = DeviceResetReason::OK;
imgLoader::Singleton()->ClearCache(true);
imgLoader::Singleton()->ClearCache(false);
gfxAlphaBoxBlur::ShutdownBlurCache();
InitializeDevices();
return true;
}
void
gfxWindowsPlatform::UpdateBackendPrefs()
{
uint32_t canvasMask = BackendTypeBit(BackendType::CAIRO);
uint32_t contentMask = BackendTypeBit(BackendType::CAIRO);
BackendType defaultBackend = BackendType::CAIRO;
if (GetD2DStatus() == FeatureStatus::Available) {
mRenderMode = RENDER_DIRECT2D;
canvasMask |= BackendTypeBit(BackendType::DIRECT2D);
contentMask |= BackendTypeBit(BackendType::DIRECT2D);
if (GetD2D1Status() == FeatureStatus::Available) {
contentMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
canvasMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
defaultBackend = BackendType::DIRECT2D1_1;
} else {
defaultBackend = BackendType::DIRECT2D;
}
} else {
mRenderMode = RENDER_GDI;
canvasMask |= BackendTypeBit(BackendType::SKIA);
}
contentMask |= BackendTypeBit(BackendType::SKIA);
InitBackendPrefs(canvasMask, defaultBackend, contentMask, defaultBackend);
}
void
gfxWindowsPlatform::UpdateRenderMode()
{
/* Pick the default render mode for
* desktop.
*/
bool didReset = false;
DeviceResetReason resetReason = DeviceResetReason::OK;
if (DidRenderingDeviceReset(&resetReason)) {
Telemetry::Accumulate(Telemetry::DEVICE_RESET_REASON, uint32_t(resetReason));
mD3D11DeviceInitialized = false;
mD3D11Device = nullptr;
mD3D11ContentDevice = nullptr;
mAdapter = nullptr;
mDeviceResetReason = DeviceResetReason::OK;
mHasDeviceReset = false;
bool didReset = HandleDeviceReset();
imgLoader::Singleton()->ClearCache(true);
imgLoader::Singleton()->ClearCache(false);
gfxAlphaBoxBlur::ShutdownBlurCache();
Factory::SetDirect3D11Device(nullptr);
UpdateBackendPrefs();
didReset = true;
}
mRenderMode = RENDER_GDI;
mUseDirectWrite = gfxPrefs::DirectWriteFontRenderingEnabled();
mD2DStatus = InitD2DSupport();
InitDWriteSupport();
uint32_t canvasMask = BackendTypeBit(BackendType::CAIRO);
uint32_t contentMask = BackendTypeBit(BackendType::CAIRO);
BackendType defaultBackend = BackendType::CAIRO;
if (mRenderMode == RENDER_DIRECT2D) {
canvasMask |= BackendTypeBit(BackendType::DIRECT2D);
contentMask |= BackendTypeBit(BackendType::DIRECT2D);
if (gfxPrefs::Direct2DUse1_1() && Factory::SupportsD2D1() &&
GetD3D11ContentDevice()) {
contentMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
canvasMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
defaultBackend = BackendType::DIRECT2D1_1;
} else {
defaultBackend = BackendType::DIRECT2D;
}
} else {
canvasMask |= BackendTypeBit(BackendType::SKIA);
}
contentMask |= BackendTypeBit(BackendType::SKIA);
InitBackendPrefs(canvasMask, defaultBackend,
contentMask, defaultBackend);
if (didReset) {
mScreenReferenceDrawTarget = CreateOffscreenContentDrawTarget(IntSize(1, 1), SurfaceFormat::B8G8R8A8);
}
if (didReset) {
mScreenReferenceDrawTarget =
CreateOffscreenContentDrawTarget(IntSize(1, 1), SurfaceFormat::B8G8R8A8);
}
}
#ifdef CAIRO_HAS_D2D_SURFACE
@ -644,11 +595,6 @@ void
gfxWindowsPlatform::VerifyD2DDevice(bool aAttemptForce)
{
#ifdef CAIRO_HAS_D2D_SURFACE
DriverInitCrashDetection detectCrashes;
if (detectCrashes.DisableAcceleration()) {
return;
}
if (mD3D10Device) {
if (SUCCEEDED(mD3D10Device->GetDeviceRemovedReason())) {
return;
@ -716,7 +662,6 @@ gfxWindowsPlatform::VerifyD2DDevice(bool aAttemptForce)
gfxPlatformFontList*
gfxWindowsPlatform::CreatePlatformFontList()
{
mUsingGDIFonts = false;
gfxPlatformFontList *pfl;
#ifdef CAIRO_HAS_DWRITE_FONT
// bug 630201 - older pre-RTM versions of Direct2D/DirectWrite cause odd
@ -730,11 +675,10 @@ gfxWindowsPlatform::CreatePlatformFontList()
// but apparently it can - see bug 594865.
// So we're going to fall back to GDI fonts & rendering.
gfxPlatformFontList::Shutdown();
SetRenderMode(RENDER_GDI);
DisableD2D();
}
#endif
pfl = new gfxGDIFontList();
mUsingGDIFonts = true;
if (NS_SUCCEEDED(pfl->InitFontList())) {
return pfl;
@ -744,6 +688,22 @@ gfxWindowsPlatform::CreatePlatformFontList()
return nullptr;
}
// This function will permanently disable D2D for the session. It's intended to
// be used when, after initially chosing to use Direct2D, we encounter a
// scenario we can't support.
//
// This is called during gfxPlatform::Init() so at this point there should be no
// DrawTargetD2D/1 instances.
void
gfxWindowsPlatform::DisableD2D()
{
mD2DStatus = FeatureStatus::Failed;
mD2D1Status = FeatureStatus::Failed;
Factory::SetDirect3D11Device(nullptr);
Factory::SetDirect3D10Device(nullptr);
UpdateBackendPrefs();
}
already_AddRefed<gfxASurface>
gfxWindowsPlatform::CreateOffscreenSurface(const IntSize& aSize,
gfxImageFormat aFormat)
@ -1556,36 +1516,18 @@ gfxWindowsPlatform::GetD3D9DeviceManager()
ID3D11Device*
gfxWindowsPlatform::GetD3D11Device()
{
if (mD3D11DeviceInitialized) {
return mD3D11Device;
}
InitD3D11Devices();
return mD3D11Device;
}
ID3D11Device*
gfxWindowsPlatform::GetD3D11ContentDevice()
{
if (mD3D11DeviceInitialized) {
return mD3D11ContentDevice;
}
InitD3D11Devices();
return mD3D11ContentDevice;
}
ID3D11Device*
gfxWindowsPlatform::GetD3D11ImageBridgeDevice()
{
if (mD3D11DeviceInitialized) {
return mD3D11ImageBridgeDevice;
}
InitD3D11Devices();
return mD3D11ImageBridgeDevice;
}
@ -1918,31 +1860,42 @@ bool DoesD3D11AlphaTextureSharingWork(ID3D11Device *device)
return DoesD3D11TextureSharingWorkInternal(device, DXGI_FORMAT_R8_UNORM, D3D11_BIND_SHADER_RESOURCE);
}
static inline bool
CanUseWARP()
{
if (gfxPrefs::LayersD3D11ForceWARP()) {
return true;
}
// It seems like nvdxgiwrap makes a mess of WARP. See bug 1154703.
if (!IsWin8OrLater() ||
gfxPrefs::LayersD3D11DisableWARP() ||
GetModuleHandleA("nvdxgiwrap.dll"))
{
return false;
}
return true;
}
auto
gfxWindowsPlatform::CheckD3D11Support() -> D3D11Status
{
if (gfxPrefs::LayersD3D11ForceWARP()) {
return D3D11Status::ForceWARP;
return D3D11Status::OnlyWARP;
}
if (nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo()) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
// See if we can use WARP instead.
//
// It seems like nvdxgiwrap makes a mess of WARP. See bug 1154703 for more.
if (gfxPrefs::LayersD3D11DisableWARP() || GetModuleHandleA("nvdxgiwrap.dll")) {
if (!CanUseWARP()) {
return D3D11Status::Blocked;
}
return D3D11Status::TryWARP;
return D3D11Status::OnlyWARP;
}
}
}
// Either nsIGfxInfo was bugged or we're not blacklisted.
if (!GetDXGIAdapter()) {
return D3D11Status::TryWARP;
return D3D11Status::OnlyWARP;
}
return D3D11Status::Ok;
}
@ -1953,7 +1906,7 @@ gfxWindowsPlatform::CheckD3D11Support() -> D3D11Status
decltype(D3D11CreateDevice)* sD3D11CreateDeviceFn = nullptr;
bool
gfxWindowsPlatform::AttemptD3D11DeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>& aFeatureLevels)
gfxWindowsPlatform::AttemptD3D11DeviceCreation()
{
RefPtr<IDXGIAdapter1> adapter = GetDXGIAdapter();
MOZ_ASSERT(adapter);
@ -1966,7 +1919,7 @@ gfxWindowsPlatform::AttemptD3D11DeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>
// D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS
// to prevent bug 1092260. IE 11 also uses this flag.
D3D11_CREATE_DEVICE_BGRA_SUPPORT | D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
aFeatureLevels.Elements(), aFeatureLevels.Length(),
mFeatureLevels.Elements(), mFeatureLevels.Length(),
D3D11_SDK_VERSION, byRef(mD3D11Device), nullptr, nullptr);
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
gfxCriticalError() << "Crash during D3D11 device creation";
@ -1986,15 +1939,14 @@ gfxWindowsPlatform::AttemptD3D11DeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>
// Only test this when not using WARP since it can fail and cause
// GetDeviceRemovedReason to return weird values.
mDoesD3D11TextureSharingWork = ::DoesD3D11TextureSharingWork(mD3D11Device);
mD3D11Device->SetExceptionMode(0);
mIsWARP = false;
return true;
}
bool
gfxWindowsPlatform::AttemptWARPDeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>& aFeatureLevels)
gfxWindowsPlatform::AttemptWARPDeviceCreation()
{
MOZ_ASSERT(!mD3D11Device);
ScopedGfxFeatureReporter reporterWARP("D3D11-WARP", gfxPrefs::LayersD3D11ForceWARP());
MOZ_SEH_TRY {
@ -2004,7 +1956,7 @@ gfxWindowsPlatform::AttemptWARPDeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>&
// D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS
// to prevent bug 1092260. IE 11 also uses this flag.
D3D11_CREATE_DEVICE_BGRA_SUPPORT,
aFeatureLevels.Elements(), aFeatureLevels.Length(),
mFeatureLevels.Elements(), mFeatureLevels.Length(),
D3D11_SDK_VERSION, byRef(mD3D11Device), nullptr, nullptr);
if (FAILED(hr)) {
@ -2017,14 +1969,21 @@ gfxWindowsPlatform::AttemptWARPDeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>&
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
gfxCriticalError() << "Exception occurred initializing WARP D3D11 device!";
return false;
}
// Only test for texture sharing on Windows 8 since it puts the device into
// an unusable state if used on Windows 7
if (IsWin8OrLater()) {
mDoesD3D11TextureSharingWork = ::DoesD3D11TextureSharingWork(mD3D11Device);
}
mD3D11Device->SetExceptionMode(0);
mIsWARP = true;
return true;
}
bool
gfxWindowsPlatform::AttemptD3D11ContentDeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>& aFeatureLevels)
gfxWindowsPlatform::AttemptD3D11ContentDeviceCreation()
{
HRESULT hr = E_INVALIDARG;
MOZ_SEH_TRY {
@ -2033,24 +1992,35 @@ gfxWindowsPlatform::AttemptD3D11ContentDeviceCreation(const nsTArray<D3D_FEATURE
mIsWARP ? D3D_DRIVER_TYPE_WARP : D3D_DRIVER_TYPE_UNKNOWN,
nullptr,
D3D11_CREATE_DEVICE_BGRA_SUPPORT,
aFeatureLevels.Elements(), aFeatureLevels.Length(),
mFeatureLevels.Elements(), mFeatureLevels.Length(),
D3D11_SDK_VERSION, byRef(mD3D11ContentDevice), nullptr, nullptr);
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
return false;
}
return SUCCEEDED(hr);
if (FAILED(hr)) {
return false;
}
mD3D11ContentDevice->SetExceptionMode(0);
nsRefPtr<ID3D10Multithread> multi;
mD3D11ContentDevice->QueryInterface(__uuidof(ID3D10Multithread), getter_AddRefs(multi));
multi->SetMultithreadProtected(TRUE);
Factory::SetDirect3D11Device(mD3D11ContentDevice);
return true;
}
bool
gfxWindowsPlatform::AttemptD3D11ImageBridgeDeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>& aFeatureLevels)
gfxWindowsPlatform::AttemptD3D11ImageBridgeDeviceCreation()
{
HRESULT hr = E_INVALIDARG;
MOZ_SEH_TRY{
hr =
sD3D11CreateDeviceFn(GetDXGIAdapter(), D3D_DRIVER_TYPE_UNKNOWN, nullptr,
D3D11_CREATE_DEVICE_BGRA_SUPPORT,
aFeatureLevels.Elements(), aFeatureLevels.Length(),
mFeatureLevels.Elements(), mFeatureLevels.Length(),
D3D11_SDK_VERSION, byRef(mD3D11ImageBridgeDevice), nullptr, nullptr);
} MOZ_SEH_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
return false;
@ -2061,112 +2031,196 @@ gfxWindowsPlatform::AttemptD3D11ImageBridgeDeviceCreation(const nsTArray<D3D_FEA
}
mD3D11ImageBridgeDevice->SetExceptionMode(0);
return DoesD3D11AlphaTextureSharingWork(mD3D11ImageBridgeDevice);
if (!DoesD3D11AlphaTextureSharingWork(mD3D11ImageBridgeDevice)) {
mD3D11ImageBridgeDevice = nullptr;
return false;
}
return true;
}
void
gfxWindowsPlatform::InitD3D11Devices()
gfxWindowsPlatform::InitializeDevices()
{
// This function attempts to initialize our D3D11 devices. If the hardware
// is not blacklisted for D3D11 layers. This will first attempt to create a
// hardware accelerated device. If this creation fails or the hardware is
// blacklisted, then this function will abort if WARP is disabled, causing us
// to fallback to D3D9 or Basic layers. If WARP is not disabled it will use
// a WARP device which should always be available on Windows 7 and higher.
mD3D11DeviceInitialized = true;
mDoesD3D11TextureSharingWork = false;
MOZ_ASSERT(!mD3D11Device);
// If we previously crashed initializing devices, or if we're in safe mode,
// bail out now.
DriverInitCrashDetection detectCrashes;
if (InSafeMode() || detectCrashes.DisableAcceleration()) {
mD3D11Status = FeatureStatus::Blocked;
if (detectCrashes.DisableAcceleration() || InSafeMode()) {
mAcceleration = FeatureStatus::Blocked;
return;
}
D3D11Status status = CheckD3D11Support();
if (status == D3D11Status::Blocked) {
// If acceleration is disabled, we refuse to initialize anything.
if (!ShouldUseLayersAcceleration()) {
mAcceleration = FeatureStatus::Disabled;
return;
}
// At this point, as far as we know, we can probably accelerate.
mAcceleration = FeatureStatus::Available;
// If we're going to prefer D3D9, stop here. The rest of this function
// attempts to use D3D11 features.
if (gfxPrefs::LayersPreferD3D9()) {
mD3D11Status = FeatureStatus::Disabled;
return;
}
// First, initialize D3D11. If this succeeds we attempt to use Direct2D.
InitializeD3D11();
if (mD3D11Status == FeatureStatus::Available) {
InitializeD2D();
}
}
void
gfxWindowsPlatform::InitializeD3D11()
{
// This function attempts to initialize our D3D11 devices, if the hardware
// is not blacklisted for D3D11 layers. This first attempt will try to create
// a hardware accelerated device. If this creation fails or the hardware is
// blacklisted, then this function will abort if WARP is disabled, causing us
// to fallback to D3D9 or Basic layers. If WARP is not disabled it will use
// a WARP device which should always be available on Windows 7 and higher.
// Check if D3D11 is supported on this hardware.
D3D11Status support = CheckD3D11Support();
if (support == D3D11Status::Blocked) {
mD3D11Status = FeatureStatus::Blacklisted;
return;
}
// Check if D3D11 is available on this system.
nsModuleHandle d3d11Module(LoadLibrarySystem32(L"d3d11.dll"));
sD3D11CreateDeviceFn =
(decltype(D3D11CreateDevice)*)GetProcAddress(d3d11Module, "D3D11CreateDevice");
if (!sD3D11CreateDeviceFn) {
// We should just be on Windows Vista or XP in this case.
mD3D11Status = FeatureStatus::Unavailable;
return;
}
nsTArray<D3D_FEATURE_LEVEL> featureLevels;
if (IsWin8OrLater()) {
featureLevels.AppendElement(D3D_FEATURE_LEVEL_11_1);
// If hardware acceleration is allowed, attempt to create a device. If this
// fails, we fall back to WARP.
if (support == D3D11Status::Ok && !AttemptD3D11DeviceCreation()) {
support = D3D11Status::OnlyWARP;
}
featureLevels.AppendElement(D3D_FEATURE_LEVEL_11_0);
featureLevels.AppendElement(D3D_FEATURE_LEVEL_10_1);
featureLevels.AppendElement(D3D_FEATURE_LEVEL_10_0);
featureLevels.AppendElement(D3D_FEATURE_LEVEL_9_3);
if (status == D3D11Status::Ok) {
if (!AttemptD3D11DeviceCreation(featureLevels)) {
status = D3D11Status::TryWARP;
}
}
if (IsWin8OrLater() &&
!gfxPrefs::LayersD3D11DisableWARP() &&
(status == D3D11Status::TryWARP || status == D3D11Status::ForceWARP))
{
AttemptWARPDeviceCreation(featureLevels);
mD3D11Status = FeatureStatus::Failed;
}
// Only test for texture sharing on Windows 8 since it puts the device into
// an unusable state if used on Windows 7
if (mD3D11Device && IsWin8OrLater()) {
mDoesD3D11TextureSharingWork = ::DoesD3D11TextureSharingWork(mD3D11Device);
if (support == D3D11Status::OnlyWARP && CanUseWARP()) {
AttemptWARPDeviceCreation();
}
if (!mD3D11Device) {
// We could not get a D3D11 compositor, and there's nothing more we can try.
// Nothing more we can do.
mD3D11Status = FeatureStatus::Failed;
return;
}
mD3D11Device->SetExceptionMode(0);
// If we got here, we successfully got a D3D11 device.
mD3D11Status = FeatureStatus::Available;
// We create our device for D2D content drawing here. Normally we don't use
// D2D content drawing when using WARP. However when WARP is forced by
// default we will let Direct2D use WARP as well.
if (Factory::SupportsD2D1() && (!mIsWARP || (status == D3D11Status::ForceWARP))) {
if (!AttemptD3D11ContentDeviceCreation(featureLevels)) {
mD3D11ContentDevice = nullptr;
d3d11Module.disown();
return;
}
mD3D11ContentDevice->SetExceptionMode(0);
nsRefPtr<ID3D10Multithread> multi;
mD3D11ContentDevice->QueryInterface(__uuidof(ID3D10Multithread), getter_AddRefs(multi));
multi->SetMultithreadProtected(TRUE);
Factory::SetDirect3D11Device(mD3D11ContentDevice);
}
MOZ_ASSERT(mD3D11Device);
if (!mIsWARP) {
if (!AttemptD3D11ImageBridgeDeviceCreation(featureLevels)) {
mD3D11ImageBridgeDevice = nullptr;
}
AttemptD3D11ImageBridgeDeviceCreation();
}
// We leak these everywhere and we need them our entire runtime anyway, let's
// leak it here as well.
// leak it here as well. We keep the pointer to sD3D11CreateDeviceFn around
// as well for D2D1 and device resets.
d3d11Module.disown();
}
static bool
IsD2DBlacklisted()
{
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT2D, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
return true;
}
}
}
return false;
}
void
gfxWindowsPlatform::InitializeD2D()
{
if (!gfxPrefs::Direct2DForceEnabled()) {
if (IsD2DBlacklisted()) {
mD2DStatus = FeatureStatus::Blacklisted;
return;
}
}
// Do not ever try to use D2D if it's explicitly disabled.
if (gfxPrefs::Direct2DDisabled()) {
mD2DStatus = FeatureStatus::Disabled;
return;
}
// Direct2D is only Vista or higher, but we require a D3D11 compositor to
// use it. (This check may be implied by the fact that we do not get here
// without a D3D11 compositor device.)
if (!IsVistaOrLater()) {
mD2DStatus = FeatureStatus::Unavailable;
return;
}
if (!mDoesD3D11TextureSharingWork) {
mD2DStatus = FeatureStatus::Failed;
return;
}
// Using Direct2D depends on DWrite support.
if (!mDWriteFactory && !InitDWriteSupport()) {
mD2DStatus = FeatureStatus::Failed;
return;
}
// Initialize D2D 1.1.
InitializeD2D1();
// Initialize D2D 1.0.
VerifyD2DDevice(gfxPrefs::Direct2DForceEnabled());
if (!mD3D10Device) {
mD2DStatus = FeatureStatus::Failed;
return;
}
mD2DStatus = FeatureStatus::Available;
}
bool
gfxWindowsPlatform::InitializeD2D1()
{
ScopedGfxFeatureReporter d2d1_1("D2D1.1");
if (!Factory::SupportsD2D1()) {
mD2D1Status = FeatureStatus::Unavailable;
return false;
}
if (!gfxPrefs::Direct2DUse1_1()) {
mD2D1Status = FeatureStatus::Disabled;
return false;
}
// Normally we don't use D2D content drawing when using WARP. However if
// WARP is force-enabled, we wlil let Direct2D use WARP as well.
if (mIsWARP && !gfxPrefs::LayersD3D11ForceWARP()) {
mD2D1Status = FeatureStatus::Blocked;
return false;
}
if (!AttemptD3D11ContentDeviceCreation()) {
mD2D1Status = FeatureStatus::Failed;
return false;
}
mD2D1Status = FeatureStatus::Available;
d2d1_1.SetSuccessful();
return true;
}
already_AddRefed<ID3D11Device>
gfxWindowsPlatform::CreateD3D11DecoderDevice()
{
@ -2442,23 +2496,33 @@ gfxWindowsPlatform::GetAcceleratedCompositorBackends(nsTArray<LayersBackend>& aB
}
}
// Some features are dependent on other features. If this is the case, we
// try to propagate the status of the parent feature if it wasn't available.
FeatureStatus
gfxWindowsPlatform::GetD2D1Status()
gfxWindowsPlatform::GetD3D11Status() const
{
if (GetD2DStatus() != FeatureStatus::Available ||
!Factory::SupportsD2D1())
{
if (mAcceleration != FeatureStatus::Available) {
return mAcceleration;
}
return mD3D11Status;
}
FeatureStatus
gfxWindowsPlatform::GetD2DStatus() const
{
if (GetD3D11Status() != FeatureStatus::Available) {
return FeatureStatus::Unavailable;
}
return mD2DStatus;
}
if (!GetD3D11ContentDevice()) {
return FeatureStatus::Failed;
FeatureStatus
gfxWindowsPlatform::GetD2D1Status() const
{
if (GetD3D11Status() != FeatureStatus::Available) {
return FeatureStatus::Unavailable;
}
if (!gfxPrefs::Direct2DUse1_1()) {
return FeatureStatus::Disabled;
}
return FeatureStatus::Available;
return mD2D1Status;
}
unsigned

Просмотреть файл

@ -229,9 +229,8 @@ public:
#ifdef CAIRO_HAS_DWRITE_FONT
IDWriteFactory *GetDWriteFactory() { return mDWriteFactory; }
inline bool DWriteEnabled() { return mUseDirectWrite; }
inline bool DWriteEnabled() { return !!mDWriteFactory; }
inline DWRITE_MEASURING_MODE DWriteMeasuringMode() { return mMeasuringMode; }
IDWriteTextAnalyzer *GetDWriteAnalyzer() { return mDWriteAnalyzer; }
IDWriteRenderingParams *GetRenderingParams(TextRenderingMode aRenderMode)
{ return mRenderingParams[aRenderMode]; }
@ -263,17 +262,18 @@ public:
}
bool SupportsApzTouchInput() const override;
// Recreate devices as needed for a device reset. Returns true if a device
// reset occurred.
bool HandleDeviceReset();
void UpdateBackendPrefs();
// Return the diagnostic status of DirectX initialization. If
// initialization has not been attempted, this returns
// FeatureStatus::Unused.
mozilla::gfx::FeatureStatus GetD3D11Status() const {
return mD3D11Status;
}
mozilla::gfx::FeatureStatus GetD2DStatus() const {
return mD2DStatus;
}
mozilla::gfx::FeatureStatus GetD3D11Status() const;
mozilla::gfx::FeatureStatus GetD2DStatus() const;
mozilla::gfx::FeatureStatus GetD2D1Status() const;
unsigned GetD3D11Version();
mozilla::gfx::FeatureStatus GetD2D1Status();
virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
static mozilla::Atomic<size_t> sD3D11MemoryUsed;
@ -286,6 +286,7 @@ protected:
return true;
}
void GetAcceleratedCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aBackends);
virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size);
protected:
RenderMode mRenderMode;
@ -296,34 +297,31 @@ protected:
private:
void Init();
void InitD3D11Devices();
void InitializeDevices();
void InitializeD3D11();
void InitializeD2D();
bool InitializeD2D1();
bool InitDWriteSupport();
// Used by InitD3D11Devices().
void DisableD2D();
// Used by InitializeD3D11().
enum class D3D11Status {
Ok,
TryWARP,
ForceWARP,
OnlyWARP,
Blocked
};
D3D11Status CheckD3D11Support();
bool AttemptD3D11DeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>& aFeatureLevels);
bool AttemptWARPDeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>& aFeatureLevels);
bool AttemptD3D11ImageBridgeDeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>& aFeatureLevels);
bool AttemptD3D11ContentDeviceCreation(const nsTArray<D3D_FEATURE_LEVEL>& aFeatureLevels);
// Used by UpdateRenderMode().
mozilla::gfx::FeatureStatus InitD2DSupport();
void InitDWriteSupport();
bool AttemptD3D11DeviceCreation();
bool AttemptWARPDeviceCreation();
bool AttemptD3D11ImageBridgeDeviceCreation();
bool AttemptD3D11ContentDeviceCreation();
IDXGIAdapter1 *GetDXGIAdapter();
bool IsDeviceReset(HRESULT hr, DeviceResetReason* aReason);
bool mUseDirectWrite;
bool mUsingGDIFonts;
#ifdef CAIRO_HAS_DWRITE_FONT
nsRefPtr<IDWriteFactory> mDWriteFactory;
nsRefPtr<IDWriteTextAnalyzer> mDWriteAnalyzer;
nsRefPtr<IDWriteRenderingParams> mRenderingParams[TEXT_RENDERING_COUNT];
DWRITE_MEASURING_MODE mMeasuringMode;
#endif
@ -333,17 +331,20 @@ private:
mozilla::RefPtr<ID3D11Device> mD3D11Device;
mozilla::RefPtr<ID3D11Device> mD3D11ContentDevice;
mozilla::RefPtr<ID3D11Device> mD3D11ImageBridgeDevice;
bool mD3D11DeviceInitialized;
mozilla::RefPtr<mozilla::layers::ReadbackManagerD3D11> mD3D11ReadbackManager;
bool mIsWARP;
bool mHasDeviceReset;
bool mDoesD3D11TextureSharingWork;
DeviceResetReason mDeviceResetReason;
// These should not be accessed directly. Use the Get[Feature]Status
// accessors instead.
mozilla::gfx::FeatureStatus mAcceleration;
mozilla::gfx::FeatureStatus mD3D11Status;
mozilla::gfx::FeatureStatus mD2DStatus;
mozilla::gfx::FeatureStatus mD2D1Status;
virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size);
nsTArray<D3D_FEATURE_LEVEL> mFeatureLevels;
};
#endif /* GFX_WINDOWS_PLATFORM_H */

Просмотреть файл

@ -300,9 +300,3 @@ gfxWindowsSurface::GetSize() const
return mozilla::gfx::IntSize(cairo_win32_surface_get_width(mSurface),
cairo_win32_surface_get_height(mSurface));
}
gfxMemoryLocation
gfxWindowsSurface::GetMemoryLocation() const
{
return gfxMemoryLocation::IN_PROCESS_NONHEAP;
}

Просмотреть файл

@ -65,10 +65,6 @@ public:
const mozilla::gfx::IntSize GetSize() const;
// The memory used by this surface lives in this process's address space,
// but not in the heap.
virtual gfxMemoryLocation GetMemoryLocation() const;
private:
void MakeInvalid(mozilla::gfx::IntSize& size);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше