Merge m-c to f-t

This commit is contained in:
Phil Ringnalda 2014-03-22 17:48:30 -07:00
commit 6b1d7eec4c
156 changed files with 4173 additions and 2968 deletions

View File

@ -187,7 +187,8 @@ pref("privacy.item.syncAccount", true);
// base url for the wifi geolocation network provider // base url for the wifi geolocation network provider
pref("geo.provider.use_mls", false); pref("geo.provider.use_mls", false);
pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%"); pref("geo.cell.scan", true);
pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZ_MOZILLA_API_KEY%");
// enable geo // enable geo
pref("geo.enabled", true); pref("geo.enabled", true);

View File

@ -34,11 +34,6 @@ var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptS
let permissionSpecificChecker = {}; let permissionSpecificChecker = {};
XPCOMUtils.defineLazyServiceGetter(this,
"PermSettings",
"@mozilla.org/permissionSettings;1",
"nsIDOMPermissionSettings");
XPCOMUtils.defineLazyServiceGetter(this, XPCOMUtils.defineLazyServiceGetter(this,
"AudioManager", "AudioManager",
"@mozilla.org/telephony/audiomanager;1", "@mozilla.org/telephony/audiomanager;1",

View File

@ -1369,6 +1369,11 @@ pref("dom.debug.propagate_gesture_events_through_content", false);
// The request URL of the GeoLocation backend. // The request URL of the GeoLocation backend.
pref("geo.wifi.uri", "https://www.googleapis.com/geolocation/v1/geolocate?key=%GOOGLE_API_KEY%"); pref("geo.wifi.uri", "https://www.googleapis.com/geolocation/v1/geolocate?key=%GOOGLE_API_KEY%");
#ifdef RELEASE_BUILD
pref("geo.wifi.logging.enabled", false);
#else
pref("geo.wifi.logging.enabled", true);
#endif
// Necko IPC security checks only needed for app isolation for cookies/cache/etc: // Necko IPC security checks only needed for app isolation for cookies/cache/etc:
// currently irrelevant for desktop e10s // currently irrelevant for desktop e10s

View File

@ -22,6 +22,9 @@ export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x86:${_VSPAT
## paths: win8 sdk x86 (32-bit) tools, msvc 10 (32-bit) build toolchain, moz tools ## ## paths: win8 sdk x86 (32-bit) tools, msvc 10 (32-bit) build toolchain, moz tools ##
export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x86:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:/c/mozilla-build/moztools:${PATH}" export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x86:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:/c/mozilla-build/moztools:${PATH}"
## WindowsSDKDir ##
export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.0/"
. $topsrcdir/build/mozconfig.vs2010-common . $topsrcdir/build/mozconfig.vs2010-common
mk_export_correct_style LIB mk_export_correct_style LIB

View File

@ -19,6 +19,9 @@ export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x64:${_VSPAT
## paths: win8 sdk x64 (64-bit) tools, msvc 10 (64-bit) build toolchain, moz tools ## ## paths: win8 sdk x64 (64-bit) tools, msvc 10 (64-bit) build toolchain, moz tools ##
export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x64:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN/amd64:${_VSPATH}/VC/BIN/x86_amd64:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:${PATH}" export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x64:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN/amd64:${_VSPATH}/VC/BIN/x86_amd64:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:${PATH}"
## WindowsSDKDir ##
export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.0/"
# Use 32bit linker for PGO crash bug. # Use 32bit linker for PGO crash bug.
# https://connect.microsoft.com/VisualStudio/feedback/details/686117/ # https://connect.microsoft.com/VisualStudio/feedback/details/686117/
if [ -f /c/PROGRA~2/MICROS~2.0/VC/BIN/x86_amd64/link.exe ]; then if [ -f /c/PROGRA~2/MICROS~2.0/VC/BIN/x86_amd64/link.exe ]; then

View File

@ -903,7 +903,6 @@ LOCAL_INCLUDES += \
ifeq (WINNT,$(OS_TARGET)) ifeq (WINNT,$(OS_TARGET))
# These get set via VC project file settings for normal GYP builds. # These get set via VC project file settings for normal GYP builds.
DEFINES += -DUNICODE -D_UNICODE DEFINES += -DUNICODE -D_UNICODE
LOCAL_INCLUDES += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
endif endif
DISABLE_STL_WRAPPING := 1 DISABLE_STL_WRAPPING := 1

View File

@ -5770,10 +5770,12 @@ dnl = * only applies to win32
dnl = * enabled by default (shipping build); requires explicit --disable to disable dnl = * enabled by default (shipping build); requires explicit --disable to disable
dnl ======================================================== dnl ========================================================
MOZ_ANGLE_RENDERER= MOZ_ANGLE_RENDERER=
MOZ_DIRECTX_SDK_PATH=
MOZ_DIRECTX_SDK_CPU_SUFFIX= MOZ_DIRECTX_SDK_CPU_SUFFIX=
MOZ_D3DCOMPILER_CAB= MOZ_DIRECTX_SDK_PATH=
MOZ_D3DCOMPILER_DLL= MOZ_D3DCOMPILER_DLL=
MOZ_HAS_WINSDK_WITH_D3D=
MOZ_D3DCOMPILER_DLL_PATH=
MOZ_D3DCOMPILER_CAB=
case "$target_os" in case "$target_os" in
*mingw*) *mingw*)
MOZ_ANGLE_RENDERER=1 MOZ_ANGLE_RENDERER=1
@ -5795,6 +5797,11 @@ MOZ_ARG_DISABLE_BOOL(webgl,
MOZ_WEBGL_DISABLED=1, MOZ_WEBGL_DISABLED=1,
MOZ_WEBGL_DISABLED=) MOZ_WEBGL_DISABLED=)
MOZ_ARG_ENABLE_BOOL(winsdk-directx,
[ --enable-winsdk-directx use DirectX SDK in Windows SDK],
MOZ_WINSDK_DIRECTX=1,
MOZ_WINSDK_DIRECTX=)
if test -n "$MOZ_WEBGL_DISABLED"; then if test -n "$MOZ_WEBGL_DISABLED"; then
MOZ_WEBGL= MOZ_WEBGL=
MOZ_ANGLE_RENDERER= MOZ_ANGLE_RENDERER=
@ -5808,6 +5815,7 @@ if test -n "$MOZ_WEBGL_CONFORMANT"; then
AC_DEFINE(MOZ_WEBGL_CONFORMANT) AC_DEFINE(MOZ_WEBGL_CONFORMANT)
fi fi
# Locate a DirectX SDK here so we can use it for both ANGLE and # Locate a DirectX SDK here so we can use it for both ANGLE and
# Joystick support. # Joystick support.
if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
@ -5819,37 +5827,95 @@ if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1` MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
fi fi
MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'` MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'`
fi
if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
AC_MSG_ERROR([Found the February 2010 DirectX SDK. Need the June 2010 DirectX SDK, or newer. Upgrade your SDK or reconfigure with --disable-webgl.])
fi
if test -n "$MOZ_DIRECTX_SDK_PATH" && if test -n "$MOZ_DIRECTX_SDK_PATH" &&
test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH]) AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
else else
AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for WebGL. Either install it (June 2010 version or newer), or reconfigure with --disable-webgl.]) AC_MSG_RESULT([Couldn't find the DirectX SDK.])
fi fi
# Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
if test -z "$MOZ_D3DX9_VERSION" ; then
AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for WebGL. Either reinstall the DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
fi
MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
if test -z "$MOZ_D3DCOMPILER_CAB"; then
AC_MSG_ERROR([Couldn't find the DirectX redistributable files. Either reinstall the DirectX SDK (making sure the "DirectX Redistributable Files" option is selected), or reconfigure with --disable-webgl.])
fi
MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
fi fi
dnl ========================================================
dnl D3D compiler DLL
dnl ========================================================
if test -n "$MOZ_ANGLE_RENDERER"; then
# Check that our DirectX SDK is acceptable.
if test -n "$MOZ_DIRECTX_SDK_PATH"; then
if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
MOZ_DIRECTX_SDK_PATH_BAD=1
fi
if test -n "$MOZ_DIRECTX_SDK_PATH" &&
test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
AC_MSG_RESULT([Found acceptable DirectX SDK for ANGLE.])
else
AC_MSG_RESULT([Found DirectX SDK is unacceptable for ANGLE.])
MOZ_DIRECTX_SDK_PATH_BAD=1
fi
fi
if test -n "$MOZ_DIRECTX_SDK_PATH_BAD"; then
AC_MSG_ERROR([Couldn't find an acceptable DirectX SDK for ANGLE. Either install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
fi
# Find a D3D compiler DLL in a Windows SDK.
MOZ_D3DCOMPILER_DLL=
if test -n "$MOZ_WINSDK_DIRECTX"; then
case "$MOZ_WINSDK_MAXVER" in
0x0603*)
MOZ_D3DCOMPILER_DLL=d3dcompiler_47.dll
AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
;;
0x0602*)
MOZ_D3DCOMPILER_DLL=d3dcompiler_46.dll
AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
;;
esac
fi
if test -n "$MOZ_D3DCOMPILER_DLL"; then
# We have a name, now track down the path.
if test -n "$WINDOWSSDKDIR"; then
MOZ_D3DCOMPILER_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_DIRECTX_SDK_CPU_SUFFIX/$MOZ_D3DCOMPILER_DLL"
if test -f "$MOZ_D3DCOMPILER_DLL_PATH"; then
MOZ_HAS_WINSDK_WITH_D3D=1
AC_MSG_RESULT([Found MOZ_D3DCOMPILER_DLL_PATH: $MOZ_D3DCOMPILER_DLL_PATH])
else
AC_MSG_RESULT([MOZ_D3DCOMPILER_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_DLL_PATH])
fi
else
AC_MSG_RESULT([WINDOWSSDKDIR is missing.])
fi
fi
# Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
# Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then
MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
if test -n "$MOZ_D3DX9_VERSION" ; then
MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
else
AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
fi
if test -z "$MOZ_D3DCOMPILER_CAB"; then
AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
fi
fi
if test -z "$MOZ_D3DCOMPILER_DLL_PATH" -a -z "$MOZ_D3DCOMPILER_CAB"; then
AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL. Either install Windows SDK 8.0+ and reconfigure with --enable-winsdk-directx, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
fi
fi
dnl ======================================================== dnl ========================================================
dnl Gamepad support dnl Gamepad support
dnl ======================================================== dnl ========================================================
@ -5876,12 +5942,14 @@ if test "$MOZ_GAMEPAD"; then
MOZ_GAMEPAD_BACKEND=cocoa MOZ_GAMEPAD_BACKEND=cocoa
;; ;;
WINNT) WINNT)
if test -n "$MOZ_DIRECTX_SDK_PATH" ; then if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then
if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
MOZ_GAMEPAD= if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
MOZ_GAMEPAD=
fi
elif test "$GCC" != "yes"; then
MOZ_GAMEPAD=
fi fi
elif test "$GCC" != "yes"; then
MOZ_GAMEPAD=
fi fi
if test -z "$MOZ_GAMEPAD"; then if test -z "$MOZ_GAMEPAD"; then
AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for gamepad support. Please install it or, reconfigure with --disable-gamepad to disable gamepad support.]) AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for gamepad support. Please install it or, reconfigure with --disable-gamepad to disable gamepad support.])
@ -8388,12 +8456,15 @@ AC_SUBST(MOZ_STUB_INSTALLER)
AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE) AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
AC_SUBST(MOZ_ENABLE_SIGNMAR) AC_SUBST(MOZ_ENABLE_SIGNMAR)
AC_SUBST(MOZ_UPDATER) AC_SUBST(MOZ_UPDATER)
AC_SUBST(MOZ_ANGLE_RENDERER) AC_SUBST(MOZ_ANGLE_RENDERER)
AC_SUBST(MOZ_DIRECTX_SDK_PATH)
AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX) AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
AC_SUBST(MOZ_D3DX9_VERSION) AC_SUBST(MOZ_DIRECTX_SDK_PATH)
AC_SUBST(MOZ_D3DCOMPILER_CAB)
AC_SUBST(MOZ_D3DCOMPILER_DLL) AC_SUBST(MOZ_D3DCOMPILER_DLL)
AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
AC_SUBST(MOZ_D3DCOMPILER_DLL_PATH)
AC_SUBST(MOZ_D3DCOMPILER_CAB)
AC_SUBST(MOZ_METRO) AC_SUBST(MOZ_METRO)
AC_SUBST(MOZ_ANDROID_HISTORY) AC_SUBST(MOZ_ANDROID_HISTORY)

View File

@ -1772,9 +1772,6 @@ this.CSPNonceSource = function CSPNonceSource() {
} }
CSPNonceSource.fromString = function(aStr, aCSPRep) { CSPNonceSource.fromString = function(aStr, aCSPRep) {
if (!CSPPrefObserver.experimentalEnabled)
return null;
let nonce = R_NONCESRC.exec(aStr)[1]; let nonce = R_NONCESRC.exec(aStr)[1];
if (!nonce) { if (!nonce) {
cspError(aCSPRep, "Error in parsing nonce-source from string: nonce was empty"); cspError(aCSPRep, "Error in parsing nonce-source from string: nonce was empty");
@ -1789,8 +1786,6 @@ CSPNonceSource.fromString = function(aStr, aCSPRep) {
CSPNonceSource.prototype = { CSPNonceSource.prototype = {
permits: function(aContext) { permits: function(aContext) {
if (!CSPPrefObserver.experimentalEnabled) return false;
if (aContext instanceof Ci.nsIDOMHTMLElement) { if (aContext instanceof Ci.nsIDOMHTMLElement) {
return this._nonce === aContext.getAttribute('nonce'); return this._nonce === aContext.getAttribute('nonce');
} else if (typeof aContext === 'string') { } else if (typeof aContext === 'string') {
@ -1822,9 +1817,6 @@ this.CSPHashSource = function CSPHashSource() {
} }
CSPHashSource.fromString = function(aStr, aCSPRep) { CSPHashSource.fromString = function(aStr, aCSPRep) {
if (!CSPPrefObserver.experimentalEnabled)
return null;
let hashSrcMatch = R_HASHSRC.exec(aStr); let hashSrcMatch = R_HASHSRC.exec(aStr);
let algo = hashSrcMatch[1]; let algo = hashSrcMatch[1];
let hash = hashSrcMatch[2]; let hash = hashSrcMatch[2];
@ -1846,8 +1838,6 @@ CSPHashSource.fromString = function(aStr, aCSPRep) {
CSPHashSource.prototype = { CSPHashSource.prototype = {
permits: function(aContext) { permits: function(aContext) {
if (!CSPPrefObserver.experimentalEnabled) return false;
let ScriptableUnicodeConverter = let ScriptableUnicodeConverter =
Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter",
"nsIScriptableUnicodeConverter"); "nsIScriptableUnicodeConverter");

View File

@ -208,9 +208,6 @@ ContentSecurityPolicy.prototype = {
}, },
getAllowsNonce: function(aNonce, aContentType, shouldReportViolation) { getAllowsNonce: function(aNonce, aContentType, shouldReportViolation) {
if (!CSPPrefObserver.experimentalEnabled)
return false;
if (!(aContentType == Ci.nsIContentPolicy.TYPE_SCRIPT || if (!(aContentType == Ci.nsIContentPolicy.TYPE_SCRIPT ||
aContentType == Ci.nsIContentPolicy.TYPE_STYLESHEET)) { aContentType == Ci.nsIContentPolicy.TYPE_STYLESHEET)) {
CSPdebug("Nonce check requested for an invalid content type (not script or style): " + aContentType); CSPdebug("Nonce check requested for an invalid content type (not script or style): " + aContentType);
@ -223,7 +220,9 @@ ContentSecurityPolicy.prototype = {
shouldReportViolation.value = this._policies.some(function(policy, i) { shouldReportViolation.value = this._policies.some(function(policy, i) {
// Don't report a violation if the policy didn't use nonce-source // Don't report a violation if the policy didn't use nonce-source
return policy._directives[directive]._hasNonceSource && !policyAllowsNonce[i]; return policy._directives.hasOwnProperty(directive) &&
policy._directives[directive]._hasNonceSource &&
!policyAllowsNonce[i];
}); });
// allow it to execute? (Do all the policies allow it to execute)? // allow it to execute? (Do all the policies allow it to execute)?
@ -233,9 +232,6 @@ ContentSecurityPolicy.prototype = {
}, },
getAllowsHash: function(aContent, aContentType, shouldReportViolation) { getAllowsHash: function(aContent, aContentType, shouldReportViolation) {
if (!CSPPrefObserver.experimentalEnabled)
return false;
if (!(aContentType == Ci.nsIContentPolicy.TYPE_SCRIPT || if (!(aContentType == Ci.nsIContentPolicy.TYPE_SCRIPT ||
aContentType == Ci.nsIContentPolicy.TYPE_STYLESHEET)) { aContentType == Ci.nsIContentPolicy.TYPE_STYLESHEET)) {
CSPdebug("Hash check requested for an invalid content type (not script or style): " + aContentType); CSPdebug("Hash check requested for an invalid content type (not script or style): " + aContentType);
@ -248,7 +244,9 @@ ContentSecurityPolicy.prototype = {
shouldReportViolation.value = this._policies.some(function(policy, i) { shouldReportViolation.value = this._policies.some(function(policy, i) {
// Don't report a violation if the policy didn't use hash-source // Don't report a violation if the policy didn't use hash-source
return policy._directives[directive]._hasHashSource && !policyAllowsHash[i]; return policy._directives.hasOwnProperty(directive) &&
policy._directives[directive]._hasHashSource &&
!policyAllowsHash[i];
}); });
// allow it to execute? (Do all the policies allow it to execute)? // allow it to execute? (Do all the policies allow it to execute)?

View File

@ -126,8 +126,7 @@ function checkInline () {
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv( SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true], {'set':[["security.csp.speccompliant", true]]},
["security.csp.experimentalEnabled", true]]},
function() { function() {
// save this for last so that our listeners are registered. // save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests. // ... this loads the testbed of good and bad requests.

View File

@ -113,8 +113,7 @@ window.examiner = new examiner();
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv( SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true], {'set':[["security.csp.speccompliant", true]]},
["security.csp.experimentalEnabled", true]]},
function() { function() {
// save this for last so that our listeners are registered. // save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests. // ... this loads the testbed of good and bad requests.

View File

@ -89,6 +89,22 @@ VideoData::~VideoData()
MOZ_COUNT_DTOR(VideoData); MOZ_COUNT_DTOR(VideoData);
} }
size_t
VideoData::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t size = aMallocSizeOf(this);
// Currently only PLANAR_YCBCR has a well defined function for determining
// it's size, so reporting is limited to that type.
if (mImage && mImage->GetFormat() == ImageFormat::PLANAR_YCBCR) {
const mozilla::layers::PlanarYCbCrImage* img =
static_cast<const mozilla::layers::PlanarYCbCrImage*>(mImage.get());
size += img->SizeOfIncludingThis(aMallocSizeOf);
}
return size;
}
/* static */ /* static */
VideoData* VideoData::ShallowCopyUpdateDuration(VideoData* aOther, VideoData* VideoData::ShallowCopyUpdateDuration(VideoData* aOther,
int64_t aDuration) int64_t aDuration)

View File

@ -225,6 +225,8 @@ public:
~VideoData(); ~VideoData();
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
// Dimensions at which to display the video frame. The picture region // Dimensions at which to display the video frame. The picture region
// will be scaled to this size. This is should be the picture region's // will be scaled to this size. This is should be the picture region's
// dimensions scaled with respect to its aspect ratio. // dimensions scaled with respect to its aspect ratio.

View File

@ -1564,9 +1564,9 @@ nsresult MediaDecoder::GetBuffered(dom::TimeRanges* aBuffered) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
int64_t MediaDecoder::VideoQueueMemoryInUse() { size_t MediaDecoder::SizeOfVideoQueue() {
if (mDecoderStateMachine) { if (mDecoderStateMachine) {
return mDecoderStateMachine->VideoQueueMemoryInUse(); return mDecoderStateMachine->SizeOfVideoQueue();
} }
return 0; return 0;
} }
@ -1836,7 +1836,7 @@ MediaMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport,
DecodersArray& decoders = Decoders(); DecodersArray& decoders = Decoders();
for (size_t i = 0; i < decoders.Length(); ++i) { for (size_t i = 0; i < decoders.Length(); ++i) {
MediaDecoder* decoder = decoders[i]; MediaDecoder* decoder = decoders[i];
video += decoder->VideoQueueMemoryInUse(); video += decoder->SizeOfVideoQueue();
audio += decoder->SizeOfAudioQueue(); audio += decoder->SizeOfAudioQueue();
if (decoder->GetResource()) { if (decoder->GetResource()) {

View File

@ -646,7 +646,7 @@ public:
// Returns the size, in bytes, of the heap memory used by the currently // Returns the size, in bytes, of the heap memory used by the currently
// queued decoded video and audio data. // queued decoded video and audio data.
virtual int64_t VideoQueueMemoryInUse(); size_t SizeOfVideoQueue();
size_t SizeOfAudioQueue(); size_t SizeOfAudioQueue();
VideoFrameContainer* GetVideoFrameContainer() MOZ_FINAL MOZ_OVERRIDE VideoFrameContainer* GetVideoFrameContainer() MOZ_FINAL MOZ_OVERRIDE

View File

@ -31,18 +31,36 @@ extern PRLogModuleInfo* gMediaDecoderLog;
#define SEEK_LOG(type, msg) #define SEEK_LOG(type, msg)
#endif #endif
void* MediaDecoderReader::VideoQueueMemoryFunctor::operator()(void* anObject) { class VideoQueueMemoryFunctor : public nsDequeFunctor {
const VideoData* v = static_cast<const VideoData*>(anObject); public:
if (!v->mImage) { VideoQueueMemoryFunctor() : mSize(0) {}
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
virtual void* operator()(void* aObject) {
const VideoData* v = static_cast<const VideoData*>(aObject);
mSize += v->SizeOfIncludingThis(MallocSizeOf);
return nullptr; return nullptr;
} }
if (v->mImage->GetFormat() == ImageFormat::PLANAR_YCBCR) { size_t mSize;
mozilla::layers::PlanarYCbCrImage* vi = static_cast<mozilla::layers::PlanarYCbCrImage*>(v->mImage.get()); };
mResult += vi->GetDataSize();
class AudioQueueMemoryFunctor : public nsDequeFunctor {
public:
AudioQueueMemoryFunctor() : mSize(0) {}
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
virtual void* operator()(void* aObject) {
const AudioData* audioData = static_cast<const AudioData*>(aObject);
mSize += audioData->SizeOfIncludingThis(MallocSizeOf);
return nullptr;
} }
return nullptr;
} size_t mSize;
};
MediaDecoderReader::MediaDecoderReader(AbstractMediaDecoder* aDecoder) MediaDecoderReader::MediaDecoderReader(AbstractMediaDecoder* aDecoder)
: mAudioCompactor(mAudioQueue), : mAudioCompactor(mAudioQueue),
@ -58,6 +76,20 @@ MediaDecoderReader::~MediaDecoderReader()
MOZ_COUNT_DTOR(MediaDecoderReader); MOZ_COUNT_DTOR(MediaDecoderReader);
} }
size_t MediaDecoderReader::SizeOfVideoQueueInBytes() const
{
VideoQueueMemoryFunctor functor;
mVideoQueue.LockedForEach(functor);
return functor.mSize;
}
size_t MediaDecoderReader::SizeOfAudioQueueInBytes() const
{
AudioQueueMemoryFunctor functor;
mAudioQueue.LockedForEach(functor);
return functor.mSize;
}
nsresult MediaDecoderReader::ResetDecode() nsresult MediaDecoderReader::ResetDecode()
{ {
nsresult res = NS_OK; nsresult res = NS_OK;

View File

@ -132,41 +132,13 @@ public:
virtual nsresult GetBuffered(dom::TimeRanges* aBuffered, virtual nsresult GetBuffered(dom::TimeRanges* aBuffered,
int64_t aStartTime); int64_t aStartTime);
class VideoQueueMemoryFunctor : public nsDequeFunctor { // Returns the number of bytes of memory allocated by structures/frames in
public: // the video queue.
VideoQueueMemoryFunctor() : mResult(0) {} size_t SizeOfVideoQueueInBytes() const;
virtual void* operator()(void* anObject); // Returns the number of bytes of memory allocated by structures/frames in
// the audio queue.
int64_t mResult; size_t SizeOfAudioQueueInBytes() const;
};
virtual int64_t VideoQueueMemoryInUse() {
VideoQueueMemoryFunctor functor;
mVideoQueue.LockedForEach(functor);
return functor.mResult;
}
class AudioQueueMemoryFunctor : public nsDequeFunctor {
public:
AudioQueueMemoryFunctor() : mSize(0) {}
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
virtual void* operator()(void* anObject) {
const AudioData* audioData = static_cast<const AudioData*>(anObject);
mSize += audioData->SizeOfIncludingThis(MallocSizeOf);
return nullptr;
}
size_t mSize;
};
size_t SizeOfAudioQueue() {
AudioQueueMemoryFunctor functor;
mAudioQueue.LockedForEach(functor);
return functor.mSize;
}
// Only used by WebMReader and MediaOmxReader for now, so stub here rather // Only used by WebMReader and MediaOmxReader for now, so stub here rather
// than in every reader than inherits from MediaDecoderReader. // than in every reader than inherits from MediaDecoderReader.

View File

@ -266,16 +266,16 @@ public:
void SetPlaybackRate(double aPlaybackRate); void SetPlaybackRate(double aPlaybackRate);
void SetPreservesPitch(bool aPreservesPitch); void SetPreservesPitch(bool aPreservesPitch);
int64_t VideoQueueMemoryInUse() { size_t SizeOfVideoQueue() {
if (mReader) { if (mReader) {
return mReader->VideoQueueMemoryInUse(); return mReader->SizeOfVideoQueueInBytes();
} }
return 0; return 0;
} }
size_t SizeOfAudioQueue() { size_t SizeOfAudioQueue() {
if (mReader) { if (mReader) {
return mReader->SizeOfAudioQueue(); return mReader->SizeOfAudioQueueInBytes();
} }
return 0; return 0;
} }

View File

@ -13,6 +13,20 @@ using mozilla::AudioDataValue;
using mozilla::MediaDecoderReader; using mozilla::MediaDecoderReader;
using mozilla::MediaQueue; using mozilla::MediaQueue;
class MemoryFunctor : public nsDequeFunctor {
public:
MemoryFunctor() : mSize(0) {}
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
virtual void* operator()(void* anObject) {
const AudioData* audioData = static_cast<const AudioData*>(anObject);
mSize += audioData->SizeOfIncludingThis(MallocSizeOf);
return nullptr;
}
size_t mSize;
};
class TestCopy class TestCopy
{ {
public: public:
@ -60,7 +74,7 @@ static void TestAudioCompactor(size_t aBytes)
EXPECT_GT(callCount, 0U) << "copy functor never called"; EXPECT_GT(callCount, 0U) << "copy functor never called";
EXPECT_EQ(frames, frameCount) << "incorrect number of frames copied"; EXPECT_EQ(frames, frameCount) << "incorrect number of frames copied";
MediaDecoderReader::AudioQueueMemoryFunctor memoryFunc; MemoryFunctor memoryFunc;
queue.LockedForEach(memoryFunc); queue.LockedForEach(memoryFunc);
size_t allocSize = memoryFunc.mSize - (callCount * sizeof(AudioData)); size_t allocSize = memoryFunc.mSize - (callCount * sizeof(AudioData));
size_t slop = allocSize - aBytes; size_t slop = allocSize - aBytes;

View File

@ -10,14 +10,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500261
<body> <body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=500261">Mozilla Bug 500261</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=500261">Mozilla Bug 500261</a>
<p id="display"></p> <p id="display"></p>
<div id="content">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="1" id="svg">
<image width="1" height="1" xlink:href="http://localhost/serverGone.gif" onerror="run()"/>
</svg>
</div>
<pre id="test">
<script class="testbody" type="text/javascript"> <script class="testbody" type="text/javascript">
<![CDATA[ <![CDATA[
@ -31,6 +23,14 @@ function run()
]]> ]]>
</script> </script>
<div id="content">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="1" id="svg">
<image width="1" height="1" xlink:href="http://localhost/serverGone.gif" onerror="run()"/>
</svg>
</div>
<pre id="test">
</pre> </pre>
</body> </body>
</html> </html>

View File

@ -7,7 +7,6 @@
XPIDL_SOURCES += [ XPIDL_SOURCES += [
'nsIActivityProxy.idl', 'nsIActivityProxy.idl',
'nsIActivityUIGlue.idl', 'nsIActivityUIGlue.idl',
'nsIDOMActivityRequestHandler.idl',
] ]
XPIDL_MODULE = 'dom_activities' XPIDL_MODULE = 'dom_activities'

View File

@ -1,13 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
[scriptable, uuid(e93c4df2-af49-4421-8d75-1237b51c555b)]
interface nsIDOMMozActivityRequestHandler : nsISupports
{
void postResult(in jsval result);
void postError(in DOMString error);
readonly attribute jsval source;
};

View File

@ -4,7 +4,6 @@
"use strict"; "use strict";
const Cc = Components.classes;
const Ci = Components.interfaces; const Ci = Components.interfaces;
const Cu = Components.utils; const Cu = Components.utils;
@ -25,30 +24,28 @@ function debug(aMsg) {
function ActivityRequestHandler() { function ActivityRequestHandler() {
debug("ActivityRequestHandler"); debug("ActivityRequestHandler");
this.wrappedJSObject = this;
// When a system message of type 'activity' is emitted, it forces the // When a system message of type 'activity' is emitted, it forces the
// creation of an ActivityWrapper which in turns replace the default // creation of an ActivityWrapper which in turns replace the default
// system message callback. The newly created wrapper then create a // system message callback. The newly created wrapper then create an
// nsIDOMActivityRequestHandler object and fills up the properties of // ActivityRequestHandler object.
// this object as well as the properties of the ActivityOptions
// dictionary contained by the request handler.
this._id = null;
this._options = null;
} }
ActivityRequestHandler.prototype = { ActivityRequestHandler.prototype = {
__exposedProps__: { init: function arh_init(aWindow) {
source: "r", this._window = aWindow;
postResult: "r", },
postError: "r"
}, __init: function arh___init(aId, aOptions) {
this._id = aId;
this._options = aOptions;
},
get source() { get source() {
if (this._options === null) { // We need to clone this object because the this._options.data has
Cu.reportError("ActivityRequestHandler._options must be initialized at this point"); // the type any in WebIDL which will cause the binding layer to pass
} // the value which is a COW unmodified to content.
return this._options; return Cu.cloneInto(this._options, this._window);
}, },
postResult: function arh_postResult(aResult) { postResult: function arh_postResult(aResult) {
@ -70,16 +67,8 @@ ActivityRequestHandler.prototype = {
classID: Components.ID("{9326952a-dbe3-4d81-a51f-d9c160d96d6b}"), classID: Components.ID("{9326952a-dbe3-4d81-a51f-d9c160d96d6b}"),
QueryInterface: XPCOMUtils.generateQI([ QueryInterface: XPCOMUtils.generateQI([
Ci.nsIDOMMozActivityRequestHandler Ci.nsIDOMGlobalPropertyInitializer
]), ])
classInfo: XPCOMUtils.generateCI({
classID: Components.ID("{9326952a-dbe3-4d81-a51f-d9c160d96d6b}"),
contractID: "@mozilla.org/dom/activities/request-handler;1",
interfaces: [Ci.nsIDOMMozActivityRequestHandler],
flags: Ci.nsIClassInfo.DOM_OBJECT,
classDescription: "Activity Request Handler"
})
} }
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityRequestHandler]); this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityRequestHandler]);

View File

@ -37,15 +37,7 @@ ActivityWrapper.prototype = {
// Activity workflow. // Activity workflow.
cpmm.sendAsyncMessage("Activity:Ready", { id: aMessage.id }); cpmm.sendAsyncMessage("Activity:Ready", { id: aMessage.id });
let handler = Cc["@mozilla.org/dom/activities/request-handler;1"] let handler = new aWindow.ActivityRequestHandler(aMessage.id, aMessage.payload);
.createInstance(Ci.nsIDOMMozActivityRequestHandler);
handler.wrappedJSObject._id = aMessage.id;
// options is an ActivityOptions dictionary.
handler.wrappedJSObject._options = Cu.cloneInto({
name: aMessage.payload.name,
data: Cu.cloneInto(aMessage.payload.data, aWindow),
}, aWindow);
// When the activity window is closed, fire an error to notify the activity // When the activity window is closed, fire an error to notify the activity
// caller of the situation. // caller of the situation.

View File

@ -2296,6 +2296,14 @@ Navigator::HasDownloadsSupport(JSContext* aCx, JSObject* aGlobal)
Preferences::GetBool("dom.mozDownloads.enabled"); Preferences::GetBool("dom.mozDownloads.enabled");
} }
/* static */
bool
Navigator::HasPermissionSettingsSupport(JSContext* /* unused */, JSObject* aGlobal)
{
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
return CheckPermission(win, "permissions");
}
/* static */ /* static */
already_AddRefed<nsPIDOMWindow> already_AddRefed<nsPIDOMWindow>
Navigator::GetWindowFromGlobal(JSObject* aGlobal) Navigator::GetWindowFromGlobal(JSObject* aGlobal)

View File

@ -306,6 +306,8 @@ public:
static bool HasDownloadsSupport(JSContext* aCx, JSObject* aGlobal); static bool HasDownloadsSupport(JSContext* aCx, JSObject* aGlobal);
static bool HasPermissionSettingsSupport(JSContext* aCx, JSObject* aGlobal);
nsPIDOMWindow* GetParentObject() const nsPIDOMWindow* GetParentObject() const
{ {
return GetWindow(); return GetWindow();

View File

@ -162,6 +162,23 @@ nsDOMWindowUtils::GetDocument()
return window->GetExtantDoc(); return window->GetExtantDoc();
} }
LayerTransactionChild*
nsDOMWindowUtils::GetLayerTransaction()
{
nsIWidget* widget = GetWidget();
if (!widget)
return nullptr;
LayerManager* manager = widget->GetLayerManager();
if (!manager)
return nullptr;
ShadowLayerForwarder* forwarder = manager->AsShadowForwarder();
return forwarder && forwarder->HasShadowManager() ?
forwarder->GetShadowManager() :
nullptr;
}
NS_IMETHODIMP NS_IMETHODIMP
nsDOMWindowUtils::GetImageAnimationMode(uint16_t *aMode) nsDOMWindowUtils::GetImageAnimationMode(uint16_t *aMode)
{ {
@ -2552,12 +2569,9 @@ nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds)
nsRefreshDriver* driver = GetPresContext()->RefreshDriver(); nsRefreshDriver* driver = GetPresContext()->RefreshDriver();
driver->AdvanceTimeAndRefresh(aMilliseconds); driver->AdvanceTimeAndRefresh(aMilliseconds);
nsIWidget* widget = GetWidget(); LayerTransactionChild* transaction = GetLayerTransaction();
if (widget) { if (transaction) {
CompositorChild* compositor = widget->GetRemoteRenderer(); transaction->SendSetTestSampleTime(driver->MostRecentRefresh());
if (compositor) {
compositor->SendSetTestSampleTime(driver->MostRecentRefresh());
}
} }
return NS_OK; return NS_OK;
@ -2573,12 +2587,9 @@ nsDOMWindowUtils::RestoreNormalRefresh()
// Kick the compositor out of test mode before the refresh driver, so that // Kick the compositor out of test mode before the refresh driver, so that
// the refresh driver doesn't send an update that gets ignored by the // the refresh driver doesn't send an update that gets ignored by the
// compositor. // compositor.
nsIWidget* widget = GetWidget(); LayerTransactionChild* transaction = GetLayerTransaction();
if (widget) { if (transaction) {
CompositorChild* compositor = widget->GetRemoteRenderer(); transaction->SendLeaveTestMode();
if (compositor) {
compositor->SendLeaveTestMode();
}
} }
nsRefreshDriver* driver = GetPresContext()->RefreshDriver(); nsRefreshDriver* driver = GetPresContext()->RefreshDriver();

View File

@ -19,6 +19,12 @@ class nsPresContext;
class nsPoint; class nsPoint;
class nsIDocument; class nsIDocument;
namespace mozilla {
namespace layers {
class LayerTransactionChild;
}
}
class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils, class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils,
public nsSupportsWeakReference public nsSupportsWeakReference
{ {
@ -41,6 +47,7 @@ protected:
nsIPresShell* GetPresShell(); nsIPresShell* GetPresShell();
nsPresContext* GetPresContext(); nsPresContext* GetPresContext();
nsIDocument* GetDocument(); nsIDocument* GetDocument();
mozilla::layers::LayerTransactionChild* GetLayerTransaction();
NS_IMETHOD SendMouseEventCommon(const nsAString& aType, NS_IMETHOD SendMouseEventCommon(const nsAString& aType,
float aX, float aX,

View File

@ -27,8 +27,8 @@ class nsIDOMWindow;
class nsIURI; class nsIURI;
#define NS_ISCRIPTCONTEXT_IID \ #define NS_ISCRIPTCONTEXT_IID \
{ 0x7cf47061, 0x745d, 0x4c6c, \ { 0x274840b6, 0x7349, 0x4798, \
{ 0xa0, 0xe5, 0x9f, 0xef, 0xa8, 0xcc, 0x2a, 0xf0 } } { 0xbe, 0x24, 0xbd, 0x75, 0xa6, 0x46, 0x99, 0xb7 } }
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't /* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
know what language we have is a little silly... */ know what language we have is a little silly... */
@ -45,32 +45,6 @@ class nsIScriptContext : public nsISupports
public: public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTCONTEXT_IID) NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTCONTEXT_IID)
/**
* Bind an already-compiled event handler function to the given
* target. Scripting languages with static scoping must re-bind the
* scope chain for aHandler to begin (after the activation scope for
* aHandler itself, typically) with aTarget's scope.
*
* The result of the bind operation is a new handler object, with
* principals now set and scope set as above. This is returned in
* aBoundHandler. When this function is called, aBoundHandler is
* expected to not be holding an object.
*
* @param aTarget an object telling the scope in which to bind the compiled
* event handler function. The context will presumably associate
* this nsISupports with a native script object.
* @param aScope the scope in which the script object for aTarget should be
* looked for.
* @param aHandler the function object to bind, created by an earlier call to
* CompileEventHandler
* @param aBoundHandler [out] the result of the bind operation.
* @return NS_OK if the function was successfully bound
*/
virtual nsresult BindCompiledEventHandler(nsISupports* aTarget,
JS::Handle<JSObject*> aScope,
JS::Handle<JSObject*> aHandler,
JS::MutableHandle<JSObject*> aBoundHandler) = 0;
/** /**
* Return the global object. * Return the global object.
* *

View File

@ -909,95 +909,6 @@ AtomIsEventHandlerName(nsIAtom *aName)
} }
#endif #endif
// Helper function to find the JSObject associated with a (presumably DOM)
// interface.
nsresult
nsJSContext::JSObjectFromInterface(nsISupports* aTarget,
JS::Handle<JSObject*> aScope,
JSObject** aRet)
{
// It is legal to specify a null target.
if (!aTarget) {
*aRet = nullptr;
return NS_OK;
}
AutoJSContext cx;
// Get the jsobject associated with this target
// We don't wrap here because we trust the JS engine to wrap the target
// later.
JS::Rooted<JS::Value> v(cx);
nsresult rv = nsContentUtils::WrapNative(cx, aScope, aTarget, &v);
NS_ENSURE_SUCCESS(rv, rv);
JSObject* obj = v.toObjectOrNull();
if (obj) {
JS::ExposeObjectToActiveJS(obj);
}
#ifdef DEBUG
JS::Rooted<JSObject*> rootedObj(cx, obj);
nsCOMPtr<nsISupports> targetSupp = do_QueryInterface(aTarget);
nsCOMPtr<nsISupports> native =
nsContentUtils::XPConnect()->GetNativeOfWrapper(cx, rootedObj);
NS_ASSERTION(native == targetSupp, "Native should be the target!");
obj = rootedObj;
#endif
*aRet = obj;
return NS_OK;
}
nsresult
nsJSContext::BindCompiledEventHandler(nsISupports* aTarget,
JS::Handle<JSObject*> aScope,
JS::Handle<JSObject*> aHandler,
JS::MutableHandle<JSObject*> aBoundHandler)
{
NS_ENSURE_ARG(aHandler);
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
NS_PRECONDITION(!aBoundHandler, "Shouldn't already have a bound handler!");
if (aScope) {
JS::ExposeObjectToActiveJS(aScope);
}
JS::ExposeObjectToActiveJS(aHandler);
AutoPushJSContext cx(mContext);
// Get the jsobject associated with this target
JS::Rooted<JSObject*> target(cx);
JS::Rooted<JSObject*> scope(cx, aScope);
nsresult rv = JSObjectFromInterface(aTarget, scope, target.address());
NS_ENSURE_SUCCESS(rv, rv);
#ifdef DEBUG
{
JSAutoCompartment ac(cx, aHandler);
JS::Rooted<JS::Value> val(cx, JS::ObjectValue(*aHandler));
NS_ASSERTION(JS_TypeOfValue(cx, val) == JSTYPE_FUNCTION,
"Event handler object not a function");
}
#endif
JSAutoCompartment ac(cx, target);
JSObject* funobj;
// Make sure the handler function is parented by its event target object
if (aHandler) {
funobj = JS_CloneFunctionObject(cx, aHandler, target);
if (!funobj) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
} else {
funobj = nullptr;
}
aBoundHandler.set(funobj);
return rv;
}
nsIScriptGlobalObject * nsIScriptGlobalObject *
nsJSContext::GetGlobalObject() nsJSContext::GetGlobalObject()
{ {

View File

@ -44,11 +44,6 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsJSContext, NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsJSContext,
nsIScriptContext) nsIScriptContext)
virtual nsresult BindCompiledEventHandler(nsISupports *aTarget,
JS::Handle<JSObject*> aScope,
JS::Handle<JSObject*> aHandler,
JS::MutableHandle<JSObject*> aBoundHandler) MOZ_OVERRIDE;
virtual nsIScriptGlobalObject *GetGlobalObject() MOZ_OVERRIDE; virtual nsIScriptGlobalObject *GetGlobalObject() MOZ_OVERRIDE;
inline nsIScriptGlobalObject *GetGlobalObjectRef() { return mGlobalObjectRef; } inline nsIScriptGlobalObject *GetGlobalObjectRef() { return mGlobalObjectRef; }
@ -145,12 +140,6 @@ protected:
nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv); nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv);
// given an nsISupports object (presumably an event target or some other
// DOM object), get (or create) the JSObject wrapping it.
nsresult JSObjectFromInterface(nsISupports *aSup,
JS::Handle<JSObject*> aScript,
JSObject **aRet);
// Report the pending exception on our mContext, if any. This // Report the pending exception on our mContext, if any. This
// function will set aside the frame chain on mContext before // function will set aside the frame chain on mContext before
// reporting. // reporting.
@ -168,8 +157,6 @@ private:
bool mGCOnDestruction; bool mGCOnDestruction;
bool mProcessingScriptTag; bool mProcessingScriptTag;
PRTime mOperationCallbackTime;
PRTime mModalStateTime; PRTime mModalStateTime;
uint32_t mModalStateDepth; uint32_t mModalStateDepth;

View File

@ -261,6 +261,14 @@ class IDLScope(IDLObject):
originalObject.identifier.name == newObject.identifier.name: originalObject.identifier.name == newObject.identifier.name:
return originalObject return originalObject
if (isinstance(originalObject, IDLExternalInterface) or
isinstance(newObject, IDLExternalInterface)):
raise WebIDLError(
"Name collision between "
"interface declarations for identifier '%s' at '%s' and '%s'"
% (identifier.name,
originalObject.location, newObject.location), [])
# We do the merging of overloads here as opposed to in IDLInterface # We do the merging of overloads here as opposed to in IDLInterface
# because we need to merge overloads of NamedConstructors and we need to # because we need to merge overloads of NamedConstructors and we need to
# detect conflicts in those across interfaces. See also the comment in # detect conflicts in those across interfaces. See also the comment in

View File

@ -597,14 +597,11 @@ EventListenerManager::FindEventHandler(uint32_t aEventType,
EventListenerManager::Listener* EventListenerManager::Listener*
EventListenerManager::SetEventHandlerInternal( EventListenerManager::SetEventHandlerInternal(
JS::Handle<JSObject*> aScopeObject,
nsIAtom* aName, nsIAtom* aName,
const nsAString& aTypeString, const nsAString& aTypeString,
const nsEventHandler& aHandler, const nsEventHandler& aHandler,
bool aPermitUntrustedEvents) bool aPermitUntrustedEvents)
{ {
MOZ_ASSERT(aScopeObject || aHandler.HasEventHandler(),
"Must have one or the other!");
MOZ_ASSERT(aName || !aTypeString.IsEmpty()); MOZ_ASSERT(aName || !aTypeString.IsEmpty());
uint32_t eventType = nsContentUtils::GetEventId(aName); uint32_t eventType = nsContentUtils::GetEventId(aName);
@ -617,7 +614,7 @@ EventListenerManager::SetEventHandlerInternal(
flags.mListenerIsJSListener = true; flags.mListenerIsJSListener = true;
nsCOMPtr<nsIJSEventListener> jsListener; nsCOMPtr<nsIJSEventListener> jsListener;
NS_NewJSEventListener(aScopeObject, mTarget, aName, NS_NewJSEventListener(mTarget, aName,
aHandler, getter_AddRefs(jsListener)); aHandler, getter_AddRefs(jsListener));
EventListenerHolder listenerHolder(jsListener); EventListenerHolder listenerHolder(jsListener);
AddEventListenerInternal(listenerHolder, eventType, aName, aTypeString, AddEventListenerInternal(listenerHolder, eventType, aName, aTypeString,
@ -631,7 +628,7 @@ EventListenerManager::SetEventHandlerInternal(
bool same = jsListener->GetHandler() == aHandler; bool same = jsListener->GetHandler() == aHandler;
// Possibly the same listener, but update still the context and scope. // Possibly the same listener, but update still the context and scope.
jsListener->SetHandler(aHandler, aScopeObject); jsListener->SetHandler(aHandler);
if (mTarget && !same && aName) { if (mTarget && !same && aName) {
mTarget->EventListenerRemoved(aName); mTarget->EventListenerRemoved(aName);
mTarget->EventListenerAdded(aName); mTarget->EventListenerAdded(aName);
@ -746,14 +743,9 @@ EventListenerManager::SetEventHandler(nsIAtom* aName,
nsIScriptContext* context = global->GetScriptContext(); nsIScriptContext* context = global->GetScriptContext();
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE); NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
NS_ENSURE_STATE(global->GetGlobalJSObject()); NS_ENSURE_STATE(global->GetGlobalJSObject());
JSAutoRequest ar(context->GetNativeContext()); Listener* listener = SetEventHandlerInternal(aName,
JS::Rooted<JSObject*> scope(context->GetNativeContext(),
global->GetGlobalJSObject());
Listener* listener = SetEventHandlerInternal(scope, aName,
EmptyString(), EmptyString(),
nsEventHandler(), nsEventHandler(),
aPermitUntrustedEvents); aPermitUntrustedEvents);
@ -791,17 +783,12 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
const nsAString* aBody, const nsAString* aBody,
Element* aElement) Element* aElement)
{ {
NS_PRECONDITION(aListener->GetJSListener(), MOZ_ASSERT(aListener->GetJSListener());
"Why do we not have a JS listener?"); MOZ_ASSERT(aListener->mHandlerIsString, "Why are we compiling a non-string JS listener?");
NS_PRECONDITION(aListener->mHandlerIsString, nsIJSEventListener* jsListener = aListener->GetJSListener();
"Why are we compiling a non-string JS listener?"); MOZ_ASSERT(!jsListener->GetHandler().HasEventHandler(), "What is there to compile?");
nsresult result = NS_OK; nsresult result = NS_OK;
nsIJSEventListener* jsListener = aListener->GetJSListener();
NS_ASSERTION(!jsListener->GetHandler().HasEventHandler(),
"What is there to compile?");
nsCOMPtr<nsIDocument> doc; nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIScriptGlobalObject> global = nsCOMPtr<nsIScriptGlobalObject> global =
GetScriptGlobalAndDocument(getter_AddRefs(doc)); GetScriptGlobalAndDocument(getter_AddRefs(doc));
@ -812,132 +799,127 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
// Push a context to make sure exceptions are reported in the right place. // Push a context to make sure exceptions are reported in the right place.
AutoPushJSContextForErrorReporting cx(context->GetNativeContext()); AutoPushJSContextForErrorReporting cx(context->GetNativeContext());
JS::Rooted<JSObject*> handler(cx);
JS::Rooted<JSObject*> scope(cx, jsListener->GetEventScope());
nsCOMPtr<nsIAtom> typeAtom = aListener->mTypeAtom; nsCOMPtr<nsIAtom> typeAtom = aListener->mTypeAtom;
nsIAtom* attrName = typeAtom; nsIAtom* attrName = typeAtom;
if (aListener->mHandlerIsString) { // Flag us as not a string so we don't keep trying to compile strings which
// OK, we didn't find an existing compiled event handler. Flag us // can't be compiled.
// as not a string so we don't keep trying to compile strings aListener->mHandlerIsString = false;
// which can't be compiled
aListener->mHandlerIsString = false;
// mTarget may not be an Element if it's a window and we're // mTarget may not be an Element if it's a window and we're
// getting an inline event listener forwarded from <html:body> or // getting an inline event listener forwarded from <html:body> or
// <html:frameset> or <xul:window> or the like. // <html:frameset> or <xul:window> or the like.
// XXX I don't like that we have to reference content from // XXX I don't like that we have to reference content from
// here. The alternative is to store the event handler string on // here. The alternative is to store the event handler string on
// the nsIJSEventListener itself, and that still doesn't address // the nsIJSEventListener itself, and that still doesn't address
// the arg names issue. // the arg names issue.
nsCOMPtr<Element> element = do_QueryInterface(mTarget); nsCOMPtr<Element> element = do_QueryInterface(mTarget);
MOZ_ASSERT(element || aBody, "Where will we get our body?"); MOZ_ASSERT(element || aBody, "Where will we get our body?");
nsAutoString handlerBody; nsAutoString handlerBody;
const nsAString* body = aBody; const nsAString* body = aBody;
if (!aBody) { if (!aBody) {
if (aListener->mTypeAtom == nsGkAtoms::onSVGLoad) { if (aListener->mTypeAtom == nsGkAtoms::onSVGLoad) {
attrName = nsGkAtoms::onload; attrName = nsGkAtoms::onload;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGUnload) { } else if (aListener->mTypeAtom == nsGkAtoms::onSVGUnload) {
attrName = nsGkAtoms::onunload; attrName = nsGkAtoms::onunload;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGResize) { } else if (aListener->mTypeAtom == nsGkAtoms::onSVGResize) {
attrName = nsGkAtoms::onresize; attrName = nsGkAtoms::onresize;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGScroll) { } else if (aListener->mTypeAtom == nsGkAtoms::onSVGScroll) {
attrName = nsGkAtoms::onscroll; attrName = nsGkAtoms::onscroll;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGZoom) { } else if (aListener->mTypeAtom == nsGkAtoms::onSVGZoom) {
attrName = nsGkAtoms::onzoom; attrName = nsGkAtoms::onzoom;
} else if (aListener->mTypeAtom == nsGkAtoms::onbeginEvent) { } else if (aListener->mTypeAtom == nsGkAtoms::onbeginEvent) {
attrName = nsGkAtoms::onbegin; attrName = nsGkAtoms::onbegin;
} else if (aListener->mTypeAtom == nsGkAtoms::onrepeatEvent) { } else if (aListener->mTypeAtom == nsGkAtoms::onrepeatEvent) {
attrName = nsGkAtoms::onrepeat; attrName = nsGkAtoms::onrepeat;
} else if (aListener->mTypeAtom == nsGkAtoms::onendEvent) { } else if (aListener->mTypeAtom == nsGkAtoms::onendEvent) {
attrName = nsGkAtoms::onend; attrName = nsGkAtoms::onend;
}
element->GetAttr(kNameSpaceID_None, attrName, handlerBody);
body = &handlerBody;
aElement = element;
}
aListener = nullptr;
uint32_t lineNo = 0;
nsAutoCString url (NS_LITERAL_CSTRING("-moz-evil:lying-event-listener"));
MOZ_ASSERT(body);
MOZ_ASSERT(aElement);
nsIURI *uri = aElement->OwnerDoc()->GetDocumentURI();
if (uri) {
uri->GetSpec(url);
lineNo = 1;
} }
uint32_t argCount; element->GetAttr(kNameSpaceID_None, attrName, handlerBody);
const char **argNames; body = &handlerBody;
nsContentUtils::GetEventArgNames(aElement->GetNameSpaceID(), aElement = element;
typeAtom, }
&argCount, &argNames); aListener = nullptr;
JSAutoCompartment ac(cx, context->GetWindowProxy()); uint32_t lineNo = 0;
JS::CompileOptions options(cx); nsAutoCString url (NS_LITERAL_CSTRING("-moz-evil:lying-event-listener"));
options.setIntroductionType("eventHandler") MOZ_ASSERT(body);
.setFileAndLine(url.get(), lineNo) MOZ_ASSERT(aElement);
.setVersion(SCRIPTVERSION_DEFAULT); nsIURI *uri = aElement->OwnerDoc()->GetDocumentURI();
if (uri) {
JS::Rooted<JS::Value> targetVal(cx); uri->GetSpec(url);
// Go ahead and wrap into the current compartment of cx directly. lineNo = 1;
JS::Rooted<JSObject*> wrapScope(cx, JS::CurrentGlobalOrNull(cx));
if (WrapNewBindingObject(cx, wrapScope, aElement, &targetVal)) {
MOZ_ASSERT(targetVal.isObject());
nsDependentAtomString str(attrName);
// Most of our names are short enough that we don't even have to malloc
// the JS string stuff, so don't worry about playing games with
// refcounting XPCOM stringbuffers.
JS::Rooted<JSString*> jsStr(cx, JS_NewUCStringCopyN(cx,
str.BeginReading(),
str.Length()));
NS_ENSURE_TRUE(jsStr, NS_ERROR_OUT_OF_MEMORY);
options.setElement(&targetVal.toObject())
.setElementAttributeName(jsStr);
}
JS::Rooted<JSObject*> handlerFun(cx);
result = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options,
nsAtomCString(typeAtom),
argCount, argNames, *body, handlerFun.address());
NS_ENSURE_SUCCESS(result, result);
handler = handlerFun;
NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE);
} else {
aListener = nullptr;
} }
if (handler) { uint32_t argCount;
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mTarget); const char **argNames;
// Bind it nsContentUtils::GetEventArgNames(aElement->GetNameSpaceID(),
JS::Rooted<JSObject*> boundHandler(cx); typeAtom,
context->BindCompiledEventHandler(mTarget, scope, handler, &boundHandler); &argCount, &argNames);
// Note - We pass null for aIncumbentGlobal below. We could also pass the
// compilation global, but since the handler is guaranteed to be scripted, // Wrap the event target, so that we can use it as the scope for the event
// there's no need to use an override, since the JS engine will always give // handler. Note that mTarget is different from aElement in the <body> case,
// us the right answer. // where mTarget is a Window.
if (!boundHandler) { //
jsListener->ForgetHandler(); // The wrapScope doesn't really matter here, because the target will create
} else if (jsListener->EventName() == nsGkAtoms::onerror && win) { // its reflector in the proper scope, and then we'll enter that compartment.
nsRefPtr<OnErrorEventHandlerNonNull> handlerCallback = JS::Rooted<JSObject*> wrapScope(cx, context->GetWindowProxy());
new OnErrorEventHandlerNonNull(boundHandler, /* aIncumbentGlobal = */ nullptr); JS::Rooted<JS::Value> v(cx);
jsListener->SetHandler(handlerCallback); {
} else if (jsListener->EventName() == nsGkAtoms::onbeforeunload && win) { JSAutoCompartment ac(cx, wrapScope);
nsRefPtr<OnBeforeUnloadEventHandlerNonNull> handlerCallback = nsresult rv = nsContentUtils::WrapNative(cx, wrapScope, mTarget, &v,
new OnBeforeUnloadEventHandlerNonNull(boundHandler, /* aIncumbentGlobal = */ nullptr); /* aAllowWrapping = */ false);
jsListener->SetHandler(handlerCallback); if (NS_WARN_IF(NS_FAILED(rv))) {
} else { return rv;
nsRefPtr<EventHandlerNonNull> handlerCallback =
new EventHandlerNonNull(boundHandler, /* aIncumbentGlobal = */ nullptr);
jsListener->SetHandler(handlerCallback);
} }
} }
JS::Rooted<JSObject*> target(cx, &v.toObject());
JSAutoCompartment ac(cx, target);
nsDependentAtomString str(attrName);
// Most of our names are short enough that we don't even have to malloc
// the JS string stuff, so don't worry about playing games with
// refcounting XPCOM stringbuffers.
JS::Rooted<JSString*> jsStr(cx, JS_NewUCStringCopyN(cx,
str.BeginReading(),
str.Length()));
NS_ENSURE_TRUE(jsStr, NS_ERROR_OUT_OF_MEMORY);
// Get the reflector for |aElement|, so that we can pass to setElement.
if (NS_WARN_IF(!WrapNewBindingObject(cx, target, aElement, &v))) {
return NS_ERROR_FAILURE;
}
JS::CompileOptions options(cx);
options.setIntroductionType("eventHandler")
.setFileAndLine(url.get(), lineNo)
.setVersion(SCRIPTVERSION_DEFAULT)
.setElement(&v.toObject())
.setElementAttributeName(jsStr)
.setDefineOnScope(false);
JS::Rooted<JSObject*> handler(cx);
result = nsJSUtils::CompileFunction(cx, target, options,
nsAtomCString(typeAtom),
argCount, argNames, *body, handler.address());
NS_ENSURE_SUCCESS(result, result);
NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mTarget);
if (jsListener->EventName() == nsGkAtoms::onerror && win) {
nsRefPtr<OnErrorEventHandlerNonNull> handlerCallback =
new OnErrorEventHandlerNonNull(handler, /* aIncumbentGlobal = */ nullptr);
jsListener->SetHandler(handlerCallback);
} else if (jsListener->EventName() == nsGkAtoms::onbeforeunload && win) {
nsRefPtr<OnBeforeUnloadEventHandlerNonNull> handlerCallback =
new OnBeforeUnloadEventHandlerNonNull(handler, /* aIncumbentGlobal = */ nullptr);
jsListener->SetHandler(handlerCallback);
} else {
nsRefPtr<EventHandlerNonNull> handlerCallback =
new EventHandlerNonNull(handler, /* aIncumbentGlobal = */ nullptr);
jsListener->SetHandler(handlerCallback);
}
return result; return result;
} }
@ -1240,8 +1222,7 @@ EventListenerManager::SetEventHandler(nsIAtom* aEventName,
// Untrusted events are always permitted for non-chrome script // Untrusted events are always permitted for non-chrome script
// handlers. // handlers.
SetEventHandlerInternal(JS::NullPtr(), aEventName, SetEventHandlerInternal(aEventName, aTypeString, nsEventHandler(aHandler),
aTypeString, nsEventHandler(aHandler),
!mIsMainThreadELM || !mIsMainThreadELM ||
!nsContentUtils::IsCallerChrome()); !nsContentUtils::IsCallerChrome());
} }
@ -1257,8 +1238,8 @@ EventListenerManager::SetEventHandler(OnErrorEventHandlerNonNull* aHandler)
// Untrusted events are always permitted for non-chrome script // Untrusted events are always permitted for non-chrome script
// handlers. // handlers.
SetEventHandlerInternal(JS::NullPtr(), nsGkAtoms::onerror, SetEventHandlerInternal(nsGkAtoms::onerror, EmptyString(),
EmptyString(), nsEventHandler(aHandler), nsEventHandler(aHandler),
!nsContentUtils::IsCallerChrome()); !nsContentUtils::IsCallerChrome());
} else { } else {
if (!aHandler) { if (!aHandler) {
@ -1267,8 +1248,7 @@ EventListenerManager::SetEventHandler(OnErrorEventHandlerNonNull* aHandler)
} }
// Untrusted events are always permitted. // Untrusted events are always permitted.
SetEventHandlerInternal(JS::NullPtr(), nullptr, SetEventHandlerInternal(nullptr, NS_LITERAL_STRING("error"),
NS_LITERAL_STRING("error"),
nsEventHandler(aHandler), true); nsEventHandler(aHandler), true);
} }
} }
@ -1284,8 +1264,8 @@ EventListenerManager::SetEventHandler(
// Untrusted events are always permitted for non-chrome script // Untrusted events are always permitted for non-chrome script
// handlers. // handlers.
SetEventHandlerInternal(JS::NullPtr(), nsGkAtoms::onbeforeunload, SetEventHandlerInternal(nsGkAtoms::onbeforeunload, EmptyString(),
EmptyString(), nsEventHandler(aHandler), nsEventHandler(aHandler),
!mIsMainThreadELM || !mIsMainThreadELM ||
!nsContentUtils::IsCallerChrome()); !nsContentUtils::IsCallerChrome());
} }
@ -1341,9 +1321,6 @@ EventListenerManager::MarkForCC()
if (jsListener->GetHandler().HasEventHandler()) { if (jsListener->GetHandler().HasEventHandler()) {
JS::ExposeObjectToActiveJS(jsListener->GetHandler().Ptr()->Callable()); JS::ExposeObjectToActiveJS(jsListener->GetHandler().Ptr()->Callable());
} }
if (JSObject* scope = jsListener->GetEventScope()) {
JS::ExposeObjectToActiveJS(scope);
}
} else if (listener.mListenerType == Listener::eWrappedJSListener) { } else if (listener.mListenerType == Listener::eWrappedJSListener) {
xpc_TryUnmarkWrappedGrayObject(listener.mListener.GetXPCOMCallback()); xpc_TryUnmarkWrappedGrayObject(listener.mListener.GetXPCOMCallback());
} else if (listener.mListenerType == Listener::eWebIDLListener) { } else if (listener.mListenerType == Listener::eWebIDLListener) {

View File

@ -447,8 +447,7 @@ protected:
* aScopeGlobal must be non-null. Otherwise, aContext and aScopeGlobal are * aScopeGlobal must be non-null. Otherwise, aContext and aScopeGlobal are
* allowed to be null. * allowed to be null.
*/ */
Listener* SetEventHandlerInternal(JS::Handle<JSObject*> aScopeGlobal, Listener* SetEventHandlerInternal(nsIAtom* aName,
nsIAtom* aName,
const nsAString& aTypeString, const nsAString& aTypeString,
const nsEventHandler& aHandler, const nsEventHandler& aHandler,
bool aPermitUntrustedEvents); bool aPermitUntrustedEvents);

View File

@ -14,8 +14,8 @@
#include "mozilla/dom/EventHandlerBinding.h" #include "mozilla/dom/EventHandlerBinding.h"
#define NS_IJSEVENTLISTENER_IID \ #define NS_IJSEVENTLISTENER_IID \
{ 0x5077b12a, 0x5a1f, 0x4583, \ { 0x8f06b4af, 0xbd0d, 0x486b, \
{ 0xbb, 0xa7, 0x78, 0x84, 0x94, 0x0e, 0x5e, 0xff } } { 0x81, 0xc8, 0x20, 0x42, 0x40, 0x2b, 0xf1, 0xef } }
class nsEventHandler class nsEventHandler
{ {
@ -172,10 +172,9 @@ class nsIJSEventListener : public nsIDOMEventListener
public: public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IJSEVENTLISTENER_IID) NS_DECLARE_STATIC_IID_ACCESSOR(NS_IJSEVENTLISTENER_IID)
nsIJSEventListener(JSObject* aScopeObject, nsIJSEventListener(nsISupports *aTarget, nsIAtom* aType,
nsISupports *aTarget, nsIAtom* aType,
const nsEventHandler& aHandler) const nsEventHandler& aHandler)
: mScopeObject(aScopeObject), mEventName(aType), mHandler(aHandler) : mEventName(aType), mHandler(aHandler)
{ {
nsCOMPtr<nsISupports> base = do_QueryInterface(aTarget); nsCOMPtr<nsISupports> base = do_QueryInterface(aTarget);
mTarget = base.get(); mTarget = base.get();
@ -191,17 +190,6 @@ public:
mTarget = nullptr; mTarget = nullptr;
} }
// Can return null if we already have a handler.
JSObject* GetEventScope() const
{
if (!mScopeObject) {
return nullptr;
}
JS::ExposeObjectToActiveJS(mScopeObject);
return mScopeObject;
}
const nsEventHandler& GetHandler() const const nsEventHandler& GetHandler() const
{ {
return mHandler; return mHandler;
@ -219,11 +207,9 @@ public:
// Set a handler for this event listener. The handler must already // Set a handler for this event listener. The handler must already
// be bound to the right target. // be bound to the right target.
void SetHandler(const nsEventHandler& aHandler, void SetHandler(const nsEventHandler& aHandler)
JS::Handle<JSObject*> aScopeObject)
{ {
mHandler.SetHandler(aHandler); mHandler.SetHandler(aHandler);
UpdateScopeObject(aScopeObject);
} }
void SetHandler(mozilla::dom::EventHandlerNonNull* aHandler) void SetHandler(mozilla::dom::EventHandlerNonNull* aHandler)
{ {
@ -247,8 +233,6 @@ public:
// - mTarget // - mTarget
// //
// The following members are not measured: // The following members are not measured:
// - mScopeObject: because they're measured by the JS memory
// reporters
// - mHandler: may be shared with others // - mHandler: may be shared with others
// - mEventName: shared with others // - mEventName: shared with others
} }
@ -264,11 +248,6 @@ protected:
NS_ASSERTION(!mTarget, "Should have called Disconnect()!"); NS_ASSERTION(!mTarget, "Should have called Disconnect()!");
} }
// Update our mScopeObject; we have to make sure we properly handle
// the hold/drop stuff, so have to do it in nsJSEventListener.
virtual void UpdateScopeObject(JS::Handle<JSObject*> aScopeObject) = 0;
JS::Heap<JSObject*> mScopeObject;
nsISupports* mTarget; nsISupports* mTarget;
nsCOMPtr<nsIAtom> mEventName; nsCOMPtr<nsIAtom> mEventName;
nsEventHandler mHandler; nsEventHandler mHandler;
@ -279,8 +258,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIJSEventListener, NS_IJSEVENTLISTENER_IID)
/* factory function. aHandler must already be bound to aTarget. /* factory function. aHandler must already be bound to aTarget.
aContext is allowed to be null if aHandler is already set up. aContext is allowed to be null if aHandler is already set up.
*/ */
nsresult NS_NewJSEventListener(JSObject* aScopeObject, nsISupports* aTarget, nsresult NS_NewJSEventListener(nsISupports* aTarget, nsIAtom* aType,
nsIAtom* aType, const nsEventHandler& aHandler, const nsEventHandler& aHandler,
nsIJSEventListener **aReturn); nsIJSEventListener **aReturn);
#endif // nsIJSEventListener_h__ #endif // nsIJSEventListener_h__

View File

@ -43,45 +43,16 @@ using namespace mozilla::dom;
/* /*
* nsJSEventListener implementation * nsJSEventListener implementation
*/ */
nsJSEventListener::nsJSEventListener(JSObject* aScopeObject, nsJSEventListener::nsJSEventListener(nsISupports *aTarget,
nsISupports *aTarget,
nsIAtom* aType, nsIAtom* aType,
const nsEventHandler& aHandler) const nsEventHandler& aHandler)
: nsIJSEventListener(aScopeObject, aTarget, aType, aHandler) : nsIJSEventListener(aTarget, aType, aHandler)
{ {
if (mScopeObject) {
mozilla::HoldJSObjects(this);
}
}
nsJSEventListener::~nsJSEventListener()
{
if (mScopeObject) {
mScopeObject = nullptr;
mozilla::DropJSObjects(this);
}
}
/* virtual */
void
nsJSEventListener::UpdateScopeObject(JS::Handle<JSObject*> aScopeObject)
{
if (mScopeObject && !aScopeObject) {
mScopeObject = nullptr;
mozilla::DropJSObjects(this);
} else if (aScopeObject && !mScopeObject) {
mozilla::HoldJSObjects(this);
}
mScopeObject = aScopeObject;
} }
NS_IMPL_CYCLE_COLLECTION_CLASS(nsJSEventListener) NS_IMPL_CYCLE_COLLECTION_CLASS(nsJSEventListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsJSEventListener) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsJSEventListener)
if (tmp->mScopeObject) {
tmp->mScopeObject = nullptr;
mozilla::DropJSObjects(tmp);
}
tmp->mHandler.ForgetHandler(); tmp->mHandler.ForgetHandler();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSEventListener) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSEventListener)
@ -98,10 +69,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSEventListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsJSEventListener)
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mScopeObject)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsJSEventListener) NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsJSEventListener)
if (tmp->IsBlackForCC()) { if (tmp->IsBlackForCC()) {
return true; return true;
@ -143,12 +110,7 @@ nsJSEventListener::IsBlackForCC()
{ {
// We can claim to be black if all the things we reference are // We can claim to be black if all the things we reference are
// effectively black already. // effectively black already.
if ((!mScopeObject || !xpc_IsGrayGCThing(mScopeObject)) && return !mHandler.HasEventHandler() || !mHandler.Ptr()->HasGrayCallable();
(!mHandler.HasEventHandler() ||
!mHandler.Ptr()->HasGrayCallable())) {
return true;
}
return false;
} }
nsresult nsresult
@ -274,14 +236,13 @@ nsJSEventListener::HandleEvent(nsIDOMEvent* aEvent)
*/ */
nsresult nsresult
NS_NewJSEventListener(JSObject* aScopeObject, NS_NewJSEventListener(nsISupports*aTarget, nsIAtom* aEventType,
nsISupports*aTarget, nsIAtom* aEventType,
const nsEventHandler& aHandler, const nsEventHandler& aHandler,
nsIJSEventListener** aReturn) nsIJSEventListener** aReturn)
{ {
NS_ENSURE_ARG(aEventType || !NS_IsMainThread()); NS_ENSURE_ARG(aEventType || !NS_IsMainThread());
nsJSEventListener* it = nsJSEventListener* it =
new nsJSEventListener(aScopeObject, aTarget, aEventType, aHandler); new nsJSEventListener(aTarget, aEventType, aHandler);
NS_ADDREF(*aReturn = it); NS_ADDREF(*aReturn = it);
return NS_OK; return NS_OK;

View File

@ -21,9 +21,8 @@
class nsJSEventListener : public nsIJSEventListener class nsJSEventListener : public nsIJSEventListener
{ {
public: public:
nsJSEventListener(JSObject* aScopeObject, nsISupports* aTarget, nsJSEventListener(nsISupports* aTarget, nsIAtom* aType,
nsIAtom* aType, const nsEventHandler& aHandler); const nsEventHandler& aHandler);
virtual ~nsJSEventListener();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -37,10 +36,7 @@ public:
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
} }
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsJSEventListener) NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS(nsJSEventListener)
protected:
virtual void UpdateScopeObject(JS::Handle<JSObject*> aScopeObject);
bool IsBlackForCC(); bool IsBlackForCC();
}; };

View File

@ -1,14 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
SUPPORT_FILES = \
testharness.js \
testharnessreport.js \
testharness.css \
idlharness.js \
WebIDLParser.js \
$(NULL)
SUPPORT_DEST = $(DEPTH)/_tests/testing/mochitest/resources
INSTALL_TARGETS += SUPPORT

View File

@ -0,0 +1,7 @@
[DEFAULT]
support-files =
/resources/testharness.js
/resources/testharnessreport.js
/resources/testharness.css
/resources/idlharness.js
/resources/WebIDLParser.js

View File

@ -7,6 +7,7 @@
MOCHITEST_MANIFESTS += [ MOCHITEST_MANIFESTS += [
'editing/mochitest.ini', 'editing/mochitest.ini',
'html/mochitest.ini', 'html/mochitest.ini',
'mochitest.ini',
'webapps/mochitest.ini', 'webapps/mochitest.ini',
] ]

View File

@ -5,7 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [ XPIDL_SOURCES += [
'nsIDOMPermissionSettings.idl',
'nsIPermissionPromptService.idl', 'nsIPermissionPromptService.idl',
] ]

View File

@ -1,21 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
interface nsIDOMDOMRequest;
[scriptable, uuid(18390770-02ab-11e2-a21f-0800200c9a66)]
interface nsIDOMPermissionSettings : nsISupports
{
DOMString get(in DOMString permission, in DOMString manifestURI, in DOMString origin, in bool browserFlag);
void set(in DOMString permission, in DOMString value, in DOMString manifestURI, in DOMString origin, in bool browserFlag);
bool isExplicit(in DOMString permission, in DOMString manifestURI, in DOMString origin, in bool browserFlag);
// Removing a permission is only allowed for pages with a different origin than the app
// and pages that have browserFlag=true, so remove() doesn't have a browserFlag parameter.
void remove(in DOMString permission, in DOMString manifestURI, in DOMString origin);
};

View File

@ -14,7 +14,7 @@ interface nsIPermissionPromptService : nsISupports
{ {
/** /**
* Checks if the capability requires a permission, fires the corresponding cancel() * Checks if the capability requires a permission, fires the corresponding cancel()
* or allow() method in aRequest after consulting nsIDOMPermissionSettings, etc. * or allow() method in aRequest after consulting PermissionSettings, etc.
*/ */
void getPermission(in nsIContentPermissionRequest aRequest); void getPermission(in nsIContentPermissionRequest aRequest);
}; };

View File

@ -628,7 +628,7 @@ TabChild::HandlePossibleViewportChange()
defaultZoom <= viewportInfo.GetMaxZoom()); defaultZoom <= viewportInfo.GetMaxZoom());
metrics.SetZoom(defaultZoom); metrics.SetZoom(defaultZoom);
metrics.mScrollId = viewId; metrics.SetScrollId(viewId);
} }
metrics.mCumulativeResolution = metrics.GetZoom() / metrics.mDevPixelsPerCSSPixel * ScreenToLayerScale(1); metrics.mCumulativeResolution = metrics.GetZoom() / metrics.mDevPixelsPerCSSPixel * ScreenToLayerScale(1);
@ -1472,7 +1472,7 @@ TabChild::DispatchMessageManagerMessage(const nsAString& aMessageName,
bool bool
TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics) TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
{ {
MOZ_ASSERT(aFrameMetrics.mScrollId != FrameMetrics::NULL_SCROLL_ID); MOZ_ASSERT(aFrameMetrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID);
if (aFrameMetrics.mIsRoot) { if (aFrameMetrics.mIsRoot) {
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils()); nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
@ -1485,7 +1485,7 @@ TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
// aFrameMetrics.mIsRoot is false, so we are trying to update a subframe. // aFrameMetrics.mIsRoot is false, so we are trying to update a subframe.
// This requires special handling. // This requires special handling.
nsCOMPtr<nsIContent> content = nsLayoutUtils::FindContentFor( nsCOMPtr<nsIContent> content = nsLayoutUtils::FindContentFor(
aFrameMetrics.mScrollId); aFrameMetrics.GetScrollId());
if (content) { if (content) {
FrameMetrics newSubFrameMetrics(aFrameMetrics); FrameMetrics newSubFrameMetrics(aFrameMetrics);
APZCCallbackHelper::UpdateSubFrame(content, newSubFrameMetrics); APZCCallbackHelper::UpdateSubFrame(content, newSubFrameMetrics);

View File

@ -26,11 +26,6 @@ const PERMISSIONPROMPTSERVICE_CONTRACTID = "@mozilla.org/permission-prompt-servi
const PERMISSIONPROMPTSERVICE_CID = Components.ID("{e5f953b3-a6ca-444e-a88d-cdc81383741c}"); const PERMISSIONPROMPTSERVICE_CID = Components.ID("{e5f953b3-a6ca-444e-a88d-cdc81383741c}");
const permissionPromptService = Ci.nsIPermissionPromptService; const permissionPromptService = Ci.nsIPermissionPromptService;
XPCOMUtils.defineLazyServiceGetter(this,
"PermSettings",
"@mozilla.org/permissionSettings;1",
"nsIDOMPermissionSettings");
var permissionManager = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager); var permissionManager = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager); var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);

View File

@ -22,7 +22,6 @@ var cpm = Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsISyncM
const PERMISSIONSETTINGS_CONTRACTID = "@mozilla.org/permissionSettings;1"; const PERMISSIONSETTINGS_CONTRACTID = "@mozilla.org/permissionSettings;1";
const PERMISSIONSETTINGS_CID = Components.ID("{cd2cf7a1-f4c1-487b-8c1b-1a71c7097431}"); const PERMISSIONSETTINGS_CID = Components.ID("{cd2cf7a1-f4c1-487b-8c1b-1a71c7097431}");
const nsIDOMPermissionSettings = Ci.nsIDOMPermissionSettings;
function PermissionSettings() function PermissionSettings()
{ {
@ -129,27 +128,8 @@ PermissionSettings.prototype = {
}); });
}, },
init: function init(aWindow) {
debug("init");
// Set navigator.mozPermissionSettings to null.
let perm = Services.perms.testExactPermissionFromPrincipal(aWindow.document.nodePrincipal, "permissions");
if (!Services.prefs.getBoolPref("dom.mozPermissionSettings.enabled")
|| perm != Ci.nsIPermissionManager.ALLOW_ACTION) {
return null;
}
debug("Permission to get/set permissions granted!");
},
classID : PERMISSIONSETTINGS_CID, classID : PERMISSIONSETTINGS_CID,
QueryInterface : XPCOMUtils.generateQI([nsIDOMPermissionSettings, Ci.nsIDOMGlobalPropertyInitializer]), QueryInterface : XPCOMUtils.generateQI([])
classInfo : XPCOMUtils.generateCI({classID: PERMISSIONSETTINGS_CID,
contractID: PERMISSIONSETTINGS_CONTRACTID,
classDescription: "PermissionSettings",
interfaces: [nsIDOMPermissionSettings],
flags: Ci.nsIClassInfo.DOM_OBJECT})
} }
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PermissionSettings]) this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PermissionSettings])

View File

@ -1,3 +1,2 @@
component {cd2cf7a1-f4c1-487b-8c1b-1a71c7097431} PermissionSettings.js component {cd2cf7a1-f4c1-487b-8c1b-1a71c7097431} PermissionSettings.js
contract @mozilla.org/permissionSettings;1 {cd2cf7a1-f4c1-487b-8c1b-1a71c7097431} contract @mozilla.org/permissionSettings;1 {cd2cf7a1-f4c1-487b-8c1b-1a71c7097431}
category JavaScript-navigator-property mozPermissionSettings @mozilla.org/permissionSettings;1

View File

@ -20,7 +20,7 @@ var gData = [
{ {
perm: ["permissions"], perm: ["permissions"],
obj: "mozPermissionSettings", obj: "mozPermissionSettings",
idl: "nsIDOMPermissionSettings", webidl: "PermissionSettings",
settings: [["dom.mozPermissionSettings.enabled", true]], settings: [["dom.mozPermissionSettings.enabled", true]],
}, },
] ]

View File

@ -181,13 +181,7 @@ SettingsServiceLock.prototype = {
}, },
classID : SETTINGSSERVICELOCK_CID, classID : SETTINGSSERVICELOCK_CID,
QueryInterface : XPCOMUtils.generateQI([nsISettingsServiceLock]), QueryInterface : XPCOMUtils.generateQI([nsISettingsServiceLock])
classInfo : XPCOMUtils.generateCI({ classID: SETTINGSSERVICELOCK_CID,
contractID: SETTINGSSERVICELOCK_CONTRACTID,
classDescription: "SettingsServiceLock",
interfaces: [nsISettingsServiceLock],
flags: nsIClassInfo.DOM_OBJECT })
}; };
const SETTINGSSERVICE_CID = Components.ID("{f656f0c0-f776-11e1-a21f-0800200c9a66}"); const SETTINGSSERVICE_CID = Components.ID("{f656f0c0-f776-11e1-a21f-0800200c9a66}");
@ -221,13 +215,7 @@ SettingsService.prototype = {
}, },
classID : SETTINGSSERVICE_CID, classID : SETTINGSSERVICE_CID,
QueryInterface : XPCOMUtils.generateQI([Ci.nsISettingsService]), QueryInterface : XPCOMUtils.generateQI([Ci.nsISettingsService])
classInfo: XPCOMUtils.generateCI({
classID: SETTINGSSERVICE_CID,
contractID: "@mozilla.org/settingsService;1",
interfaces: [Ci.nsISettingsService],
flags: nsIClassInfo.DOM_OBJECT
})
} }
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SettingsService, SettingsServiceLock]) this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SettingsService, SettingsServiceLock])

View File

@ -28,7 +28,7 @@ LOCAL_INCLUDES += [
if CONFIG['MOZ_ENABLE_QT5GEOPOSITION']: if CONFIG['MOZ_ENABLE_QT5GEOPOSITION']:
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
'/dom/system/unix', '/dom/system/qt',
] ]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':

View File

@ -684,7 +684,7 @@ nsresult nsGeolocationService::Init()
#endif #endif
#ifdef MOZ_WIDGET_GONK #ifdef MOZ_WIDGET_GONK
mProvider = do_GetService(GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID); mProvider = do_CreateInstance(GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID);
#endif #endif
#ifdef MOZ_WIDGET_COCOA #ifdef MOZ_WIDGET_COCOA
@ -694,7 +694,7 @@ nsresult nsGeolocationService::Init()
#endif #endif
if (Preferences::GetBool("geo.provider.use_mls", false)) { if (Preferences::GetBool("geo.provider.use_mls", false)) {
mProvider = do_GetService("@mozilla.org/geolocation/mls-provider;1"); mProvider = do_CreateInstance("@mozilla.org/geolocation/mls-provider;1");
} }
// Override platform-specific providers with the default (network) // Override platform-specific providers with the default (network)

View File

@ -87,6 +87,8 @@ WifiGeoPositionProvider.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIGeolocationProvider, QueryInterface: XPCOMUtils.generateQI([Ci.nsIGeolocationProvider,
Ci.nsIWifiListener, Ci.nsIWifiListener,
Ci.nsITimerCallback]), Ci.nsITimerCallback]),
listener: null,
startup: function() { startup: function() {
if (this.started) if (this.started)
return; return;
@ -104,6 +106,7 @@ WifiGeoPositionProvider.prototype = {
}, },
watch: function(c) { watch: function(c) {
this.listener = c;
}, },
shutdown: function() { shutdown: function() {
@ -121,6 +124,7 @@ WifiGeoPositionProvider.prototype = {
this.wifiService.stopWatching(this); this.wifiService.stopWatching(this);
this.wifiService = null; this.wifiService = null;
} }
this.listener = null;
this.started = false; this.started = false;
}, },
@ -186,17 +190,18 @@ WifiGeoPositionProvider.prototype = {
notify: function (timeoutTimer) { notify: function (timeoutTimer) {
let url = Services.urlFormatter.formatURLPref("geo.wifi.uri"); let url = Services.urlFormatter.formatURLPref("geo.wifi.uri");
let listener = this.listener;
LOG("Sending request: " + url + "\n"); LOG("Sending request: " + url + "\n");
let xhr = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"] let xhr = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest); .createInstance(Ci.nsIXMLHttpRequest);
getGeoService().locationUpdatePending(); listener.locationUpdatePending();
try { try {
xhr.open("POST", url, true); xhr.open("POST", url, true);
} catch (e) { } catch (e) {
getGeoService().notifyError(POSITION_UNAVAILABLE); listener.notifyError(POSITION_UNAVAILABLE);
return; return;
} }
xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
@ -204,13 +209,13 @@ WifiGeoPositionProvider.prototype = {
xhr.mozBackgroundRequest = true; xhr.mozBackgroundRequest = true;
xhr.channel.loadFlags = Ci.nsIChannel.LOAD_ANONYMOUS; xhr.channel.loadFlags = Ci.nsIChannel.LOAD_ANONYMOUS;
xhr.onerror = function() { xhr.onerror = function() {
getGeoService().notifyError(POSITION_UNAVAILABLE); listener.notifyError(POSITION_UNAVAILABLE);
}; };
xhr.onload = function() { xhr.onload = function() {
LOG("gls returned status: " + xhr.status + " --> " + JSON.stringify(xhr.response)); LOG("gls returned status: " + xhr.status + " --> " + JSON.stringify(xhr.response));
if ((xhr.channel instanceof Ci.nsIHttpChannel && xhr.status != 200) || if ((xhr.channel instanceof Ci.nsIHttpChannel && xhr.status != 200) ||
!xhr.response || !xhr.response.location) { !xhr.response || !xhr.response.location) {
getGeoService().notifyError(POSITION_UNAVAILABLE); listener.notifyError(POSITION_UNAVAILABLE);
return; return;
} }
@ -218,7 +223,7 @@ WifiGeoPositionProvider.prototype = {
xhr.response.location.lng, xhr.response.location.lng,
xhr.response.accuracy); xhr.response.accuracy);
getGeoService().update(newLocation); listener.update(newLocation);
}; };
if (gCellScanningEnabled) { if (gCellScanningEnabled) {
@ -239,8 +244,4 @@ WifiGeoPositionProvider.prototype = {
}, },
}; };
function getGeoService() {
return Cc["@mozilla.org/geolocation/service;1"].getService(Ci.nsIGeolocationUpdate);
}
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WifiGeoPositionProvider]); this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WifiGeoPositionProvider]);

View File

@ -26,6 +26,7 @@
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "prtime.h"
#ifdef MOZ_B2G_RIL #ifdef MOZ_B2G_RIL
#include "nsIDOMIccInfo.h" #include "nsIDOMIccInfo.h"
@ -98,6 +99,7 @@ GonkGPSGeolocationProvider::LocationCallback(GpsLocation* location)
NS_IMETHOD Run() { NS_IMETHOD Run() {
nsRefPtr<GonkGPSGeolocationProvider> provider = nsRefPtr<GonkGPSGeolocationProvider> provider =
GonkGPSGeolocationProvider::GetSingleton(); GonkGPSGeolocationProvider::GetSingleton();
provider->mLastGPSDerivedLocationTime = PR_Now();
nsCOMPtr<nsIGeolocationUpdate> callback = provider->mLocationCallback; nsCOMPtr<nsIGeolocationUpdate> callback = provider->mLocationCallback;
if (callback) { if (callback) {
callback->Update(mPosition); callback->Update(mPosition);
@ -523,8 +525,29 @@ GonkGPSGeolocationProvider::SetReferenceLocation()
} }
} }
} }
#endif // MOZ_B2G_RIL #endif // MOZ_B2G_RIL
void
GonkGPSGeolocationProvider::InjectLocation(double latitude,
double longitude,
float accuracy)
{
#ifdef DEBUG_GPS
printf_stderr("*** injecting location\n");
printf_stderr("*** lat: %f\n", latitude);
printf_stderr("*** lon: %f\n", longitude);
printf_stderr("*** accuracy: %f\n", accuracy);
#endif
MOZ_ASSERT(NS_IsMainThread());
if (!mGpsInterface) {
return;
}
mGpsInterface->inject_location(latitude, longitude, accuracy);
}
void void
GonkGPSGeolocationProvider::Init() GonkGPSGeolocationProvider::Init()
{ {
@ -626,6 +649,49 @@ GonkGPSGeolocationProvider::SetupAGPS()
} }
#endif // MOZ_B2G_RIL #endif // MOZ_B2G_RIL
NS_IMPL_ISUPPORTS1(GonkGPSGeolocationProvider::NetworkLocationUpdate,
nsIGeolocationUpdate)
NS_IMETHODIMP
GonkGPSGeolocationProvider::NetworkLocationUpdate::Update(nsIDOMGeoPosition *position)
{
nsRefPtr<GonkGPSGeolocationProvider> provider =
GonkGPSGeolocationProvider::GetSingleton();
nsCOMPtr<nsIDOMGeoPositionCoords> coords;
position->GetCoords(getter_AddRefs(coords));
if (!coords) {
return NS_ERROR_FAILURE;
}
// if we haven't seen anything from the GPS device for 1s,
// use this network derived location.
int64_t diff = PR_Now() - provider->mLastGPSDerivedLocationTime;
if (provider->mLocationCallback && diff > kDefaultPeriod) {
provider->mLocationCallback->Update(position);
}
double lat, lon, acc;
coords->GetLatitude(&lat);
coords->GetLongitude(&lon);
coords->GetAccuracy(&acc);
provider->InjectLocation(lat, lon, acc);
return NS_OK;
}
NS_IMETHODIMP
GonkGPSGeolocationProvider::NetworkLocationUpdate::LocationUpdatePending()
{
return NS_OK;
}
NS_IMETHODIMP
GonkGPSGeolocationProvider::NetworkLocationUpdate::NotifyError(uint16_t error)
{
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
GonkGPSGeolocationProvider::Startup() GonkGPSGeolocationProvider::Startup()
{ {
@ -643,6 +709,16 @@ GonkGPSGeolocationProvider::Startup()
mInitThread->Dispatch(NS_NewRunnableMethod(this, &GonkGPSGeolocationProvider::Init), mInitThread->Dispatch(NS_NewRunnableMethod(this, &GonkGPSGeolocationProvider::Init),
NS_DISPATCH_NORMAL); NS_DISPATCH_NORMAL);
mNetworkLocationProvider = do_CreateInstance("@mozilla.org/geolocation/mls-provider;1");
if (mNetworkLocationProvider) {
nsresult rv = mNetworkLocationProvider->Startup();
if (NS_SUCCEEDED(rv)) {
nsRefPtr<NetworkLocationUpdate> update = new NetworkLocationUpdate();
mNetworkLocationProvider->Watch(update);
}
}
mLastGPSDerivedLocationTime = 0;
mStarted = true; mStarted = true;
return NS_OK; return NS_OK;
} }
@ -665,6 +741,7 @@ GonkGPSGeolocationProvider::Shutdown()
return NS_OK; return NS_OK;
} }
mStarted = false; mStarted = false;
mNetworkLocationProvider = nullptr;
#ifdef MOZ_B2G_RIL #ifdef MOZ_B2G_RIL
if (mRadioInterface) { if (mRadioInterface) {

View File

@ -55,7 +55,7 @@ private:
GonkGPSGeolocationProvider(); GonkGPSGeolocationProvider();
GonkGPSGeolocationProvider(const GonkGPSGeolocationProvider &); GonkGPSGeolocationProvider(const GonkGPSGeolocationProvider &);
GonkGPSGeolocationProvider & operator = (const GonkGPSGeolocationProvider &); GonkGPSGeolocationProvider & operator = (const GonkGPSGeolocationProvider &);
~GonkGPSGeolocationProvider(); virtual ~GonkGPSGeolocationProvider();
static void LocationCallback(GpsLocation* location); static void LocationCallback(GpsLocation* location);
static void StatusCallback(GpsStatus* status); static void StatusCallback(GpsStatus* status);
@ -81,6 +81,7 @@ private:
void Init(); void Init();
void StartGPS(); void StartGPS();
void ShutdownGPS(); void ShutdownGPS();
void InjectLocation(double latitude, double longitude, float accuracy);
#ifdef MOZ_B2G_RIL #ifdef MOZ_B2G_RIL
void SetupAGPS(); void SetupAGPS();
int32_t GetDataConnectionState(); int32_t GetDataConnectionState();
@ -113,7 +114,21 @@ private:
nsCOMPtr<nsIRadioInterface> mRadioInterface; nsCOMPtr<nsIRadioInterface> mRadioInterface;
#endif #endif
nsCOMPtr<nsIGeolocationUpdate> mLocationCallback; nsCOMPtr<nsIGeolocationUpdate> mLocationCallback;
PRTime mLastGPSDerivedLocationTime;
nsCOMPtr<nsIThread> mInitThread; nsCOMPtr<nsIThread> mInitThread;
nsCOMPtr<nsIGeolocationProvider> mNetworkLocationProvider;
class NetworkLocationUpdate : public nsIGeolocationUpdate
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIGEOLOCATIONUPDATE
NetworkLocationUpdate() {}
private:
virtual ~NetworkLocationUpdate() {}
};
}; };
#endif /* GonkGPSGeolocationProvider_h */ #endif /* GonkGPSGeolocationProvider_h */

View File

@ -743,6 +743,8 @@ var interfaceNamesInGlobalScope =
"PerformanceTiming", "PerformanceTiming",
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
"PeriodicWave", "PeriodicWave",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "PermissionSettings", b2g: true, permission: "permissions"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
"PhoneNumberService", "PhoneNumberService",
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -0,0 +1,15 @@
/* 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/. */
[Pref="dom.sysmsg.enabled",
JSImplementation="@mozilla.org/dom/activities/request-handler;1",
ChromeConstructor(DOMString id, optional ActivityOptions options),
ChromeOnly]
interface ActivityRequestHandler
{
void postResult(any result);
void postError(DOMString error);
[Pure, Cached, Frozen]
readonly attribute ActivityOptions source;
};

View File

@ -0,0 +1,20 @@
/* 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 at http://mozilla.org/MPL/2.0/. */
[JSImplementation="@mozilla.org/permissionSettings;1",
Func="Navigator::HasPermissionSettingsSupport",
Pref="dom.mozPermissionSettings.enabled",
NavigatorProperty="mozPermissionSettings"]
interface PermissionSettings
{
DOMString get(DOMString permission, DOMString manifestURI, DOMString origin, boolean browserFlag);
void set(DOMString permission, DOMString value, DOMString manifestURI, DOMString origin, boolean browserFlag);
boolean isExplicit(DOMString permission, DOMString manifestURI, DOMString origin, boolean browserFlag);
// Removing a permission is only allowed for pages with a different origin than the app
// and pages that have browserFlag=true, so remove() doesn't have a browserFlag parameter.
void remove(DOMString permission, DOMString manifestURI, DOMString origin);
};

View File

@ -16,6 +16,7 @@ PREPROCESSED_WEBIDL_FILES = [
WEBIDL_FILES = [ WEBIDL_FILES = [
'AbstractWorker.webidl', 'AbstractWorker.webidl',
'ActivityRequestHandler.webidl',
'AnalyserNode.webidl', 'AnalyserNode.webidl',
'AnimationEvent.webidl', 'AnimationEvent.webidl',
'AppInfo.webidl', 'AppInfo.webidl',
@ -270,6 +271,7 @@ WEBIDL_FILES = [
'PerformanceNavigation.webidl', 'PerformanceNavigation.webidl',
'PerformanceTiming.webidl', 'PerformanceTiming.webidl',
'PeriodicWave.webidl', 'PeriodicWave.webidl',
'PermissionSettings.webidl',
'PhoneNumberService.webidl', 'PhoneNumberService.webidl',
'Plugin.webidl', 'Plugin.webidl',
'PluginArray.webidl', 'PluginArray.webidl',
@ -615,7 +617,7 @@ if CONFIG['MOZ_B2G_BT']:
'BluetoothStatusChangedEvent.webidl', 'BluetoothStatusChangedEvent.webidl',
] ]
if CONFIG['MOZ_BUILD_APP'] in ['browser', 'xulrunner']: if CONFIG['MOZ_BUILD_APP'] == 'browser':
WEBIDL_FILES += [ WEBIDL_FILES += [
'BrowserFeedWriter.webidl', 'BrowserFeedWriter.webidl',
] ]

View File

@ -326,8 +326,7 @@ nsXBLPrototypeHandler::ExecuteHandler(EventTarget* aTarget,
// Execute it. // Execute it.
nsCOMPtr<nsIJSEventListener> eventListener; nsCOMPtr<nsIJSEventListener> eventListener;
rv = NS_NewJSEventListener(globalObject, rv = NS_NewJSEventListener(scriptTarget, onEventAtom,
scriptTarget, onEventAtom,
eventHandler, eventHandler,
getter_AddRefs(eventListener)); getter_AddRefs(eventListener));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);

View File

@ -1108,8 +1108,8 @@ FilterNodeTransformSoftware::Render(const IntRect& aRect)
return nullptr; return nullptr;
} }
Matrix transform = Matrix().Translate(srcRect.x, srcRect.y) * mMatrix * Matrix transform = Matrix::Translation(srcRect.x, srcRect.y) * mMatrix *
Matrix().Translate(-aRect.x, -aRect.y); Matrix::Translation(-aRect.x, -aRect.y);
if (transform.IsIdentity() && srcRect.Size() == aRect.Size()) { if (transform.IsIdentity() && srcRect.Size() == aRect.Size()) {
return input; return input;
} }

View File

@ -10,6 +10,15 @@
namespace mozilla { namespace mozilla {
namespace gfx { namespace gfx {
static float CubicRoot(float aValue) {
if (aValue < 0.0) {
return -CubicRoot(-aValue);
}
else {
return powf(aValue, 1.0f / 3.0f);
}
}
struct BezierControlPoints struct BezierControlPoints
{ {
BezierControlPoints() {} BezierControlPoints() {}
@ -269,8 +278,8 @@ FindInflectionApproximationRange(BezierControlPoints aControlPoints,
if (cp21.x == 0 && cp21.y == 0) { if (cp21.x == 0 && cp21.y == 0) {
// In this case s3 becomes lim[n->0] (cp41.x * n) / n - (cp41.y * n) / n = cp41.x - cp41.y. // In this case s3 becomes lim[n->0] (cp41.x * n) / n - (cp41.y * n) / n = cp41.x - cp41.y.
*aMin = aT - pow(aTolerance / (cp41.x - cp41.y), Float(1. / 3.)); *aMin = aT - CubicRoot(double(aTolerance / (cp41.x - cp41.y)));
*aMax = aT + pow(aTolerance / (cp41.x - cp41.y), Float(1. / 3.));; *aMax = aT + CubicRoot(aTolerance / (cp41.x - cp41.y));
return; return;
} }
@ -285,7 +294,7 @@ FindInflectionApproximationRange(BezierControlPoints aControlPoints,
return; return;
} }
Float tf = pow(abs(aTolerance / s3), Float(1. / 3.)); Float tf = CubicRoot(abs(aTolerance / s3));
*aMin = aT - tf * (1 - aT); *aMin = aT - tf * (1 - aT);
*aMax = aT + tf * (1 - aT); *aMax = aT + tf * (1 - aT);
@ -445,7 +454,7 @@ FlattenBezier(const BezierControlPoints &aControlPoints,
&remainingCP, t1min); &remainingCP, t1min);
FlattenBezierCurveSegment(prevCPs, aSink, aTolerance); FlattenBezierCurveSegment(prevCPs, aSink, aTolerance);
} }
if (t1max < 1.0 && (count == 1 || t2min > t1max)) { if (t1max >= 0 && t1max < 1.0 && (count == 1 || t2min > t1max)) {
// The second inflection point's approximation range begins after the end // The second inflection point's approximation range begins after the end
// of the first, approximate the first inflection point by a line and // of the first, approximate the first inflection point by a line and
// subsequently flatten up until the end or the next inflection point. // subsequently flatten up until the end or the next inflection point.

View File

@ -5,9 +5,13 @@
ifdef MOZ_ANGLE_RENDERER ifdef MOZ_ANGLE_RENDERER
libs:: libs::
ifdef MOZ_HAS_WINSDK_WITH_D3D
cp -fp "$(MOZ_D3DCOMPILER_DLL_PATH)" "$(DIST)/bin"
else
ifdef MOZ_D3DCOMPILER_CAB ifdef MOZ_D3DCOMPILER_CAB
expand '$(MOZ_D3DCOMPILER_CAB)' -F:$(MOZ_D3DCOMPILER_DLL) '$(DIST)/bin' expand '$(MOZ_D3DCOMPILER_CAB)' -F:$(MOZ_D3DCOMPILER_DLL) '$(DIST)/bin'
endif endif
endif
endif endif

View File

@ -13,7 +13,9 @@ endif
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
ifndef MOZ_HAS_WINSDK_WITH_D3D
CXXFLAGS += -I'$(MOZ_DIRECTX_SDK_PATH)/include' CXXFLAGS += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
endif
#OS_LIBS += $(call EXPAND_LIBNAME,dwmapi) #OS_LIBS += $(call EXPAND_LIBNAME,dwmapi)
@ -24,8 +26,12 @@ OS_LIBS += -ld3d9 -llibGLESv2
else else
ifdef MOZ_HAS_WINSDK_WITH_D3D
EXTRA_DSO_LDOPTS = d3d9.lib "$(DIST)/lib/libGLESv2.lib" delayimp.lib
else
EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib' \ EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib' \
'$(DIST)/lib/libGLESv2.lib' \ '$(DIST)/lib/libGLESv2.lib' \
delayimp.lib delayimp.lib
endif
endif endif

View File

@ -11,7 +11,9 @@ endif
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
ifndef MOZ_HAS_WINSDK_WITH_D3D
CXXFLAGS += -I'$(MOZ_DIRECTX_SDK_PATH)/include' CXXFLAGS += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
endif
ifdef GNU_CC ifdef GNU_CC
@ -20,8 +22,12 @@ OS_LIBS += -ld3d9 -ldxguid
else else
ifdef MOZ_HAS_WINSDK_WITH_D3D
EXTRA_DSO_LDOPTS = d3d9.lib dxguid.lib delayimp.lib
else
EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib' \ EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib' \
'$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/dxguid.lib' \ '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/dxguid.lib' \
delayimp.lib delayimp.lib
endif
endif endif

View File

@ -71,7 +71,6 @@ public:
, mDisplayPort(0, 0, 0, 0) , mDisplayPort(0, 0, 0, 0)
, mCriticalDisplayPort(0, 0, 0, 0) , mCriticalDisplayPort(0, 0, 0, 0)
, mViewport(0, 0, 0, 0) , mViewport(0, 0, 0, 0)
, mScrollId(NULL_SCROLL_ID)
, mScrollableRect(0, 0, 0, 0) , mScrollableRect(0, 0, 0, 0)
, mResolution(1) , mResolution(1)
, mCumulativeResolution(1) , mCumulativeResolution(1)
@ -81,6 +80,7 @@ public:
, mMayHaveTouchListeners(false) , mMayHaveTouchListeners(false)
, mIsRoot(false) , mIsRoot(false)
, mHasScrollgrab(false) , mHasScrollgrab(false)
, mScrollId(NULL_SCROLL_ID)
, mScrollOffset(0, 0) , mScrollOffset(0, 0)
, mZoom(1) , mZoom(1)
, mUpdateScrollOffset(false) , mUpdateScrollOffset(false)
@ -97,7 +97,6 @@ public:
mDisplayPort.IsEqualEdges(aOther.mDisplayPort) && mDisplayPort.IsEqualEdges(aOther.mDisplayPort) &&
mCriticalDisplayPort.IsEqualEdges(aOther.mCriticalDisplayPort) && mCriticalDisplayPort.IsEqualEdges(aOther.mCriticalDisplayPort) &&
mViewport.IsEqualEdges(aOther.mViewport) && mViewport.IsEqualEdges(aOther.mViewport) &&
mScrollId == aOther.mScrollId &&
mScrollableRect.IsEqualEdges(aOther.mScrollableRect) && mScrollableRect.IsEqualEdges(aOther.mScrollableRect) &&
mResolution == aOther.mResolution && mResolution == aOther.mResolution &&
mCumulativeResolution == aOther.mCumulativeResolution && mCumulativeResolution == aOther.mCumulativeResolution &&
@ -105,6 +104,7 @@ public:
mMayHaveTouchListeners == aOther.mMayHaveTouchListeners && mMayHaveTouchListeners == aOther.mMayHaveTouchListeners &&
mPresShellId == aOther.mPresShellId && mPresShellId == aOther.mPresShellId &&
mIsRoot == aOther.mIsRoot && mIsRoot == aOther.mIsRoot &&
mScrollId == aOther.mScrollId &&
mScrollOffset == aOther.mScrollOffset && mScrollOffset == aOther.mScrollOffset &&
mHasScrollgrab == aOther.mHasScrollgrab && mHasScrollgrab == aOther.mHasScrollgrab &&
mUpdateScrollOffset == aOther.mUpdateScrollOffset; mUpdateScrollOffset == aOther.mUpdateScrollOffset;
@ -265,9 +265,6 @@ public:
// meaningless and invalid. // meaningless and invalid.
CSSRect mViewport; CSSRect mViewport;
// A unique ID assigned to each scrollable frame.
ViewID mScrollId;
// The scrollable bounds of a frame. This is determined by reflow. // The scrollable bounds of a frame. This is determined by reflow.
// Ordinarily the x and y will be 0 and the width and height will be the // Ordinarily the x and y will be 0 and the width and height will be the
// size of the element being scrolled. However for RTL pages or elements // size of the element being scrolled. However for RTL pages or elements
@ -370,10 +367,23 @@ public:
mContentDescription = aContentDescription; mContentDescription = aContentDescription;
} }
ViewID GetScrollId() const
{
return mScrollId;
}
void SetScrollId(ViewID scrollId)
{
mScrollId = scrollId;
}
private: private:
// New fields from now on should be made private and old fields should // New fields from now on should be made private and old fields should
// be refactored to be private. // be refactored to be private.
// A unique ID assigned to each scrollable frame.
ViewID mScrollId;
// The position of the top-left of the CSS viewport, relative to the document // The position of the top-left of the CSS viewport, relative to the document
// (or the document relative to the viewport, if that helps understand it). // (or the document relative to the viewport, if that helps understand it).
// //
@ -441,7 +451,7 @@ struct ScrollableLayerGuid {
ScrollableLayerGuid(uint64_t aLayersId, const FrameMetrics& aMetrics) ScrollableLayerGuid(uint64_t aLayersId, const FrameMetrics& aMetrics)
: mLayersId(aLayersId) : mLayersId(aLayersId)
, mPresShellId(aMetrics.mPresShellId) , mPresShellId(aMetrics.mPresShellId)
, mScrollId(aMetrics.mScrollId) , mScrollId(aMetrics.GetScrollId())
{ {
MOZ_COUNT_CTOR(ScrollableLayerGuid); MOZ_COUNT_CTOR(ScrollableLayerGuid);
} }

View File

@ -472,6 +472,26 @@ PlanarYCbCrImage::~PlanarYCbCrImage()
} }
} }
size_t
PlanarYCbCrImage::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
// Ignoring:
// - mData - just wraps mBuffer
// - Surfaces should be reported under gfx-surfaces-*:
// - mDeprecatedSurface
// - mSourceSurface
// - Base class:
// - mImplData is not used
// Not owned:
// - mRecycleBin
size_t size = mBuffer.SizeOfExcludingThis(aMallocSizeOf);
// Could add in the future:
// - mBackendData (from base class)
return size;
}
uint8_t* uint8_t*
PlanarYCbCrImage::AllocateBuffer(uint32_t aSize) PlanarYCbCrImage::AllocateBuffer(uint32_t aSize)
{ {

View File

@ -863,6 +863,12 @@ public:
virtual SharedPlanarYCbCrImage *AsSharedPlanarYCbCrImage() { return nullptr; } virtual SharedPlanarYCbCrImage *AsSharedPlanarYCbCrImage() { return nullptr; }
virtual DeprecatedSharedPlanarYCbCrImage *AsDeprecatedSharedPlanarYCbCrImage() { return nullptr; } virtual DeprecatedSharedPlanarYCbCrImage *AsDeprecatedSharedPlanarYCbCrImage() { return nullptr; }
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const;
protected: protected:
/** /**
* Make a copy of the YCbCr data into local storage. * Make a copy of the YCbCr data into local storage.

View File

@ -500,16 +500,16 @@ Layer::SnapTransformTranslation(const Matrix4x4& aTransform,
!matrix2D.HasNonTranslation() && !matrix2D.HasNonTranslation() &&
matrix2D.HasNonIntegerTranslation()) { matrix2D.HasNonIntegerTranslation()) {
IntPoint snappedTranslation = RoundedToInt(matrix2D.GetTranslation()); IntPoint snappedTranslation = RoundedToInt(matrix2D.GetTranslation());
Matrix snappedMatrix = Matrix().Translate(snappedTranslation.x, Matrix snappedMatrix = Matrix::Translation(snappedTranslation.x,
snappedTranslation.y); snappedTranslation.y);
result = Matrix4x4::From2D(snappedMatrix); result = Matrix4x4::From2D(snappedMatrix);
if (aResidualTransform) { if (aResidualTransform) {
// set aResidualTransform so that aResidual * snappedMatrix == matrix2D. // set aResidualTransform so that aResidual * snappedMatrix == matrix2D.
// (I.e., appying snappedMatrix after aResidualTransform gives the // (I.e., appying snappedMatrix after aResidualTransform gives the
// ideal transform.) // ideal transform.)
*aResidualTransform = *aResidualTransform =
Matrix().Translate(matrix2D._31 - snappedTranslation.x, Matrix::Translation(matrix2D._31 - snappedTranslation.x,
matrix2D._32 - snappedTranslation.y); matrix2D._32 - snappedTranslation.y);
} }
} else { } else {
result = aTransform; result = aTransform;

View File

@ -121,7 +121,7 @@ AppendToString(nsACString& s, const FrameMetrics& m,
AppendToString(s, m.GetScrollOffset(), " viewportScroll="); AppendToString(s, m.GetScrollOffset(), " viewportScroll=");
AppendToString(s, m.mDisplayPort, " displayport="); AppendToString(s, m.mDisplayPort, " displayport=");
AppendToString(s, m.mScrollableRect, " scrollableRect="); AppendToString(s, m.mScrollableRect, " scrollableRect=");
AppendToString(s, m.mScrollId, " scrollId=", " }"); AppendToString(s, m.GetScrollId(), " scrollId=", " }");
return s += sfx; return s += sfx;
} }

View File

@ -55,6 +55,18 @@ public:
already_AddRefed<gfxASurface> DeprecatedGetAsSurface(); already_AddRefed<gfxASurface> DeprecatedGetAsSurface();
TemporaryRef<gfx::SourceSurface> GetAsSourceSurface(); TemporaryRef<gfx::SourceSurface> GetAsSourceSurface();
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE
{
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE
{
size_t size = PlanarYCbCrImage::SizeOfExcludingThis(aMallocSizeOf);
size += mDecodedBuffer.SizeOfExcludingThis(aMallocSizeOf);
return size;
}
private: private:
nsAutoArrayPtr<uint8_t> mDecodedBuffer; nsAutoArrayPtr<uint8_t> mDecodedBuffer;
gfx::IntSize mScaleHint; gfx::IntSize mScaleHint;

View File

@ -29,7 +29,7 @@ ClientTiledThebesLayer::ClientTiledThebesLayer(ClientLayerManager* const aManage
, mContentClient() , mContentClient()
{ {
MOZ_COUNT_CTOR(ClientTiledThebesLayer); MOZ_COUNT_CTOR(ClientTiledThebesLayer);
mPaintData.mLastScrollOffset = ScreenPoint(0, 0); mPaintData.mLastScrollOffset = ParentLayerPoint(0, 0);
mPaintData.mFirstPaint = true; mPaintData.mFirstPaint = true;
} }
@ -67,73 +67,106 @@ ClientTiledThebesLayer::BeginPaint()
mPaintData.mLowPrecisionPaintCount = 0; mPaintData.mLowPrecisionPaintCount = 0;
mPaintData.mPaintFinished = false; mPaintData.mPaintFinished = false;
mPaintData.mCompositionBounds.SetEmpty();
mPaintData.mCriticalDisplayPort.SetEmpty();
// Get the metrics of the nearest scroll container. if (!GetBaseTransform().Is2DIntegerTranslation()) {
// Give up if the layer is transformed. The code below assumes that there
// is no transform set, and not making that assumption would cause huge
// complication to handle a quite rare case.
//
// FIXME The intention is to bail out of this function when there's a CSS
// transform set on the layer, but unfortunately there's no way to
// distinguish transforms due to scrolling from transforms due to
// CSS transforms.
//
// Because of this, there may be unintended behaviour when setting
// 2d CSS translations on the children of scrollable displayport
// layers.
return;
}
// Get the metrics of the nearest scrollable layer and the nearest layer
// with a displayport.
ContainerLayer* displayPortParent = nullptr;
ContainerLayer* scrollParent = nullptr; ContainerLayer* scrollParent = nullptr;
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) { for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
const FrameMetrics& metrics = parent->GetFrameMetrics(); const FrameMetrics& metrics = parent->GetFrameMetrics();
if (metrics.mScrollId != FrameMetrics::NULL_SCROLL_ID) { if (!scrollParent && metrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID) {
scrollParent = parent; scrollParent = parent;
}
if (!metrics.mDisplayPort.IsEmpty()) {
displayPortParent = parent;
// Any layer that has a displayport must be scrollable, so we can break
// here.
break; break;
} }
} }
if (!scrollParent) { if (!displayPortParent || !scrollParent) {
// XXX I don't think this can happen, but if it does, warn and set the // No displayport or scroll parent, so we can't do progressive rendering.
// composition bounds to empty so that progressive updates are disabled. // Just set the composition bounds to empty and return.
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_B2G)
// Both Android and b2g are guaranteed to have a displayport set, so this
// should never happen.
NS_WARNING("Tiled Thebes layer with no scrollable container parent"); NS_WARNING("Tiled Thebes layer with no scrollable container parent");
mPaintData.mCompositionBounds.SetEmpty(); #endif
return; return;
} }
const FrameMetrics& metrics = scrollParent->GetFrameMetrics(); // Note, not handling transformed layers lets us assume that LayoutDevice
// space of the scroll parent layer is the same as LayoutDevice space of
// this layer.
const FrameMetrics& scrollMetrics = scrollParent->GetFrameMetrics();
const FrameMetrics& displayportMetrics = displayPortParent->GetFrameMetrics();
// Calculate the transform required to convert parent layer space into // Calculate the transform required to convert ParentLayer space of our
// transformed layout device space. // display port parent to LayoutDevice space of this layer.
gfx::Matrix4x4 effectiveTransform = GetEffectiveTransform(); gfx::Matrix4x4 transform = scrollParent->GetTransform();
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) { ContainerLayer* displayPortParentParent = displayPortParent->GetParent() ?
if (parent->UseIntermediateSurface()) { displayPortParent->GetParent()->GetParent() : nullptr;
effectiveTransform = effectiveTransform * parent->GetEffectiveTransform(); for (ContainerLayer* parent = scrollParent->GetParent();
} parent != displayPortParentParent;
parent = parent->GetParent()) {
transform = transform * parent->GetTransform();
} }
gfx3DMatrix layoutToParentLayer; gfx3DMatrix layoutDeviceToScrollParentLayer;
gfx::To3DMatrix(effectiveTransform, layoutToParentLayer); gfx::To3DMatrix(transform, layoutDeviceToScrollParentLayer);
layoutToParentLayer.ScalePost(metrics.GetParentResolution().scale, layoutDeviceToScrollParentLayer.ScalePost(scrollMetrics.mCumulativeResolution.scale,
metrics.GetParentResolution().scale, scrollMetrics.mCumulativeResolution.scale,
1.f); 1.f);
mPaintData.mTransformParentLayerToLayout = layoutToParentLayer.Inverse(); mPaintData.mTransformParentLayerToLayoutDevice = layoutDeviceToScrollParentLayer.Inverse();
// Compute the critical display port in layer space. // Compute the critical display port of the display port layer in
mPaintData.mLayoutCriticalDisplayPort.SetEmpty(); // LayoutDevice space of this layer.
if (!metrics.mCriticalDisplayPort.IsEmpty()) { ParentLayerRect criticalDisplayPort =
// Convert the display port to screen space first so that we can transform (displayportMetrics.mCriticalDisplayPort + displayportMetrics.GetScrollOffset()) *
// it into layout device space. displayportMetrics.GetZoomToParent();
const ParentLayerRect& criticalDisplayPort = metrics.mCriticalDisplayPort mPaintData.mCriticalDisplayPort = LayoutDeviceIntRect::ToUntyped(RoundedOut(
* metrics.mDevPixelsPerCSSPixel ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayoutDevice,
* metrics.GetParentResolution(); criticalDisplayPort)));
LayoutDeviceRect transformedCriticalDisplayPort =
ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayout, criticalDisplayPort);
mPaintData.mLayoutCriticalDisplayPort =
LayoutDeviceIntRect::ToUntyped(RoundedOut(transformedCriticalDisplayPort));
}
// Calculate the frame resolution. Because this is Gecko-side, before any // Compute the viewport of the display port layer in LayoutDevice space of
// async transforms have occurred, we can use mZoom for this. // this layer.
mPaintData.mResolution = metrics.GetZoom(); ParentLayerRect viewport =
(displayportMetrics.mViewport + displayportMetrics.GetScrollOffset()) *
displayportMetrics.GetZoomToParent();
mPaintData.mViewport = ApplyParentLayerToLayoutTransform(
mPaintData.mTransformParentLayerToLayoutDevice, viewport);
// Calculate the scroll offset since the last transaction, and the // Store the scroll parent resolution. Because this is Gecko-side, before any
// composition bounds. // async transforms have occurred, we can use the zoom for this.
mPaintData.mCompositionBounds.SetEmpty(); mPaintData.mResolution = displayportMetrics.GetZoomToParent();
mPaintData.mScrollOffset.MoveTo(0, 0);
Layer* primaryScrollable = ClientManager()->GetPrimaryScrollableLayer(); // Store the parent composition bounds in LayoutDevice units.
if (primaryScrollable) { // This is actually in LayoutDevice units of the scrollParent's parent layer,
const FrameMetrics& metrics = primaryScrollable->AsContainerLayer()->GetFrameMetrics(); // but because there is no transform, we can assume that these are the same.
mPaintData.mScrollOffset = metrics.GetScrollOffset() * metrics.GetZoom(); mPaintData.mCompositionBounds =
mPaintData.mCompositionBounds = scrollMetrics.mCompositionBounds / scrollMetrics.GetParentResolution();
ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayout,
ParentLayerRect(metrics.mCompositionBounds)); // Calculate the scroll offset since the last transaction
} mPaintData.mScrollOffset = displayportMetrics.GetScrollOffset() * displayportMetrics.GetZoomToParent();
} }
void void
@ -213,15 +246,15 @@ ClientTiledThebesLayer::RenderLayer()
// discarded on the first update. // discarded on the first update.
if (!ClientManager()->IsRepeatTransaction()) { if (!ClientManager()->IsRepeatTransaction()) {
mValidRegion.And(mValidRegion, mVisibleRegion); mValidRegion.And(mValidRegion, mVisibleRegion);
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) { if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
// Make sure that tiles that fall outside of the critical displayport are // Make sure that tiles that fall outside of the critical displayport are
// discarded on the first update. // discarded on the first update.
mValidRegion.And(mValidRegion, mPaintData.mLayoutCriticalDisplayPort); mValidRegion.And(mValidRegion, mPaintData.mCriticalDisplayPort);
} }
} }
nsIntRegion lowPrecisionInvalidRegion; nsIntRegion lowPrecisionInvalidRegion;
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) { if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
if (gfxPrefs::UseLowPrecisionBuffer()) { if (gfxPrefs::UseLowPrecisionBuffer()) {
// Calculate the invalid region for the low precision buffer // Calculate the invalid region for the low precision buffer
lowPrecisionInvalidRegion.Sub(mVisibleRegion, mLowPrecisionValidRegion); lowPrecisionInvalidRegion.Sub(mVisibleRegion, mLowPrecisionValidRegion);
@ -232,7 +265,7 @@ ClientTiledThebesLayer::RenderLayer()
} }
// Clip the invalid region to the critical display-port // Clip the invalid region to the critical display-port
invalidRegion.And(invalidRegion, mPaintData.mLayoutCriticalDisplayPort); invalidRegion.And(invalidRegion, mPaintData.mCriticalDisplayPort);
if (invalidRegion.IsEmpty() && lowPrecisionInvalidRegion.IsEmpty()) { if (invalidRegion.IsEmpty() && lowPrecisionInvalidRegion.IsEmpty()) {
EndPaint(true); EndPaint(true);
return; return;
@ -250,8 +283,8 @@ ClientTiledThebesLayer::RenderLayer()
// used to decide stale content (currently valid and previously visible) // used to decide stale content (currently valid and previously visible)
nsIntRegion oldValidRegion = mContentClient->mTiledBuffer.GetValidRegion(); nsIntRegion oldValidRegion = mContentClient->mTiledBuffer.GetValidRegion();
oldValidRegion.And(oldValidRegion, mVisibleRegion); oldValidRegion.And(oldValidRegion, mVisibleRegion);
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) { if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
oldValidRegion.And(oldValidRegion, mPaintData.mLayoutCriticalDisplayPort); oldValidRegion.And(oldValidRegion, mPaintData.mCriticalDisplayPort);
} }
updatedBuffer = updatedBuffer =
@ -261,8 +294,8 @@ ClientTiledThebesLayer::RenderLayer()
} else { } else {
updatedBuffer = true; updatedBuffer = true;
mValidRegion = mVisibleRegion; mValidRegion = mVisibleRegion;
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) { if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
mValidRegion.And(mValidRegion, mPaintData.mLayoutCriticalDisplayPort); mValidRegion.And(mValidRegion, mPaintData.mCriticalDisplayPort);
} }
mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution); mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion, mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
@ -292,7 +325,7 @@ ClientTiledThebesLayer::RenderLayer()
// visible region is larger than the critical display port. // visible region is larger than the critical display port.
bool updatedLowPrecision = false; bool updatedLowPrecision = false;
if (!lowPrecisionInvalidRegion.IsEmpty() && if (!lowPrecisionInvalidRegion.IsEmpty() &&
!nsIntRegion(mPaintData.mLayoutCriticalDisplayPort).Contains(mVisibleRegion)) { !nsIntRegion(mPaintData.mCriticalDisplayPort).Contains(mVisibleRegion)) {
nsIntRegion oldValidRegion = nsIntRegion oldValidRegion =
mContentClient->mLowPrecisionTiledBuffer.GetValidRegion(); mContentClient->mLowPrecisionTiledBuffer.GetValidRegion();
oldValidRegion.And(oldValidRegion, mVisibleRegion); oldValidRegion.And(oldValidRegion, mVisibleRegion);

View File

@ -248,9 +248,6 @@ SimpleClientTiledThebesLayer::SimpleClientTiledThebesLayer(ClientLayerManager* a
, mContentClient() , mContentClient()
{ {
MOZ_COUNT_CTOR(SimpleClientTiledThebesLayer); MOZ_COUNT_CTOR(SimpleClientTiledThebesLayer);
mPaintData.mLastScrollOffset = ScreenPoint(0, 0);
mPaintData.mFirstPaint = true;
} }
SimpleClientTiledThebesLayer::~SimpleClientTiledThebesLayer() SimpleClientTiledThebesLayer::~SimpleClientTiledThebesLayer()
@ -264,102 +261,6 @@ SimpleClientTiledThebesLayer::FillSpecificAttributes(SpecificLayerAttributes& aA
aAttrs = ThebesLayerAttributes(GetValidRegion()); aAttrs = ThebesLayerAttributes(GetValidRegion());
} }
static LayoutDeviceRect
ApplyParentLayerToLayoutTransform(const gfx3DMatrix& aTransform, const ParentLayerRect& aParentLayerRect)
{
return TransformTo<LayoutDevicePixel>(aTransform, aParentLayerRect);
}
void
SimpleClientTiledThebesLayer::BeginPaint()
{
if (ClientManager()->IsRepeatTransaction()) {
return;
}
mPaintData.mLowPrecisionPaintCount = 0;
mPaintData.mPaintFinished = false;
// Get the metrics of the nearest scroll container.
ContainerLayer* scrollParent = nullptr;
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
const FrameMetrics& metrics = parent->GetFrameMetrics();
if (metrics.mScrollId != FrameMetrics::NULL_SCROLL_ID) {
scrollParent = parent;
break;
}
}
if (!scrollParent) {
// XXX I don't think this can happen, but if it does, warn and set the
// composition bounds to empty so that progressive updates are disabled.
NS_WARNING("Tiled Thebes layer with no scrollable container parent");
mPaintData.mCompositionBounds.SetEmpty();
return;
}
const FrameMetrics& metrics = scrollParent->GetFrameMetrics();
// Calculate the transform required to convert screen space into transformed
// layout device space.
gfx::Matrix4x4 effectiveTransform = GetEffectiveTransform();
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
if (parent->UseIntermediateSurface()) {
effectiveTransform = effectiveTransform * parent->GetEffectiveTransform();
}
}
gfx3DMatrix layoutToParentLayer;
gfx::To3DMatrix(effectiveTransform, layoutToParentLayer);
layoutToParentLayer.ScalePost(metrics.GetParentResolution().scale,
metrics.GetParentResolution().scale,
1.f);
mPaintData.mTransformParentLayerToLayout = layoutToParentLayer.Inverse();
// Compute the critical display port in layer space.
mPaintData.mLayoutCriticalDisplayPort.SetEmpty();
if (!metrics.mCriticalDisplayPort.IsEmpty()) {
// Convert the display port to screen space first so that we can transform
// it into layout device space.
const ParentLayerRect& criticalDisplayPort = metrics.mCriticalDisplayPort
* metrics.mDevPixelsPerCSSPixel
* metrics.GetParentResolution();
LayoutDeviceRect transformedCriticalDisplayPort =
ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayout, criticalDisplayPort);
mPaintData.mLayoutCriticalDisplayPort =
LayoutDeviceIntRect::ToUntyped(RoundedOut(transformedCriticalDisplayPort));
}
// Calculate the frame resolution. Because this is Gecko-side, before any
// async transforms have occurred, we can use mZoom for this.
mPaintData.mResolution = metrics.GetZoom();
// Calculate the scroll offset since the last transaction, and the
// composition bounds.
mPaintData.mCompositionBounds.SetEmpty();
mPaintData.mScrollOffset.MoveTo(0, 0);
Layer* primaryScrollable = ClientManager()->GetPrimaryScrollableLayer();
if (primaryScrollable) {
const FrameMetrics& metrics = primaryScrollable->AsContainerLayer()->GetFrameMetrics();
mPaintData.mScrollOffset = metrics.GetScrollOffset() * metrics.GetZoom();
mPaintData.mCompositionBounds =
ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayout,
ParentLayerRect(metrics.mCompositionBounds));
}
}
void
SimpleClientTiledThebesLayer::EndPaint(bool aFinish)
{
if (!aFinish && !mPaintData.mPaintFinished) {
return;
}
mPaintData.mLastScrollOffset = mPaintData.mScrollOffset;
mPaintData.mPaintFinished = true;
mPaintData.mFirstPaint = false;
}
void void
SimpleClientTiledThebesLayer::RenderLayer() SimpleClientTiledThebesLayer::RenderLayer()
{ {
@ -388,83 +289,29 @@ SimpleClientTiledThebesLayer::RenderLayer()
nsIntRegion invalidRegion = mVisibleRegion; nsIntRegion invalidRegion = mVisibleRegion;
invalidRegion.Sub(invalidRegion, mValidRegion); invalidRegion.Sub(invalidRegion, mValidRegion);
if (invalidRegion.IsEmpty()) { if (invalidRegion.IsEmpty()) {
EndPaint(true);
return; return;
} }
const FrameMetrics& parentMetrics = GetParent()->GetFrameMetrics();
nsIntRegion wantToPaintRegion = mVisibleRegion;
// Only paint the mask layer on the first transaction. // Only paint the mask layer on the first transaction.
if (GetMaskLayer() && !ClientManager()->IsRepeatTransaction()) { if (GetMaskLayer() && !ClientManager()->IsRepeatTransaction()) {
ToClientLayer(GetMaskLayer())->RenderLayer(); ToClientLayer(GetMaskLayer())->RenderLayer();
} }
// Fast path for no progressive updates, no low-precision updates and no // SimpleTiledContentClient doesn't support progressive updates or the low
// critical display-port set, or no display-port set. // precision buffer yet.
if (parentMetrics.mCriticalDisplayPort.IsEmpty() || MOZ_ASSERT(!gfxPrefs::UseProgressiveTilePainting() &&
parentMetrics.mDisplayPort.IsEmpty()) !gfxPrefs::UseLowPrecisionBuffer());
{
mValidRegion = wantToPaintRegion;
NS_ASSERTION(!ClientManager()->IsRepeatTransaction(), "Didn't paint our mask layer"); mValidRegion = mVisibleRegion;
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion, NS_ASSERTION(!ClientManager()->IsRepeatTransaction(), "Didn't paint our mask layer");
callback, data);
ClientManager()->Hold(this); mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
callback, data);
mContentClient->UseTiledLayerBuffer(); ClientManager()->Hold(this);
return; mContentClient->UseTiledLayerBuffer();
}
// Calculate everything we need to perform the paint.
BeginPaint();
if (mPaintData.mPaintFinished) {
return;
}
// Make sure that tiles that fall outside of the visible region are
// discarded on the first update.
if (!ClientManager()->IsRepeatTransaction()) {
mValidRegion.And(mValidRegion, wantToPaintRegion);
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
// Make sure that tiles that fall outside of the critical displayport are
// discarded on the first update.
mValidRegion.And(mValidRegion, mPaintData.mLayoutCriticalDisplayPort);
}
}
nsIntRegion lowPrecisionInvalidRegion;
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
// Clip the invalid region to the critical display-port
invalidRegion.And(invalidRegion, mPaintData.mLayoutCriticalDisplayPort);
if (invalidRegion.IsEmpty() && lowPrecisionInvalidRegion.IsEmpty()) {
EndPaint(true);
return;
}
}
if (!invalidRegion.IsEmpty()) {
mValidRegion = wantToPaintRegion;
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
mValidRegion.And(mValidRegion, mPaintData.mLayoutCriticalDisplayPort);
}
mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
callback, data);
ClientManager()->Hold(this);
mContentClient->UseTiledLayerBuffer();
EndPaint(false);
return;
}
EndPaint(false);
} }

View File

@ -106,8 +106,8 @@ public:
} }
} }
const CSSToScreenScale& GetFrameResolution() const { return mFrameResolution; } const CSSToParentLayerScale& GetFrameResolution() const { return mFrameResolution; }
void SetFrameResolution(const CSSToScreenScale& aResolution) { mFrameResolution = aResolution; } void SetFrameResolution(const CSSToParentLayerScale& aResolution) { mFrameResolution = aResolution; }
bool HasFormatChanged() const; bool HasFormatChanged() const;
private: private:
@ -116,7 +116,7 @@ private:
ClientLayerManager* mManager; ClientLayerManager* mManager;
LayerManager::DrawThebesLayerCallback mCallback; LayerManager::DrawThebesLayerCallback mCallback;
void* mCallbackData; void* mCallbackData;
CSSToScreenScale mFrameResolution; CSSToParentLayerScale mFrameResolution;
bool mLastPaintOpaque; bool mLastPaintOpaque;
gfxContentType GetContentType() const; gfxContentType GetContentType() const;
@ -180,11 +180,7 @@ public:
protected: protected:
ClientLayerManager* ClientManager() { return static_cast<ClientLayerManager*>(mManager); } ClientLayerManager* ClientManager() { return static_cast<ClientLayerManager*>(mManager); }
void BeginPaint();
void EndPaint(bool aFinish);
RefPtr<SimpleTiledContentClient> mContentClient; RefPtr<SimpleTiledContentClient> mContentClient;
BasicTiledLayerPaintData mPaintData;
}; };
} // mozilla } // mozilla

View File

@ -156,7 +156,7 @@ SharedFrameMetricsHelper::UpdateFromCompositorFrameMetrics(
const FrameMetrics& contentMetrics = aLayer->GetFrameMetrics(); const FrameMetrics& contentMetrics = aLayer->GetFrameMetrics();
FrameMetrics compositorMetrics; FrameMetrics compositorMetrics;
if (!compositor->LookupCompositorFrameMetrics(contentMetrics.mScrollId, if (!compositor->LookupCompositorFrameMetrics(contentMetrics.GetScrollId(),
compositorMetrics)) { compositorMetrics)) {
FindFallbackContentFrameMetrics(aLayer, aCompositionBounds, aZoom); FindFallbackContentFrameMetrics(aLayer, aCompositionBounds, aZoom);
return false; return false;
@ -861,18 +861,18 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
static LayoutDeviceRect static LayoutDeviceRect
TransformCompositionBounds(const ParentLayerRect& aCompositionBounds, TransformCompositionBounds(const ParentLayerRect& aCompositionBounds,
const CSSToParentLayerScale& aZoom, const CSSToParentLayerScale& aZoom,
const ScreenPoint& aScrollOffset, const ParentLayerPoint& aScrollOffset,
const CSSToScreenScale& aResolution, const CSSToParentLayerScale& aResolution,
const gfx3DMatrix& aTransformScreenToLayout) const gfx3DMatrix& aTransformParentLayerToLayoutDevice)
{ {
// Transform the current composition bounds into transformed layout device // Transform the current composition bounds into ParentLayer coordinates
// space by compensating for the difference in resolution and subtracting the // by compensating for the difference in resolution and subtracting the
// old composition bounds origin. // old composition bounds origin.
ScreenRect offsetViewportRect = (aCompositionBounds / aZoom) * aResolution; ParentLayerRect offsetViewportRect = (aCompositionBounds / aZoom) * aResolution;
offsetViewportRect.MoveBy(-aScrollOffset); offsetViewportRect.MoveBy(-aScrollOffset);
gfxRect transformedViewport = gfxRect transformedViewport =
aTransformScreenToLayout.TransformBounds( aTransformParentLayerToLayoutDevice.TransformBounds(
gfxRect(offsetViewportRect.x, offsetViewportRect.y, gfxRect(offsetViewportRect.x, offsetViewportRect.y,
offsetViewportRect.width, offsetViewportRect.height)); offsetViewportRect.width, offsetViewportRect.height));
@ -884,10 +884,10 @@ TransformCompositionBounds(const ParentLayerRect& aCompositionBounds,
bool bool
ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInvalidRegion, ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInvalidRegion,
const nsIntRegion& aOldValidRegion, const nsIntRegion& aOldValidRegion,
nsIntRegion& aRegionToPaint, nsIntRegion& aRegionToPaint,
BasicTiledLayerPaintData* aPaintData, BasicTiledLayerPaintData* aPaintData,
bool aIsRepeated) bool aIsRepeated)
{ {
aRegionToPaint = aInvalidRegion; aRegionToPaint = aInvalidRegion;
@ -942,20 +942,27 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
} }
} }
// Transform the screen coordinates into transformed layout device coordinates. // Transform the composition bounds, which is in the ParentLayer coordinates
// of the nearest ContainerLayer with a valid displayport to LayoutDevice
// coordinates relative to this layer.
LayoutDeviceRect transformedCompositionBounds = LayoutDeviceRect transformedCompositionBounds =
TransformCompositionBounds(compositionBounds, zoom, aPaintData->mScrollOffset, TransformCompositionBounds(compositionBounds, zoom, aPaintData->mScrollOffset,
aPaintData->mResolution, aPaintData->mTransformParentLayerToLayout); aPaintData->mResolution, aPaintData->mTransformParentLayerToLayoutDevice);
// Paint tiles that have stale content or that intersected with the screen // Paint tiles that have stale content or that intersected with the screen
// at the time of issuing the draw command in a single transaction first. // at the time of issuing the draw command in a single transaction first.
// This is to avoid rendering glitches on animated page content, and when // This is to avoid rendering glitches on animated page content, and when
// layers change size/shape. // layers change size/shape.
LayoutDeviceRect coherentUpdateRect = LayoutDeviceRect typedCoherentUpdateRect =
transformedCompositionBounds.Intersect(aPaintData->mCompositionBounds); transformedCompositionBounds.Intersect(aPaintData->mCompositionBounds);
// Offset by the viewport origin, as the composition bounds are stored in
// Layer space and not LayoutDevice space.
typedCoherentUpdateRect.MoveBy(aPaintData->mViewport.TopLeft());
// Convert to untyped to intersect with the invalid region.
nsIntRect roundedCoherentUpdateRect = nsIntRect roundedCoherentUpdateRect =
LayoutDeviceIntRect::ToUntyped(RoundedOut(coherentUpdateRect)); LayoutDeviceIntRect::ToUntyped(RoundedOut(typedCoherentUpdateRect));
aRegionToPaint.And(aInvalidRegion, roundedCoherentUpdateRect); aRegionToPaint.And(aInvalidRegion, roundedCoherentUpdateRect);
aRegionToPaint.Or(aRegionToPaint, staleRegion); aRegionToPaint.Or(aRegionToPaint, staleRegion);

View File

@ -244,41 +244,46 @@ struct BasicTiledLayerPaintData {
* The scroll offset of the content from the nearest ancestor layer that * The scroll offset of the content from the nearest ancestor layer that
* represents scrollable content with a display port set. * represents scrollable content with a display port set.
*/ */
ScreenPoint mScrollOffset; ParentLayerPoint mScrollOffset;
/* /*
* The scroll offset of the content from the nearest ancestor layer that * The scroll offset of the content from the nearest ancestor layer that
* represents scrollable content with a display port set, for the last * represents scrollable content with a display port set, for the last
* layer update transaction. * layer update transaction.
*/ */
ScreenPoint mLastScrollOffset; ParentLayerPoint mLastScrollOffset;
/* /*
* The transform matrix to go from ParentLayer units to transformed * The transform matrix to go from Screen units to ParentLayer units.
* LayoutDevice units.
*/ */
gfx3DMatrix mTransformParentLayerToLayout; gfx3DMatrix mTransformParentLayerToLayoutDevice;
/* /*
* The critical displayport of the content from the nearest ancestor layer * The critical displayport of the content from the nearest ancestor layer
* that represents scrollable content with a display port set. Empty if a * that represents scrollable content with a display port set. Empty if a
* critical displayport is not set. * critical displayport is not set.
* *
* This is in transformed LayoutDevice coordinates, but is stored as an * This is in LayoutDevice coordinates, but is stored as an nsIntRect for
* nsIntRect for convenience when intersecting with the layer's mValidRegion. * convenience when intersecting with the layer's mValidRegion.
*/ */
nsIntRect mLayoutCriticalDisplayPort; nsIntRect mCriticalDisplayPort;
/*
* The viewport of the content from the nearest ancestor layer that
* represents scrollable content with a display port set.
*/
LayoutDeviceRect mViewport;
/* /*
* The render resolution of the document that the content this layer * The render resolution of the document that the content this layer
* represents is in. * represents is in.
*/ */
CSSToScreenScale mResolution; CSSToParentLayerScale mResolution;
/* /*
* The composition bounds of the primary scrollable layer, in transformed * The composition bounds of the layer, in LayoutDevice coordinates. This is
* layout device coordinates. This is used to make sure that tiled updates to * used to make sure that tiled updates to regions that are visible to the
* regions that are visible to the user are grouped coherently. * user are grouped coherently.
*/ */
LayoutDeviceRect mCompositionBounds; LayoutDeviceRect mCompositionBounds;
@ -381,9 +386,9 @@ public:
void DiscardBackBuffers(); void DiscardBackBuffers();
const CSSToScreenScale& GetFrameResolution() { return mFrameResolution; } const CSSToParentLayerScale& GetFrameResolution() { return mFrameResolution; }
void SetFrameResolution(const CSSToScreenScale& aResolution) { mFrameResolution = aResolution; } void SetFrameResolution(const CSSToParentLayerScale& aResolution) { mFrameResolution = aResolution; }
bool HasFormatChanged() const; bool HasFormatChanged() const;
@ -424,7 +429,7 @@ private:
ClientLayerManager* mManager; ClientLayerManager* mManager;
LayerManager::DrawThebesLayerCallback mCallback; LayerManager::DrawThebesLayerCallback mCallback;
void* mCallbackData; void* mCallbackData;
CSSToScreenScale mFrameResolution; CSSToParentLayerScale mFrameResolution;
bool mLastPaintOpaque; bool mLastPaintOpaque;
// The DrawTarget we use when UseSinglePaintBuffer() above is true. // The DrawTarget we use when UseSinglePaintBuffer() above is true.

View File

@ -211,7 +211,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
apzc->SetPrevSibling(nullptr); apzc->SetPrevSibling(nullptr);
apzc->SetLastChild(nullptr); apzc->SetLastChild(nullptr);
} }
APZC_LOG("Using APZC %p for layer %p with identifiers %lld %lld\n", apzc, aLayer, aLayersId, container->GetFrameMetrics().mScrollId); APZC_LOG("Using APZC %p for layer %p with identifiers %lld %lld\n", apzc, aLayer, aLayersId, container->GetFrameMetrics().GetScrollId());
apzc->NotifyLayersUpdated(metrics, apzc->NotifyLayersUpdated(metrics,
aIsFirstPaint && (aLayersId == aFirstPaintLayersId)); aIsFirstPaint && (aLayersId == aFirstPaintLayersId));

View File

@ -244,7 +244,7 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer,
bool isStickyForSubtree = aLayer->GetIsStickyPosition() && bool isStickyForSubtree = aLayer->GetIsStickyPosition() &&
aTransformedSubtreeRoot->AsContainerLayer() && aTransformedSubtreeRoot->AsContainerLayer() &&
aLayer->GetStickyScrollContainerId() == aLayer->GetStickyScrollContainerId() ==
aTransformedSubtreeRoot->AsContainerLayer()->GetFrameMetrics().mScrollId; aTransformedSubtreeRoot->AsContainerLayer()->GetFrameMetrics().GetScrollId();
if (aLayer != aTransformedSubtreeRoot && (isRootFixed || isStickyForSubtree)) { if (aLayer != aTransformedSubtreeRoot && (isRootFixed || isStickyForSubtree)) {
// Insert a translation so that the position of the anchor point is the same // Insert a translation so that the position of the anchor point is the same
// before and after the change to the transform of aTransformedSubtreeRoot. // before and after the change to the transform of aTransformedSubtreeRoot.
@ -606,7 +606,7 @@ AsyncCompositionManager::ApplyAsyncTransformToScrollbar(ContainerLayer* aLayer)
continue; continue;
} }
const FrameMetrics& metrics = scrollTarget->AsContainerLayer()->GetFrameMetrics(); const FrameMetrics& metrics = scrollTarget->AsContainerLayer()->GetFrameMetrics();
if (metrics.mScrollId != aLayer->GetScrollbarTargetContainerId()) { if (metrics.GetScrollId() != aLayer->GetScrollbarTargetContainerId()) {
continue; continue;
} }
if (!LayerHasNonContainerDescendants(scrollTarget->AsContainerLayer())) { if (!LayerHasNonContainerDescendants(scrollTarget->AsContainerLayer())) {

View File

@ -182,7 +182,7 @@ ThebesLayerComposite::GetEffectiveResolution()
{ {
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) { for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
const FrameMetrics& metrics = parent->GetFrameMetrics(); const FrameMetrics& metrics = parent->GetFrameMetrics();
if (metrics.mScrollId != FrameMetrics::NULL_SCROLL_ID) { if (metrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID) {
return metrics.GetZoom(); return metrics.GetZoom();
} }
} }

View File

@ -42,7 +42,7 @@ TiledLayerBufferComposite::TiledLayerBufferComposite(ISurfaceAllocator* aAllocat
mRetainedWidth = aDescriptor.retainedWidth(); mRetainedWidth = aDescriptor.retainedWidth();
mRetainedHeight = aDescriptor.retainedHeight(); mRetainedHeight = aDescriptor.retainedHeight();
mResolution = aDescriptor.resolution(); mResolution = aDescriptor.resolution();
mFrameResolution = CSSToScreenScale(aDescriptor.frameResolution()); mFrameResolution = CSSToParentLayerScale(aDescriptor.frameResolution());
// Combine any valid content that wasn't already uploaded // Combine any valid content that wasn't already uploaded
nsIntRegion oldPaintedRegion(aOldPaintedRegion); nsIntRegion oldPaintedRegion(aOldPaintedRegion);
@ -379,8 +379,8 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
// We assume that the current frame resolution is the one used in our primary // We assume that the current frame resolution is the one used in our primary
// layer buffer. Compensate for a changing frame resolution. // layer buffer. Compensate for a changing frame resolution.
if (aLayerBuffer.GetFrameResolution() != mTiledBuffer.GetFrameResolution()) { if (aLayerBuffer.GetFrameResolution() != mTiledBuffer.GetFrameResolution()) {
const CSSToScreenScale& layerResolution = aLayerBuffer.GetFrameResolution(); const CSSToParentLayerScale& layerResolution = aLayerBuffer.GetFrameResolution();
const CSSToScreenScale& localResolution = mTiledBuffer.GetFrameResolution(); const CSSToParentLayerScale& localResolution = mTiledBuffer.GetFrameResolution();
layerScale.width = layerScale.height = layerResolution.scale / localResolution.scale; layerScale.width = layerScale.height = layerResolution.scale / localResolution.scale;
aVisibleRect.ScaleRoundOut(layerScale.width, layerScale.height); aVisibleRect.ScaleRoundOut(layerScale.width, layerScale.height);
} }

View File

@ -114,7 +114,7 @@ public:
// Stores the absolute resolution of the containing frame, calculated // Stores the absolute resolution of the containing frame, calculated
// by the sum of the resolutions of all parent layers' FrameMetrics. // by the sum of the resolutions of all parent layers' FrameMetrics.
const CSSToScreenScale& GetFrameResolution() { return mFrameResolution; } const CSSToParentLayerScale& GetFrameResolution() { return mFrameResolution; }
void ReadUnlock(); void ReadUnlock();
@ -144,7 +144,7 @@ protected:
void SwapTiles(TileHost& aTileA, TileHost& aTileB) { std::swap(aTileA, aTileB); } void SwapTiles(TileHost& aTileA, TileHost& aTileB) { std::swap(aTileA, aTileB); }
private: private:
CSSToScreenScale mFrameResolution; CSSToParentLayerScale mFrameResolution;
bool mHasDoubleBufferedTiles; bool mHasDoubleBufferedTiles;
bool mUninitialized; bool mUninitialized;
}; };

View File

@ -69,7 +69,7 @@
" i=(%ld %lld) cb=(%d %d %d %d) dp=(%.3f %.3f %.3f %.3f) v=(%.3f %.3f %.3f %.3f) " \ " i=(%ld %lld) cb=(%d %d %d %d) dp=(%.3f %.3f %.3f %.3f) v=(%.3f %.3f %.3f %.3f) " \
"s=(%.3f %.3f) sr=(%.3f %.3f %.3f %.3f) z=(%.3f %.3f %.3f %.3f) u=(%d %llu)\n", \ "s=(%.3f %.3f) sr=(%.3f %.3f %.3f %.3f) z=(%.3f %.3f %.3f %.3f) u=(%d %llu)\n", \
__VA_ARGS__, \ __VA_ARGS__, \
fm.mPresShellId, fm.mScrollId, \ fm.mPresShellId, fm.GetScrollId(), \
fm.mCompositionBounds.x, fm.mCompositionBounds.y, fm.mCompositionBounds.width, fm.mCompositionBounds.height, \ fm.mCompositionBounds.x, fm.mCompositionBounds.y, fm.mCompositionBounds.width, fm.mCompositionBounds.height, \
fm.mDisplayPort.x, fm.mDisplayPort.y, fm.mDisplayPort.width, fm.mDisplayPort.height, \ fm.mDisplayPort.x, fm.mDisplayPort.y, fm.mDisplayPort.width, fm.mDisplayPort.height, \
fm.mViewport.x, fm.mViewport.y, fm.mViewport.width, fm.mViewport.height, \ fm.mViewport.x, fm.mViewport.y, fm.mViewport.width, fm.mViewport.height, \
@ -325,7 +325,7 @@ static inline void LogRendertraceRect(const ScrollableLayerGuid& aGuid, const ch
static const TimeStamp sRenderStart = TimeStamp::Now(); static const TimeStamp sRenderStart = TimeStamp::Now();
TimeDuration delta = TimeStamp::Now() - sRenderStart; TimeDuration delta = TimeStamp::Now() - sRenderStart;
printf_stderr("(%llu,%lu,%llu)%s RENDERTRACE %f rect %s %f %f %f %f\n", printf_stderr("(%llu,%lu,%llu)%s RENDERTRACE %f rect %s %f %f %f %f\n",
aGuid.mLayersId, aGuid.mPresShellId, aGuid.mScrollId, aGuid.mLayersId, aGuid.mPresShellId, aGuid.GetScrollId(),
aDesc, delta.ToMilliseconds(), aColor, aDesc, delta.ToMilliseconds(), aColor,
aRect.x, aRect.y, aRect.width, aRect.height); aRect.x, aRect.y, aRect.width, aRect.height);
#endif #endif
@ -480,7 +480,7 @@ AsyncPanZoomController::~AsyncPanZoomController() {
// Only send the release message if the SharedFrameMetrics has been created. // Only send the release message if the SharedFrameMetrics has been created.
if (compositor && mSharedFrameMetricsBuffer) { if (compositor && mSharedFrameMetricsBuffer) {
unused << compositor->SendReleaseSharedCompositorFrameMetrics(mFrameMetrics.mScrollId, mAPZCId); unused << compositor->SendReleaseSharedCompositorFrameMetrics(mFrameMetrics.GetScrollId(), mAPZCId);
} }
delete mSharedFrameMetricsBuffer; delete mSharedFrameMetricsBuffer;
@ -1778,7 +1778,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
// more "legitimate" sources like content scripts. // more "legitimate" sources like content scripts.
nsRefPtr<GeckoContentController> controller = GetGeckoContentController(); nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) { if (controller) {
controller->AcknowledgeScrollUpdate(aLayerMetrics.mScrollId, controller->AcknowledgeScrollUpdate(aLayerMetrics.GetScrollId(),
aLayerMetrics.GetScrollGeneration()); aLayerMetrics.GetScrollGeneration());
} }
} }
@ -1989,10 +1989,10 @@ void AsyncPanZoomController::SetState(PanZoomState aNewState) {
if (mGeckoContentController) { if (mGeckoContentController) {
if (!IsTransformingState(oldState) && IsTransformingState(aNewState)) { if (!IsTransformingState(oldState) && IsTransformingState(aNewState)) {
mGeckoContentController->NotifyTransformBegin( mGeckoContentController->NotifyTransformBegin(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.mScrollId)); ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.GetScrollId()));
} else if (IsTransformingState(oldState) && !IsTransformingState(aNewState)) { } else if (IsTransformingState(oldState) && !IsTransformingState(aNewState)) {
mGeckoContentController->NotifyTransformEnd( mGeckoContentController->NotifyTransformEnd(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.mScrollId)); ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.GetScrollId()));
} }
} }
} }

View File

@ -211,7 +211,7 @@ CompositorChild::SharedFrameMetricsData::GetViewID()
MOZ_ASSERT(frame); MOZ_ASSERT(frame);
// Not locking to read of mScrollId since it should not change after being // Not locking to read of mScrollId since it should not change after being
// initially set. // initially set.
return frame->mScrollId; return frame->GetScrollId();
} }
uint32_t uint32_t

View File

@ -366,34 +366,6 @@ CompositorParent::RecvStopFrameTimeRecording(const uint32_t& aStartIndex,
return true; return true;
} }
bool
CompositorParent::RecvSetTestSampleTime(const TimeStamp& aTime)
{
if (aTime.IsNull()) {
return false;
}
mIsTesting = true;
mTestTime = aTime;
// Update but only if we were already scheduled to animate
if (mCompositionManager && mCurrentCompositeTask) {
bool requestNextFrame = mCompositionManager->TransformShadowTree(aTime);
if (!requestNextFrame) {
CancelCurrentCompositeTask();
}
}
return true;
}
bool
CompositorParent::RecvLeaveTestMode()
{
mIsTesting = false;
return true;
}
void void
CompositorParent::ActorDestroy(ActorDestroyReason why) CompositorParent::ActorDestroy(ActorDestroyReason why)
{ {
@ -789,6 +761,7 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
// scheduled in order to better match the behavior under regular sampling // scheduled in order to better match the behavior under regular sampling
// conditions. // conditions.
if (mIsTesting && root && mCurrentCompositeTask) { if (mIsTesting && root && mCurrentCompositeTask) {
AutoResolveRefLayers resolve(mCompositionManager);
bool requestNextFrame = bool requestNextFrame =
mCompositionManager->TransformShadowTree(mTestTime); mCompositionManager->TransformShadowTree(mTestTime);
if (!requestNextFrame) { if (!requestNextFrame) {
@ -805,6 +778,35 @@ CompositorParent::ForceComposite(LayerTransactionParent* aLayerTree)
ScheduleComposition(); ScheduleComposition();
} }
bool
CompositorParent::SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime)
{
if (aTime.IsNull()) {
return false;
}
mIsTesting = true;
mTestTime = aTime;
// Update but only if we were already scheduled to animate
if (mCompositionManager && mCurrentCompositeTask) {
AutoResolveRefLayers resolve(mCompositionManager);
bool requestNextFrame = mCompositionManager->TransformShadowTree(aTime);
if (!requestNextFrame) {
CancelCurrentCompositeTask();
}
}
return true;
}
void
CompositorParent::LeaveTestMode(LayerTransactionParent* aLayerTree)
{
mIsTesting = false;
}
void void
CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints) CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints)
{ {
@ -1067,8 +1069,6 @@ public:
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) { return true; } virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) { return true; }
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE { return true; } virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE { return true; }
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE { return true; } virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE { return true; }
virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE { return true; }
virtual bool RecvLeaveTestMode() MOZ_OVERRIDE { return true; }
virtual PLayerTransactionParent* virtual PLayerTransactionParent*
AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aBackendHints, AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aBackendHints,
@ -1083,6 +1083,9 @@ public:
bool aIsFirstPaint, bool aIsFirstPaint,
bool aScheduleComposite) MOZ_OVERRIDE; bool aScheduleComposite) MOZ_OVERRIDE;
virtual void ForceComposite(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE; virtual void ForceComposite(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime) MOZ_OVERRIDE;
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aParent) MOZ_OVERRIDE; virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aParent) MOZ_OVERRIDE;
@ -1243,6 +1246,23 @@ CrossProcessCompositorParent::ForceComposite(LayerTransactionParent* aLayerTree)
sIndirectLayerTrees[id].mParent->ForceComposite(aLayerTree); sIndirectLayerTrees[id].mParent->ForceComposite(aLayerTree);
} }
bool
CrossProcessCompositorParent::SetTestSampleTime(
LayerTransactionParent* aLayerTree, const TimeStamp& aTime)
{
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
return sIndirectLayerTrees[id].mParent->SetTestSampleTime(aLayerTree, aTime);
}
void
CrossProcessCompositorParent::LeaveTestMode(LayerTransactionParent* aLayerTree)
{
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
sIndirectLayerTrees[id].mParent->LeaveTestMode(aLayerTree);
}
AsyncCompositionManager* AsyncCompositionManager*
CrossProcessCompositorParent::GetCompositionManager(LayerTransactionParent* aLayerTree) CrossProcessCompositorParent::GetCompositionManager(LayerTransactionParent* aLayerTree)
{ {
@ -1253,8 +1273,12 @@ CrossProcessCompositorParent::GetCompositionManager(LayerTransactionParent* aLay
void void
CrossProcessCompositorParent::DeferredDestroy() CrossProcessCompositorParent::DeferredDestroy()
{ {
mSelfRef = nullptr; CrossProcessCompositorParent* self;
// |this| was just destroyed, hands off mSelfRef.forget(&self);
nsCOMPtr<nsIRunnable> runnable =
NS_NewNonOwningRunnableMethod(self, &CrossProcessCompositorParent::Release);
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
} }
CrossProcessCompositorParent::~CrossProcessCompositorParent() CrossProcessCompositorParent::~CrossProcessCompositorParent()

View File

@ -92,8 +92,6 @@ public:
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) MOZ_OVERRIDE; virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) MOZ_OVERRIDE;
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE; virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE;
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE; virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE;
virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE;
virtual bool RecvLeaveTestMode() MOZ_OVERRIDE;
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
@ -102,7 +100,11 @@ public:
bool aIsFirstPaint, bool aIsFirstPaint,
bool aScheduleComposite) MOZ_OVERRIDE; bool aScheduleComposite) MOZ_OVERRIDE;
virtual void ForceComposite(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE; virtual void ForceComposite(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime) MOZ_OVERRIDE;
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE { return mCompositionManager; } virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE { return mCompositionManager; }
/** /**
* This forces the is-first-paint flag to true. This is intended to * This forces the is-first-paint flag to true. This is intended to
* be called by the widget code when it loses its viewport information * be called by the widget code when it loses its viewport information

View File

@ -1,3 +1,4 @@
/* vim: set ts=2 sw=2 et tw=80: */
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public * 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 * License, v. 2.0. If a copy of the MPL was not distributed with this
@ -31,6 +32,7 @@
#include "nsTArrayForwardDeclare.h" // for InfallibleTArray #include "nsTArrayForwardDeclare.h" // for InfallibleTArray
#include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop #include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop
#include "mozilla/layers/TextureHost.h" #include "mozilla/layers/TextureHost.h"
#include "nsThreadUtils.h"
using namespace base; using namespace base;
using namespace mozilla::ipc; using namespace mozilla::ipc;
@ -218,11 +220,32 @@ MessageLoop * ImageBridgeParent::GetMessageLoop() {
return mMessageLoop; return mMessageLoop;
} }
class ReleaseRunnable : public nsRunnable
{
public:
ReleaseRunnable(ImageBridgeParent* aRef)
: mRef(aRef)
{
}
NS_IMETHOD Run()
{
mRef->Release();
return NS_OK;
}
private:
ImageBridgeParent* mRef;
};
void void
ImageBridgeParent::DeferredDestroy() ImageBridgeParent::DeferredDestroy()
{ {
mSelfRef = nullptr; ImageBridgeParent* self;
// |this| was just destroyed, hands off mSelfRef.forget(&self);
nsCOMPtr<nsIRunnable> runnable = new ReleaseRunnable(self);
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
} }
IToplevelProtocol* IToplevelProtocol*

View File

@ -559,6 +559,19 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
return true; return true;
} }
bool
LayerTransactionParent::RecvSetTestSampleTime(const TimeStamp& aTime)
{
return mShadowLayersManager->SetTestSampleTime(this, aTime);
}
bool
LayerTransactionParent::RecvLeaveTestMode()
{
mShadowLayersManager->LeaveTestMode(this);
return true;
}
bool bool
LayerTransactionParent::RecvGetOpacity(PLayerParent* aParent, LayerTransactionParent::RecvGetOpacity(PLayerParent* aParent,
float* aOpacity) float* aOpacity)

View File

@ -93,6 +93,8 @@ protected:
virtual bool RecvClearCachedResources() MOZ_OVERRIDE; virtual bool RecvClearCachedResources() MOZ_OVERRIDE;
virtual bool RecvForceComposite() MOZ_OVERRIDE; virtual bool RecvForceComposite() MOZ_OVERRIDE;
virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE;
virtual bool RecvLeaveTestMode() MOZ_OVERRIDE;
virtual bool RecvGetOpacity(PLayerParent* aParent, virtual bool RecvGetOpacity(PLayerParent* aParent,
float* aOpacity) MOZ_OVERRIDE; float* aOpacity) MOZ_OVERRIDE;
virtual bool RecvGetAnimationTransform(PLayerParent* aParent, virtual bool RecvGetAnimationTransform(PLayerParent* aParent,

View File

@ -75,12 +75,6 @@ parent:
sync StopFrameTimeRecording(uint32_t startIndex) sync StopFrameTimeRecording(uint32_t startIndex)
returns (float[] intervals); returns (float[] intervals);
// Enter test mode, set the sample time to sampleTime, and resample animations.
// sampleTime must not be null.
sync SetTestSampleTime(TimeStamp sampleTime);
// Leave test mode and resume normal compositing
sync LeaveTestMode();
// layersBackendHints is an ordered list of preffered backends where // layersBackendHints is an ordered list of preffered backends where
// layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE // layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE
// that hint is ignored. // that hint is ignored.

View File

@ -82,6 +82,13 @@ parent:
returns (EditReply[] reply); returns (EditReply[] reply);
// Testing APIs // Testing APIs
// Enter test mode, set the sample time to sampleTime, and resample
// animations. sampleTime must not be null.
sync SetTestSampleTime(TimeStamp sampleTime);
// Leave test mode and resume normal compositing
sync LeaveTestMode();
sync GetOpacity(PLayer layer) returns (float opacity); sync GetOpacity(PLayer layer) returns (float opacity);
// Returns the value of the transform applied to the layer by animation after // Returns the value of the transform applied to the layer by animation after

View File

@ -25,6 +25,9 @@ public:
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) { return nullptr; } virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) { return nullptr; }
virtual void ForceComposite(LayerTransactionParent* aLayerTree) { } virtual void ForceComposite(LayerTransactionParent* aLayerTree) { }
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime) { return true; }
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) { }
}; };
} // layers } // layers

View File

@ -62,6 +62,17 @@ DeprecatedSharedPlanarYCbCrImage::~DeprecatedSharedPlanarYCbCrImage() {
} }
} }
size_t
SharedPlanarYCbCrImage::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
// NB: Explicitly skipping mTextureClient, the memory is already reported
// at time of allocation in GfxMemoryImageReporter.
// Not owned:
// - mCompositable
size_t size = PlanarYCbCrImage::SizeOfExcludingThis(aMallocSizeOf);
return size;
}
TextureClient* TextureClient*
SharedPlanarYCbCrImage::GetTextureClient(CompositableClient* aClient) SharedPlanarYCbCrImage::GetTextureClient(CompositableClient* aClient)
{ {

View File

@ -113,6 +113,13 @@ public:
virtual bool IsValid() MOZ_OVERRIDE; virtual bool IsValid() MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE
{
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
private: private:
RefPtr<BufferTextureClient> mTextureClient; RefPtr<BufferTextureClient> mTextureClient;
RefPtr<ImageClient> mCompositable; RefPtr<ImageClient> mCompositable;

View File

@ -71,7 +71,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):
if (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android') or \ if (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android') or \
(CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa') or \ (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa') or \
(CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk') or \ (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk') or \
CONFIG['MOZ_WIDGET_QT'] or \ (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt') or \
CONFIG['MOZ_WIDGET_GTK']: CONFIG['MOZ_WIDGET_GTK']:
DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1 DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1
@ -321,7 +321,7 @@ def write_mozbuild(includes, sources):
f.write("if CONFIG['MOZ_WIDGET_GTK']:\n") f.write("if CONFIG['MOZ_WIDGET_GTK']:\n")
write_list(f, 'SOURCES', sources['linux'], 4) write_list(f, 'SOURCES', sources['linux'], 4)
f.write("if CONFIG['MOZ_WIDGET_QT']:\n") f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':\n")
write_list(f, 'SOURCES', sources['linux'], 4) write_list(f, 'SOURCES', sources['linux'], 4)
f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':\n") f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':\n")

View File

@ -729,7 +729,7 @@ if CONFIG['MOZ_WIDGET_GTK']:
'trunk/src/ports/SkTLS_pthread.cpp', 'trunk/src/ports/SkTLS_pthread.cpp',
'trunk/src/utils/SkThreadUtils_pthread.cpp', 'trunk/src/utils/SkThreadUtils_pthread.cpp',
] ]
if CONFIG['MOZ_WIDGET_QT']: if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
SOURCES += [ SOURCES += [
'trunk/src/ports/SkDebug_stdio.cpp', 'trunk/src/ports/SkDebug_stdio.cpp',
'trunk/src/ports/SkFontHost_cairo.cpp', 'trunk/src/ports/SkFontHost_cairo.cpp',
@ -868,7 +868,7 @@ if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['HAVE_TOOLCHAIN_SUPPORT_MSSSE3']:
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'): if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):
DEFINES['SK_FONTHOST_CAIRO_STANDALONE'] = 0 DEFINES['SK_FONTHOST_CAIRO_STANDALONE'] = 0
if (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk') or CONFIG['MOZ_WIDGET_QT'] or CONFIG['MOZ_WIDGET_GTK']: if (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt') or CONFIG['MOZ_WIDGET_GTK']:
DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1 DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':

View File

@ -158,7 +158,7 @@ namespace FilterWrappers {
Offset(DrawTarget* aDT, FilterNode* aInputFilter, const IntPoint& aOffset) Offset(DrawTarget* aDT, FilterNode* aInputFilter, const IntPoint& aOffset)
{ {
RefPtr<FilterNode> filter = aDT->CreateFilter(FilterType::TRANSFORM); RefPtr<FilterNode> filter = aDT->CreateFilter(FilterType::TRANSFORM);
filter->SetAttribute(ATT_TRANSFORM_MATRIX, Matrix().Translate(aOffset.x, aOffset.y)); filter->SetAttribute(ATT_TRANSFORM_MATRIX, Matrix::Translation(aOffset.x, aOffset.y));
filter->SetInput(IN_TRANSFORM_IN, aInputFilter); filter->SetInput(IN_TRANSFORM_IN, aInputFilter);
return filter; return filter;
} }
@ -199,7 +199,7 @@ namespace FilterWrappers {
{ {
RefPtr<FilterNode> filter = aDT->CreateFilter(FilterType::TRANSFORM); RefPtr<FilterNode> filter = aDT->CreateFilter(FilterType::TRANSFORM);
filter->SetAttribute(ATT_TRANSFORM_MATRIX, filter->SetAttribute(ATT_TRANSFORM_MATRIX,
Matrix().Translate(aSurfacePosition.x, aSurfacePosition.y)); Matrix::Translation(aSurfacePosition.x, aSurfacePosition.y));
filter->SetInput(IN_TRANSFORM_IN, aSurface); filter->SetInput(IN_TRANSFORM_IN, aSurface);
return filter; return filter;
} }

View File

@ -511,10 +511,10 @@ TEST(AsyncPanZoomController, ComplexTransform) {
metrics.mResolution = ParentLayerToLayerScale(2); metrics.mResolution = ParentLayerToLayerScale(2);
metrics.SetZoom(CSSToScreenScale(6)); metrics.SetZoom(CSSToScreenScale(6));
metrics.mDevPixelsPerCSSPixel = CSSToLayoutDeviceScale(3); metrics.mDevPixelsPerCSSPixel = CSSToLayoutDeviceScale(3);
metrics.mScrollId = FrameMetrics::START_SCROLL_ID; metrics.SetScrollId(FrameMetrics::START_SCROLL_ID);
FrameMetrics childMetrics = metrics; FrameMetrics childMetrics = metrics;
childMetrics.mScrollId = FrameMetrics::START_SCROLL_ID + 1; childMetrics.SetScrollId(FrameMetrics::START_SCROLL_ID + 1);
layers[0]->AsContainerLayer()->SetFrameMetrics(metrics); layers[0]->AsContainerLayer()->SetFrameMetrics(metrics);
layers[1]->AsContainerLayer()->SetFrameMetrics(childMetrics); layers[1]->AsContainerLayer()->SetFrameMetrics(childMetrics);
@ -927,7 +927,7 @@ SetScrollableFrameMetrics(Layer* aLayer, FrameMetrics::ViewID aScrollId,
{ {
ContainerLayer* container = aLayer->AsContainerLayer(); ContainerLayer* container = aLayer->AsContainerLayer();
FrameMetrics metrics; FrameMetrics metrics;
metrics.mScrollId = aScrollId; metrics.SetScrollId(aScrollId);
nsIntRect layerBound = aLayer->GetVisibleRegion().GetBounds(); nsIntRect layerBound = aLayer->GetVisibleRegion().GetBounds();
metrics.mCompositionBounds = ParentLayerIntRect(layerBound.x, layerBound.y, metrics.mCompositionBounds = ParentLayerIntRect(layerBound.x, layerBound.y,
layerBound.width, layerBound.height); layerBound.width, layerBound.height);

View File

@ -1370,7 +1370,7 @@ SnapshotIterator::allocationReadable(const RValueAllocation &alloc)
return hasRegister(alloc.fpuReg()); return hasRegister(alloc.fpuReg());
case RValueAllocation::TYPED_REG: case RValueAllocation::TYPED_REG:
return hasRegister(alloc.reg()); return hasRegister(alloc.reg2());
#if defined(JS_NUNBOX32) #if defined(JS_NUNBOX32)
case RValueAllocation::UNTYPED_REG_REG: case RValueAllocation::UNTYPED_REG_REG:

View File

@ -4622,7 +4622,7 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, const ReadOnlyCompileOption
if (!frontend::CompileFunctionBody(cx, &fun, options, formals, chars, length)) if (!frontend::CompileFunctionBody(cx, &fun, options, formals, chars, length))
return nullptr; return nullptr;
if (obj && funAtom) { if (obj && funAtom && options.defineOnScope) {
Rooted<jsid> id(cx, AtomToId(funAtom)); Rooted<jsid> id(cx, AtomToId(funAtom));
RootedValue value(cx, ObjectValue(*fun)); RootedValue value(cx, ObjectValue(*fun));
if (!JSObject::defineGeneric(cx, obj, id, value, nullptr, nullptr, JSPROP_ENUMERATE)) if (!JSObject::defineGeneric(cx, obj, id, value, nullptr, nullptr, JSPROP_ENUMERATE))

View File

@ -3377,6 +3377,7 @@ class JS_FRIEND_API(ReadOnlyCompileOptions)
column(0), column(0),
compileAndGo(false), compileAndGo(false),
forEval(false), forEval(false),
defineOnScope(true),
noScriptRval(false), noScriptRval(false),
selfHostingMode(false), selfHostingMode(false),
canLazilyParse(true), canLazilyParse(true),
@ -3416,6 +3417,7 @@ class JS_FRIEND_API(ReadOnlyCompileOptions)
unsigned column; unsigned column;
bool compileAndGo; bool compileAndGo;
bool forEval; bool forEval;
bool defineOnScope;
bool noScriptRval; bool noScriptRval;
bool selfHostingMode; bool selfHostingMode;
bool canLazilyParse; bool canLazilyParse;
@ -3517,6 +3519,7 @@ class JS_FRIEND_API(OwningCompileOptions) : public ReadOnlyCompileOptions
OwningCompileOptions &setColumn(unsigned c) { column = c; return *this; } OwningCompileOptions &setColumn(unsigned c) { column = c; return *this; }
OwningCompileOptions &setCompileAndGo(bool cng) { compileAndGo = cng; return *this; } OwningCompileOptions &setCompileAndGo(bool cng) { compileAndGo = cng; return *this; }
OwningCompileOptions &setForEval(bool eval) { forEval = eval; return *this; } OwningCompileOptions &setForEval(bool eval) { forEval = eval; return *this; }
OwningCompileOptions &setDefineOnScope(bool define) { defineOnScope = define; return *this; }
OwningCompileOptions &setNoScriptRval(bool nsr) { noScriptRval = nsr; return *this; } OwningCompileOptions &setNoScriptRval(bool nsr) { noScriptRval = nsr; return *this; }
OwningCompileOptions &setSelfHostingMode(bool shm) { selfHostingMode = shm; return *this; } OwningCompileOptions &setSelfHostingMode(bool shm) { selfHostingMode = shm; return *this; }
OwningCompileOptions &setCanLazilyParse(bool clp) { canLazilyParse = clp; return *this; } OwningCompileOptions &setCanLazilyParse(bool clp) { canLazilyParse = clp; return *this; }
@ -3602,6 +3605,7 @@ class MOZ_STACK_CLASS JS_FRIEND_API(CompileOptions) : public ReadOnlyCompileOpti
CompileOptions &setColumn(unsigned c) { column = c; return *this; } CompileOptions &setColumn(unsigned c) { column = c; return *this; }
CompileOptions &setCompileAndGo(bool cng) { compileAndGo = cng; return *this; } CompileOptions &setCompileAndGo(bool cng) { compileAndGo = cng; return *this; }
CompileOptions &setForEval(bool eval) { forEval = eval; return *this; } CompileOptions &setForEval(bool eval) { forEval = eval; return *this; }
CompileOptions &setDefineOnScope(bool define) { defineOnScope = define; return *this; }
CompileOptions &setNoScriptRval(bool nsr) { noScriptRval = nsr; return *this; } CompileOptions &setNoScriptRval(bool nsr) { noScriptRval = nsr; return *this; }
CompileOptions &setSelfHostingMode(bool shm) { selfHostingMode = shm; return *this; } CompileOptions &setSelfHostingMode(bool shm) { selfHostingMode = shm; return *this; }
CompileOptions &setCanLazilyParse(bool clp) { canLazilyParse = clp; return *this; } CompileOptions &setCanLazilyParse(bool clp) { canLazilyParse = clp; return *this; }

View File

@ -207,6 +207,6 @@ function AsmJSArrayBuffer(size) {
' var i32 = new global.Int32Array(buffer);' + ' var i32 = new global.Int32Array(buffer);' +
' function g() {};' + ' function g() {};' +
' return g;' + ' return g;' +
''))(this,null,ab); ''))(Function("return this")(),null,ab);
return ab; return ab;
} }

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