Merge mozilla-central to autoland

--HG--
rename : mfbt/double-conversion/LICENSE => mfbt/double-conversion/source/LICENSE
rename : mfbt/double-conversion/bignum-dtoa.cc => mfbt/double-conversion/source/bignum-dtoa.cc
rename : mfbt/double-conversion/bignum-dtoa.h => mfbt/double-conversion/source/bignum-dtoa.h
rename : mfbt/double-conversion/bignum.cc => mfbt/double-conversion/source/bignum.cc
rename : mfbt/double-conversion/bignum.h => mfbt/double-conversion/source/bignum.h
rename : mfbt/double-conversion/cached-powers.cc => mfbt/double-conversion/source/cached-powers.cc
rename : mfbt/double-conversion/cached-powers.h => mfbt/double-conversion/source/cached-powers.h
rename : mfbt/double-conversion/diy-fp.cc => mfbt/double-conversion/source/diy-fp.cc
rename : mfbt/double-conversion/diy-fp.h => mfbt/double-conversion/source/diy-fp.h
rename : mfbt/double-conversion/double-conversion.cc => mfbt/double-conversion/source/double-conversion.cc
rename : mfbt/double-conversion/double-conversion.h => mfbt/double-conversion/source/double-conversion.h
rename : mfbt/double-conversion/fast-dtoa.cc => mfbt/double-conversion/source/fast-dtoa.cc
rename : mfbt/double-conversion/fast-dtoa.h => mfbt/double-conversion/source/fast-dtoa.h
rename : mfbt/double-conversion/fixed-dtoa.cc => mfbt/double-conversion/source/fixed-dtoa.cc
rename : mfbt/double-conversion/fixed-dtoa.h => mfbt/double-conversion/source/fixed-dtoa.h
rename : mfbt/double-conversion/ieee.h => mfbt/double-conversion/source/ieee.h
rename : mfbt/double-conversion/strtod.cc => mfbt/double-conversion/source/strtod.cc
rename : mfbt/double-conversion/strtod.h => mfbt/double-conversion/source/strtod.h
rename : mfbt/double-conversion/utils.h => mfbt/double-conversion/source/utils.h
extra : rebase_source : b1bd281604008c624ce31cfd1465dc655ab2a584
This commit is contained in:
Carsten "Tomcat" Book 2017-01-31 15:58:49 +01:00
Родитель 3748b8635f 0745d54a39
Коммит 60bce3d7c4
90 изменённых файлов: 2552 добавлений и 2335 удалений

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

@ -51,7 +51,7 @@
^media/webrtc/trunk/.*
^memory/jemalloc/src/.*
^mfbt/decimal/.*
^mfbt/double-conversion/.*
^mfbt/double-conversion/source/.*
^mfbt/lz4.*
^mobile/android/thirdparty/.*
^modules/brotli/.*

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

@ -203,9 +203,10 @@ function referrerTestCaseLoaded(aTestNumber, aParams) {
"?scheme=" + escape(test.toScheme) +
"&policy=" + escape(test.policy || "") +
"&rel=" + escape(test.rel || "");
var browser = gTestWindow.gBrowser;
browser.selectedTab = browser.addTab(url, aParams);
return BrowserTestUtils.browserLoaded(browser.selectedBrowser);
let browser = gTestWindow.gBrowser;
return BrowserTestUtils.openNewForegroundTab(browser, () => {
browser.selectedTab = browser.addTab(url, aParams);
});
}
/**

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

@ -21,13 +21,9 @@ CRCCheck on
RequestExecutionLevel user
; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can
; be removed after we require NSIS 3.0a2 or greater.
!ifdef NSIS_PACKEDVERSION
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!endif
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!addplugindir ./
@ -46,7 +42,7 @@ Var PreventRebootRequired
; StartMenuDir variable can use the common InstallOnInitCommon macro.
!define NO_STARTMENU_DIR
; On Vista and above attempt to elevate Standard Users in addition to users that
; Attempt to elevate Standard Users in addition to users that
; are a member of the Administrators group.
!define NONADMIN_ELEVATE
@ -252,7 +248,7 @@ Section "-InstallStartCleanup"
; setup the application model id registration value
${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
; Remove the updates directory for Vista and above
; Remove the updates directory
${CleanUpdateDirectories} "Mozilla\Firefox" "Mozilla\updates"
${RemoveDeprecatedFiles}
@ -390,7 +386,7 @@ Section "-Application" APP_IDX
; For pre win8, the following keys should only be set if we can write to HKLM.
; For post win8, the keys below get set in both HKLM and HKCU.
${If} $TmpVal == "HKLM"
; Set the Start Menu Internet and Vista Registered App HKLM registry keys.
; Set the Start Menu Internet and Registered App HKLM registry keys.
${SetStartMenuInternet} "HKLM"
${FixShellIconHandler} "HKLM"
@ -409,7 +405,7 @@ Section "-Application" APP_IDX
${EndIf}
${If} ${AtLeastWin8}
; Set the Start Menu Internet and Vista Registered App HKCU registry keys.
; Set the Start Menu Internet and Registered App HKCU registry keys.
${SetStartMenuInternet} "HKCU"
${FixShellIconHandler} "HKCU"
@ -439,14 +435,8 @@ Section "-Application" APP_IDX
${If} $R0 == "true"
; Only proceed if we have HKLM write access
${AndIf} $TmpVal == "HKLM"
; On Windows < XP SP3 we do not install the maintenance service.
${If} ${IsWinXP}
${AndIf} ${AtMostServicePack} 2
StrCpy $InstallMaintenanceService "0"
${Else}
; The user is an admin, so we should default to installing the service.
StrCpy $InstallMaintenanceService "1"
${EndIf}
; The user is an admin, so we should default to installing the service.
StrCpy $InstallMaintenanceService "1"
${Else}
; The user is not admin, so we can't install the service.
StrCpy $InstallMaintenanceService "0"
@ -474,7 +464,7 @@ Section "-Application" APP_IDX
${CreateRegKey} "$TmpVal" "$0" 0
${If} $TmpVal == "HKLM"
; Set the permitted LSP Categories for WinVista and above
; Set the permitted LSP Categories
${SetAppLSPCategories} ${LSP_CATEGORIES}
${EndIf}
@ -601,15 +591,13 @@ Section "-InstallEndCleanup"
; value was before we changed it. To do so, we read it here and store it
; in our own registry key.
StrCpy $0 ""
${If} ${AtLeastWinVista}
AppAssocReg::QueryCurrentDefault "http" "protocol" "effective"
Pop $1
; If the method hasn't failed, $1 will contain the progid. Check:
${If} "$1" != "method failed"
${AndIf} "$1" != "method not available"
; Read the actual command from the progid
ReadRegStr $0 HKCR "$1\shell\open\command" ""
${EndIf}
AppAssocReg::QueryCurrentDefault "http" "protocol" "effective"
Pop $1
; If the method hasn't failed, $1 will contain the progid. Check:
${If} "$1" != "method failed"
${AndIf} "$1" != "method not available"
; Read the actual command from the progid
ReadRegStr $0 HKCR "$1\shell\open\command" ""
${EndIf}
; If using the App Association Registry didn't happen or failed, fall back
; to the effective http default:
@ -957,12 +945,6 @@ Function preComponents
Abort
${EndIf}
; On Windows < XP SP3 we do not install the maintenance service.
${If} ${IsWinXP}
${AndIf} ${AtMostServicePack} 2
Abort
${EndIf}
; Don't show the custom components page if the
; user is not an admin
Call IsUserAdmin
@ -1171,14 +1153,6 @@ Function .onInit
${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OSVER_CPU_MSG)"
; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
; removed after we require NSIS 3.0a2 or greater.
!ifndef NSIS_PACKEDVERSION
${If} ${AtLeastWinVista}
System::Call 'user32::SetProcessDPIAware()'
${EndIf}
!endif
!insertmacro InitInstallOptionsFile "options.ini"
!insertmacro InitInstallOptionsFile "shortcuts.ini"
!insertmacro InitInstallOptionsFile "components.ini"

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

@ -13,13 +13,9 @@ CRCCheck on
RequestExecutionLevel admin
; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can
; be removed after we require NSIS 3.0a2 or greater.
!ifdef NSIS_PACKEDVERSION
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!endif
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!addplugindir ./
@ -130,14 +126,6 @@ Function un.onInit
; This only effects LoadLibrary calls and not implicitly loaded DLLs.
System::Call 'kernel32::SetDllDirectoryW(w "")'
; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
; removed after we require NSIS 3.0a2 or greater.
!ifndef NSIS_PACKEDVERSION
${If} ${AtLeastWinVista}
System::Call 'user32::SetProcessDPIAware()'
${EndIf}
!endif
StrCpy $BrandFullNameDA "${MaintFullName}"
StrCpy $BrandFullName "${MaintFullName}"
FunctionEnd

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

@ -131,8 +131,6 @@
${If} $R0 == "true"
; Only proceed if we have HKLM write access
${AndIf} $TmpVal == "HKLM"
; On Windows 2000 we do not install the maintenance service.
${AndIf} ${AtLeastWinXP}
; We check to see if the maintenance service install was already attempted.
; Since the Maintenance service can be installed either x86 or x64,
; always use the 64-bit registry for checking if an attempt was made.
@ -444,7 +442,7 @@
WriteRegStr ${RegKey} "$0\shell\safemode" "" "$(CONTEXT_SAFE_MODE)"
WriteRegStr ${RegKey} "$0\shell\safemode\command" "" "$\"$8$\" -safe-mode"
; Vista Capabilities registry keys
; Capabilities registry keys
WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationDescription" "$(REG_APP_DESC)"
WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationIcon" "$8,0"
WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationName" "${BrandShortName}"
@ -461,7 +459,7 @@
WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "http" "FirefoxURL"
WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "https" "FirefoxURL"
; Vista Registered Application
; Registered Application
WriteRegStr ${RegKey} "Software\RegisteredApplications" "${AppRegName}" "$0\Capabilities"
!macroend
!define SetStartMenuInternet "!insertmacro SetStartMenuInternet"
@ -1201,7 +1199,7 @@
System::Call 'advapi32::OpenSCManagerW(n, n, i ${SC_MANAGER_ALL_ACCESS}) i.R6'
${If} $R6 != 0
; MpsSvc is the Firewall service on Windows Vista and above.
; MpsSvc is the Firewall service.
; When opening the service with SERVICE_QUERY_CONFIG the return value will
; be 0 if the service is not installed.
System::Call 'advapi32::OpenServiceW(i R6, t "MpsSvc", i ${SERVICE_QUERY_CONFIG}) i.R7'
@ -1252,7 +1250,7 @@
; Sets this installation as the default browser by setting the registry keys
; under HKEY_CURRENT_USER via registry calls and using the AppAssocReg NSIS
; plugin for Vista and above. This is a function instead of a macro so it is
; plugin. This is a function instead of a macro so it is
; easily called from an elevated instance of the binary. Since this can be
; called by an elevated instance logging is not performed in this function.
Function SetAsDefaultAppUserHKCU
@ -1287,19 +1285,17 @@ Function SetAsDefaultAppUserHKCU
${SetHandlers}
${If} ${AtLeastWinVista}
; Only register as the handler on Vista and above if the app registry name
; exists under the RegisteredApplications registry key. The protocol and
; file handlers set previously at the user level will associate this install
; as the default browser.
ClearErrors
ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegName}"
${Unless} ${Errors}
; This is all protected by a user choice hash in Windows 8 so it won't
; help, but it also won't hurt.
AppAssocReg::SetAppAsDefaultAll "${AppRegName}"
${EndUnless}
${EndIf}
; Only register as the handler if the app registry name
; exists under the RegisteredApplications registry key. The protocol and
; file handlers set previously at the user level will associate this install
; as the default browser.
ClearErrors
ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegName}"
${Unless} ${Errors}
; This is all protected by a user choice hash in Windows 8 so it won't
; help, but it also won't hurt.
AppAssocReg::SetAppAsDefaultAll "${AppRegName}"
${EndUnless}
${RemoveDeprecatedKeys}
${MigrateTaskBarShortcut}
FunctionEnd
@ -1381,8 +1377,7 @@ Function SetAsDefaultAppUser
${EndIf}
${EndUnless}
; The code after ElevateUAC won't be executed on Vista and above when the
; user:
; The code after ElevateUAC won't be executed when the user:
; a) is a member of the administrators group (e.g. elevation is required)
; b) is not a member of the administrators group and chooses to elevate
${ElevateUAC}

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

@ -18,13 +18,9 @@ CRCCheck on
RequestExecutionLevel user
; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can
; be removed after we require NSIS 3.0a2 or greater.
!ifdef NSIS_PACKEDVERSION
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!endif
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!addplugindir ./
@ -199,7 +195,7 @@ Var ControlRightPX
; InstallProgressFirstStep .
!define /math InstallPaveOverTotalSteps ${InstallProgressFirstStep} + 1800
; On Vista and above attempt to elevate Standard Users in addition to users that
; Attempt to elevate Standard Users in addition to users that
; are a member of the Administrators group.
!define NONADMIN_ELEVATE
@ -352,14 +348,6 @@ Function .onInit
; Require elevation if the user can elevate
${ElevateUAC}
; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
; removed after we require NSIS 3.0a2 or greater.
!ifndef NSIS_PACKEDVERSION
${If} ${AtLeastWinVista}
System::Call 'user32::SetProcessDPIAware()'
${EndIf}
!endif
; If we have any existing installation, use its location as the default
; path for this install, even if it's not the same architecture.
SetRegView 32
@ -437,11 +425,7 @@ Function .onInit
${EndIf}
; The interval in MS used for the progress bars set as marquee.
${If} ${AtLeastWinVista}
StrCpy $ProgressbarMarqueeIntervalMS "10"
${Else}
StrCpy $ProgressbarMarqueeIntervalMS "50"
${EndIf}
StrCpy $ProgressbarMarqueeIntervalMS "10"
; Initialize the majority of variables except those that need to be reset
; when a page is displayed.
@ -685,9 +669,8 @@ Function SendPing
${EndIf}
${If} "$R2" == "0"
${AndIf} ${AtLeastWinVista}
; Check to see if this install location is currently set as the default
; browser by Default Programs which is only available on Vista and above.
; browser by Default Programs.
ClearErrors
ReadRegStr $R3 HKLM "Software\RegisteredApplications" "${AppRegName}"
${Unless} ${Errors}
@ -1045,14 +1028,6 @@ Function createOptions
Call IsUserAdmin
Pop $0
; Only show the maintenance service checkbox if we're on XP SP3 or higher;
; we don't ever want to install it on XP without at least SP3 installed.
${If} $0 == "true"
${AndIf} ${IsWinXP}
${AndIf} ${AtMostServicePack} 2
StrCpy $0 "false"
${EndIf}
${If} $0 == "true"
; Only show the maintenance service checkbox if we have write access to HKLM
DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
@ -1795,15 +1770,13 @@ Function FinishInstall
; value was before we changed it. To do so, we read it here and store it
; in our own registry key.
StrCpy $0 ""
${If} ${AtLeastWinVista}
AppAssocReg::QueryCurrentDefault "http" "protocol" "effective"
Pop $1
; If the method hasn't failed, $1 will contain the progid. Check:
${If} "$1" != "method failed"
${AndIf} "$1" != "method not available"
; Read the actual command from the progid
ReadRegStr $0 HKCR "$1\shell\open\command" ""
${EndIf}
AppAssocReg::QueryCurrentDefault "http" "protocol" "effective"
Pop $1
; If the method hasn't failed, $1 will contain the progid. Check:
${If} "$1" != "method failed"
${AndIf} "$1" != "method not available"
; Read the actual command from the progid
ReadRegStr $0 HKCR "$1\shell\open\command" ""
${EndIf}
; If using the App Association Registry didn't happen or failed, fall back
; to the effective http default:
@ -1827,21 +1800,6 @@ Function FinishInstall
${EndIf}
${EndIf}
${If} $CheckboxShortcuts == 1
${If} ${AtMostWinVista}
ClearErrors
${GetParameters} $0
ClearErrors
${GetOptions} "$0" "/UAC:" $0
${If} ${Errors}
Call AddQuickLaunchShortcut
${Else}
GetFunctionAddress $0 AddQuickLaunchShortcut
UAC::ExecCodeSegment $0
${EndIf}
${EndIf}
${EndIf}
${If} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-upgrade"
Delete "$INSTDIR\${FileMainEXE}"
Rename "$INSTDIR\${FileMainEXE}.moz-upgrade" "$INSTDIR\${FileMainEXE}"
@ -2066,14 +2024,6 @@ Function CanWrite
${EndIf}
FunctionEnd
Function AddQuickLaunchShortcut
CreateShortCut "$QUICKLAUNCH\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}"
${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk"
ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandFullName}.lnk" \
"$INSTDIR"
${EndIf}
FunctionEnd
Function ExecSetAsDefaultAppUser
; Using the helper.exe lessens the stub installer size.
; This could ask for elevatation when the user doesn't install as admin.

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

@ -19,17 +19,13 @@ CRCCheck on
RequestExecutionLevel user
; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can
; be removed after we require NSIS 3.0a2 or greater.
!ifdef NSIS_PACKEDVERSION
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!endif
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!addplugindir ./
; On Vista and above attempt to elevate Standard Users in addition to users that
; Attempt to elevate Standard Users in addition to users that
; are a member of the Administrators group.
!define NONADMIN_ELEVATE
@ -257,7 +253,7 @@ Section "Uninstall"
ApplicationID::UninstallJumpLists "$AppUserModelID"
${EndIf}
; Remove the updates directory for Vista and above
; Remove the updates directory
${un.CleanUpdateDirectories} "Mozilla\Firefox" "Mozilla\updates"
; Remove any app model id's stored in the registry for this install path
@ -607,14 +603,6 @@ Function un.onInit
${un.UninstallUnOnInitCommon}
; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
; removed after we require NSIS 3.0a2 or greater.
!ifndef NSIS_PACKEDVERSION
${If} ${AtLeastWinVista}
System::Call 'user32::SetProcessDPIAware()'
${EndIf}
!endif
!insertmacro InitInstallOptionsFile "unconfirm.ini"
FunctionEnd

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

@ -53,7 +53,7 @@ function* testDirectorScriptMessagePort(directorManager) {
exports.attach = function ({port}) {
port.onmessage = function (evt) {
// echo messages
evt.source.postMessage(evt.data);
evt.target.postMessage(evt.data);
};
};
}).toString() + ")();",

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

@ -81,7 +81,7 @@ function runDirectorRegistryActorTest() {
module.exports = function({port}) {
port.onmessage = function(evt) {
// echo messages
evt.source.postMessage(evt.data);
evt.target.postMessage(evt.data);
};
};
}).toString() + ")();",

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

@ -311,8 +311,9 @@ EffectCompositor::PostRestyleForAnimation(dom::Element* aElement,
eRestyle_CSSAnimations;
// FIXME: stylo only supports Self and Subtree hints now, so we override it
// for stylo.
if (mPresContext->StyleSet()->IsServo()) {
// for stylo if we are not in process of restyling.
if (mPresContext->StyleSet()->IsServo() &&
!mPresContext->RestyleManager()->AsBase()->IsInStyleRefresh()) {
hint = eRestyle_Self | eRestyle_Subtree;
}
mPresContext->PresShell()->RestyleForAnimation(element, hint);

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

@ -50,7 +50,6 @@
#include "ImageRegion.h"
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "gfxPlatform.h"
#include "gfxFont.h"
#include "gfxBlur.h"
@ -5810,17 +5809,26 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t aX, int32_t aY, uint32_t
uint32_t copyWidth = dirtyRect.Width();
uint32_t copyHeight = dirtyRect.Height();
RefPtr<gfxImageSurface> imgsurf = new gfxImageSurface(gfx::IntSize(copyWidth, copyHeight),
SurfaceFormat::A8R8G8B8_UINT32,
false);
if (!imgsurf || imgsurf->CairoStatus()) {
RefPtr<DataSourceSurface> sourceSurface =
gfx::Factory::CreateDataSourceSurface(gfx::IntSize(copyWidth, copyHeight),
SurfaceFormat::B8G8R8A8,
false);
// In certain scenarios, requesting larger than 8k image fails. Bug 803568
// covers the details of how to run into it, but the full detailed
// investigation hasn't been done to determine the underlying cause. We
// will just handle the failure to allocate the surface to avoid a crash.
if (!sourceSurface) {
return NS_ERROR_FAILURE;
}
uint8_t *dstLine = sourceSurface->GetData();
if (!dstLine) {
return NS_ERROR_OUT_OF_MEMORY;
}
int32_t dstStride = sourceSurface->Stride();
uint32_t copyX = dirtyRect.x - aX;
uint32_t copyY = dirtyRect.y - aY;
//uint8_t *src = aArray->Data();
uint8_t *dst = imgsurf->Data();
uint8_t* srcLine = aArray->Data() + copyY * (aW * 4) + copyX * 4;
// For opaque canvases, we must still premultiply the RGB components, but write the alpha as opaque.
uint8_t alphaMask = mOpaque ? 255 : 0;
@ -5832,6 +5840,7 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t aX, int32_t aY, uint32_t
#endif
for (uint32_t j = 0; j < copyHeight; j++) {
uint8_t *src = srcLine;
uint8_t *dst = dstLine;
for (uint32_t i = 0; i < copyWidth; i++) {
uint8_t r = *src++;
uint8_t g = *src++;
@ -5852,6 +5861,10 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t aX, int32_t aY, uint32_t
#endif
}
srcLine += aW * 4;
// Note that dstLine + dstStride might not be the same as "dst" here,
// depending the width we asked for and the width the underlying machinery
// decided to actually allocate (e.g. to give each row nice alignment).
dstLine += dstStride;
}
// The canvas spec says that the current path, transformation matrix, shadow attributes,
@ -5864,17 +5877,6 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t aX, int32_t aY, uint32_t
return NS_ERROR_FAILURE;
}
RefPtr<SourceSurface> sourceSurface =
mTarget->CreateSourceSurfaceFromData(imgsurf->Data(), IntSize(copyWidth, copyHeight), imgsurf->Stride(), SurfaceFormat::B8G8R8A8);
// In certain scenarios, requesting larger than 8k image fails. Bug 803568
// covers the details of how to run into it, but the full detailed
// investigation hasn't been done to determine the underlying cause. We
// will just handle the failure to allocate the surface to avoid a crash.
if (!sourceSurface) {
return NS_ERROR_FAILURE;
}
mTarget->CopySurface(sourceSurface,
IntRect(0, 0,
dirtyRect.width, dirtyRect.height),

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

@ -128,9 +128,11 @@ WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
case WebGLExtensionID::WEBGL_compressed_texture_atc:
return gl->IsExtensionSupported(gl::GLContext::AMD_compressed_ATC_texture);
case WebGLExtensionID::WEBGL_compressed_texture_etc:
return gl->IsSupported(gl::GLFeature::ES3_compatibility);
return gl->IsSupported(gl::GLFeature::ES3_compatibility) &&
!gl->IsANGLE();
case WebGLExtensionID::WEBGL_compressed_texture_etc1:
return gl->IsExtensionSupported(gl::GLContext::OES_compressed_ETC1_RGB8_texture);
return gl->IsExtensionSupported(gl::GLContext::OES_compressed_ETC1_RGB8_texture) &&
!gl->IsANGLE();
case WebGLExtensionID::WEBGL_compressed_texture_pvrtc:
return gl->IsExtensionSupported(gl::GLContext::IMG_texture_compression_pvrtc);
case WebGLExtensionID::WEBGL_compressed_texture_s3tc:

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

@ -19,8 +19,7 @@ BASE_TEST_LIST_PATHSTR = 'checkout/00_test_list.txt'
GENERATED_PATHSTR = 'generated'
WEBGL2_TEST_MANGLE = '2_'
PATH_SEP_MANGLING = '__'
WEBGL2_SKIP_IF_CONDITION = "(os == 'android' || os == 'linux' || " \
"(os == 'win' && os_version == '5.1'))"
WEBGL2_SKIP_IF_CONDITION = "(os == 'android' || os == 'linux')"
SUPPORT_DIRS = [
'checkout',

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -16,9 +16,6 @@
##########
# os_version strings
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832%28v=vs.85%29.aspx
# * Windows XP: 5.1
# * Windows XP 64-bit: 5.2
# * Windows Vista: 6.0
# * Windows 7: 6.1
# * Windows 8: 6.2
# * Windows 8.1: 6.3
@ -72,7 +69,7 @@ skip-if = 1
skip-if = (os == 'android') || (os == 'linux') || (os == 'win')
[generated/test_conformance__ogles__GL__mat3__mat3_001_to_006.html]
# Timeout on D3D11
skip-if = (os == 'win' && os_version != '5.1')
skip-if = (os == 'win')
####################
# Tests expect conservative index validation, which we skip on WebGL 2.
@ -878,13 +875,9 @@ skip-if = (os == 'win')
skip-if = (os == 'win')
[generated/test_2_conformance2__glsl3__vector-dynamic-indexing.html]
skip-if = (os == 'win')
[generated/test_conformance__glsl__misc__large-loop-compile.html]
fail-if = (os == 'win' && os_version == '5.1')
[generated/test_conformance__textures__misc__copy-tex-image-2d-formats.html]
skip-if = (os == 'win' && os_version == '5.1')
[generated/test_conformance__uniforms__uniform-values-per-program.html]
# Crashes on D3D11 debug.
skip-if = (os == 'win' && os_version != '5.1')
skip-if = (os == 'win')
[generated/test_2_conformance2__glsl3__uniform-location-length-limits.html]
# time out crash
skip-if = (os == 'win' && debug)
@ -971,10 +964,3 @@ skip-if = (os == 'win')
skip-if = (os == 'win')
[generated/test_2_conformance2__buffers__get-buffer-sub-data.html]
skip-if = (os == 'win')
####################
# failure on Windows
[generated/test_2_conformance__canvas__rapid-resizing.html]
fail-if = (os == 'win' && os_version == '5.1')
[generated/test_conformance__glsl__bugs__floor-div-cos-should-not-truncate.html]
fail-if = (os == 'win' && os_version == '5.1')

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

@ -10,9 +10,7 @@
<script>
'use strict';
Lastly_WithDraftExtsEnabled(function() {
EnsureExt('WEBGL_compressed_texture_es3');
});
EnsureExt('WEBGL_compressed_texture_etc');
</script>
</body>

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

@ -32,7 +32,7 @@ fail-if = (os == 'android') || (os == 'linux') || (os == 'mac') || (os == 'win')
[ensure-exts/test_WEBGL_compressed_texture_es3.html]
fail-if = (os == 'android') || (os == 'linux') || (os == 'mac') || (os == 'win')
[ensure-exts/test_WEBGL_compressed_texture_etc1.html]
fail-if = (os == 'linux') || (os == 'mac') || (os == 'win' && os_version == '5.1')
fail-if = (os == 'linux') || (os == 'mac') || (os == 'win')
[ensure-exts/test_WEBGL_compressed_texture_pvrtc.html]
fail-if = (os == 'android') || (os == 'linux') || (os == 'mac') || (os == 'win')
[ensure-exts/test_WEBGL_compressed_texture_s3tc.html]

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

@ -139,13 +139,10 @@ private:
return NS_ERROR_OUT_OF_MEMORY;
}
Nullable<WindowProxyOrMessagePort> source;
source.SetValue().SetAsMessagePort() = mPort;
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"),
false /* non-bubbling */,
false /* cancelable */, value, EmptyString(),
EmptyString(), source, ports);
EmptyString(), nullptr, ports);
event->SetTrusted(true);
bool dummy;

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

@ -927,7 +927,14 @@ EditorBase::BeginPlaceHolderTransaction(nsIAtom* aName)
if (selection) {
mSelState = new SelectionState();
mSelState->SaveSelection(selection);
mRangeUpdater.RegisterSelectionState(*mSelState);
// Composition transaction can modify multiple nodes and it merges text
// node for ime into single text node.
// So if current selection is into IME text node, it might be failed
// to restore selection by UndoTransaction.
// So we need update selection by range updater.
if (mPlaceHolderName == nsGkAtoms::IMETxnName) {
mRangeUpdater.RegisterSelectionState(*mSelState);
}
}
}
mPlaceHolderBatch++;
@ -979,7 +986,9 @@ EditorBase::EndPlaceHolderTransaction()
if (mSelState) {
// we saved the selection state, but never got to hand it to placeholder
// (else we ould have nulled out this pointer), so destroy it to prevent leaks.
mRangeUpdater.DropSelectionState(*mSelState);
if (mPlaceHolderName == nsGkAtoms::IMETxnName) {
mRangeUpdater.DropSelectionState(*mSelState);
}
delete mSelState;
mSelState = nullptr;
}

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

@ -225,6 +225,7 @@ skip-if = toolkit == 'android' # bug 1315898
[test_bug1314790.html]
[test_bug1315065.html]
[test_bug1316302.html]
[test_bug1328023.html]
[test_bug1330796.html]
[test_bug1332876.html]

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

@ -0,0 +1,64 @@
<!DOCTYPE html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1328023
-->
<html>
<head>
<title>Test for Bug 1328023</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1328023">Mozilla Bug 1328023</a>
<p id="display"></p>
<div id="content" style="display: none;">
</div>
<input type="text" id="input1"/>
<pre id="test">
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
let elm = document.getElementById("input1");
elm.focus();
synthesizeKey("A", {});
synthesizeKey("B", {});
is(elm.value, "AB", "AB is input.value now");
synthesizeKey("VK_BACK_SPACE", {});
is(elm.value, "A", "A is input.value now");
synthesizeKey("Z", { accelKey: true });
is(elm.value, "AB", "AB is input.value now");
synthesizeKey("C", {});
is(elm.value, "ABC", "ABC is input.value now");
synthesizeKey("VK_BACK_SPACE", {});
synthesizeKey("VK_BACK_SPACE", {});
synthesizeKey("VK_BACK_SPACE", {});
synthesizeKey("A", {});
synthesizeKey("B", {});
synthesizeKey("C", {});
is(elm.value, "ABC", "ABC is input.value now");
synthesizeKey("Z", { accelKey: true });
is(elm.value, "", "'' is input.value now");
synthesizeKey("Z", { accelKey: true, shiftKey: true });
is(elm.value, "ABC", "ABC is input.value now");
synthesizeKey("D", {});
is(elm.value, "ABCD", "ABCD is input.value now");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>

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

@ -913,7 +913,7 @@ Layer::ApplyPendingUpdatesForThisTransaction()
if (mPendingTransform && *mPendingTransform != mSimpleAttrs.Transform()) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PendingUpdatesForThisTransaction", this));
mSimpleAttrs.SetTransform(*mPendingTransform);
Mutated();
MutatedSimple();
}
mPendingTransform = nullptr;

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

@ -323,13 +323,8 @@ CellIsMarkedGray(const Cell* cell)
return *word & mask;
}
static MOZ_ALWAYS_INLINE bool
CellIsMarkedGrayIfKnown(const Cell* cell)
{
MOZ_ASSERT(cell);
auto rt = js::gc::detail::GetCellRuntime(cell);
return rt->areGCGrayBitsValid() && CellIsMarkedGray(cell);
}
extern JS_PUBLIC_API(bool)
CellIsMarkedGrayIfKnown(const Cell* cell);
} /* namespace detail */

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

@ -8,6 +8,7 @@
#define ds_PageProtectingVector_h
#include "mozilla/Atomics.h"
#include "mozilla/PodOperations.h"
#include "mozilla/Vector.h"
#include "ds/MemoryProtectionExceptionHandler.h"
@ -35,10 +36,9 @@ template<typename T,
class AllocPolicy = mozilla::MallocAllocPolicy,
bool ProtectUsed = true,
bool ProtectUnused = true,
bool GuardAgainstReentrancy = true,
bool DetectPoison = false,
size_t InitialLowerBound = 0,
uint8_t PoisonPattern = 0xe5>
bool PoisonUnused = true,
uint8_t PoisonPattern = 0xe3>
class PageProtectingVector final
{
mozilla::Vector<T, MinInlineCapacity, AllocPolicy> vector;
@ -90,12 +90,6 @@ class PageProtectingVector final
*/
size_t lowerBound;
/*
* The number of subsequent bytes containing the poison pattern detected
* thus far. This detection may span several append calls.
*/
size_t poisonBytes;
#ifdef DEBUG
bool regionUnprotected;
#endif
@ -105,11 +99,6 @@ class PageProtectingVector final
bool protectUsedEnabled;
bool protectUnusedEnabled;
bool reentrancyGuardEnabled;
mutable mozilla::Atomic<bool, mozilla::ReleaseAcquire> reentrancyGuard;
bool detectPoisonEnabled;
MOZ_ALWAYS_INLINE void resetTest() {
MOZ_ASSERT(protectUsedEnabled || protectUnusedEnabled);
size_t nextPage = (pageSize - (uintptr_t(begin() + length()) & pageMask)) >> elemShift;
@ -135,11 +124,17 @@ class PageProtectingVector final
(uintptr_t(begin()) & elemMask) == 0 && capacity() >= lowerBound;
protectUnusedEnabled = ProtectUnused && usable && enabled && initPage <= lastPage &&
(uintptr_t(begin()) & elemMask) == 0 && capacity() >= lowerBound;
reentrancyGuardEnabled = GuardAgainstReentrancy && enabled && capacity() >= lowerBound;
detectPoisonEnabled = DetectPoison && enabled && capacity() >= lowerBound;
setTestInitial();
}
MOZ_ALWAYS_INLINE void poisonNewBuffer() {
if (!PoisonUnused)
return;
T* addr = begin() + length();
size_t toPoison = (capacity() - length()) * sizeof(T);
memset(addr, PoisonPattern, toPoison);
}
MOZ_ALWAYS_INLINE void addExceptionHandler() {
if (MOZ_UNLIKELY(protectUsedEnabled || protectUnusedEnabled))
MemoryProtectionExceptionHandler::addRegion(begin(), capacity() << elemShift);
@ -193,6 +188,7 @@ class PageProtectingVector final
MOZ_ALWAYS_INLINE void protectNewBuffer() {
resetForNewBuffer();
addExceptionHandler();
poisonNewBuffer();
protectUsed();
protectUnused();
}
@ -293,58 +289,6 @@ class PageProtectingVector final
template<typename U>
MOZ_NEVER_INLINE MOZ_MUST_USE bool appendSlow(const U* values, size_t size);
MOZ_ALWAYS_INLINE void lock() const {
if (MOZ_LIKELY(!GuardAgainstReentrancy || !reentrancyGuardEnabled))
return;
if (MOZ_UNLIKELY(!reentrancyGuard.compareExchange(false, true)))
lockSlow();
}
MOZ_ALWAYS_INLINE void unlock() const {
if (!GuardAgainstReentrancy)
return;
reentrancyGuard = false;
}
MOZ_NEVER_INLINE void lockSlow() const;
/* A helper class to guard against concurrent access. */
class AutoGuardAgainstReentrancy
{
PageProtectingVector& vector;
public:
MOZ_ALWAYS_INLINE explicit AutoGuardAgainstReentrancy(PageProtectingVector& holder)
: vector(holder)
{
vector.lock();
}
MOZ_ALWAYS_INLINE ~AutoGuardAgainstReentrancy() {
vector.unlock();
}
};
template<typename U>
MOZ_ALWAYS_INLINE void checkForPoison(const U* values, size_t size) {
if (MOZ_LIKELY(!DetectPoison || !detectPoisonEnabled))
return;
const uint8_t* addr = reinterpret_cast<const uint8_t*>(values);
size_t bytes = size * sizeof(U);
for (size_t i = 0; i < bytes; ++i) {
if (MOZ_LIKELY(addr[i] != PoisonPattern)) {
poisonBytes = 0;
} else {
++poisonBytes;
if (MOZ_UNLIKELY(poisonBytes >= 16))
MOZ_CRASH("Caller is writing the poison pattern into this buffer!");
}
}
}
MOZ_ALWAYS_INLINE T* begin() { return vector.begin(); }
MOZ_ALWAYS_INLINE const T* begin() const { return vector.begin(); }
public:
explicit PageProtectingVector(AllocPolicy policy = AllocPolicy())
: vector(policy),
@ -353,17 +297,13 @@ class PageProtectingVector final
initPage(0),
lastPage(0),
lowerBound(InitialLowerBound),
poisonBytes(0),
#ifdef DEBUG
regionUnprotected(false),
#endif
usable(true),
enabled(true),
protectUsedEnabled(false),
protectUnusedEnabled(false),
reentrancyGuardEnabled(false),
reentrancyGuard(false),
detectPoisonEnabled(false)
protectUnusedEnabled(false)
{
if (gc::SystemPageSize() != pageSize)
usable = false;
@ -426,29 +366,16 @@ class PageProtectingVector final
MOZ_ALWAYS_INLINE size_t capacity() const { return vector.capacity(); }
MOZ_ALWAYS_INLINE size_t length() const { return vector.length(); }
MOZ_ALWAYS_INLINE T* acquire() {
lock();
return begin();
}
MOZ_ALWAYS_INLINE const T* acquire() const {
lock();
return begin();
}
MOZ_ALWAYS_INLINE void release() const {
unlock();
}
MOZ_ALWAYS_INLINE T* begin() { return vector.begin(); }
MOZ_ALWAYS_INLINE const T* begin() const { return vector.begin(); }
void clear() {
AutoGuardAgainstReentrancy guard(*this);
unprotectOldBuffer();
vector.clear();
protectNewBuffer();
}
MOZ_ALWAYS_INLINE MOZ_MUST_USE bool reserve(size_t size) {
AutoGuardAgainstReentrancy guard(*this);
if (MOZ_LIKELY(size <= capacity()))
return vector.reserve(size);
return reserveSlow(size);
@ -456,8 +383,6 @@ class PageProtectingVector final
template<typename U>
MOZ_ALWAYS_INLINE void infallibleAppend(const U* values, size_t size) {
AutoGuardAgainstReentrancy guard(*this);
checkForPoison(values, size);
elemsUntilTest -= size;
if (MOZ_LIKELY(elemsUntilTest >= 0))
return vector.infallibleAppend(values, size);
@ -466,8 +391,6 @@ class PageProtectingVector final
template<typename U>
MOZ_ALWAYS_INLINE MOZ_MUST_USE bool append(const U* values, size_t size) {
AutoGuardAgainstReentrancy guard(*this);
checkForPoison(values, size);
elemsUntilTest -= size;
if (MOZ_LIKELY(elemsUntilTest >= 0))
return vector.append(values, size);
@ -475,9 +398,9 @@ class PageProtectingVector final
}
};
template<typename T, size_t N, class A, bool P, bool Q, bool G, bool D, size_t I, uint8_t X>
template<typename T, size_t A, class B, bool C, bool D, size_t E, bool F, uint8_t G>
MOZ_NEVER_INLINE void
PageProtectingVector<T, N, A, P, Q, G, D, I, X>::unprotectRegionSlow(uintptr_t l, uintptr_t r)
PageProtectingVector<T, A, B, C, D, E, F, G>::unprotectRegionSlow(uintptr_t l, uintptr_t r)
{
if (l < initPage)
l = initPage;
@ -488,9 +411,9 @@ PageProtectingVector<T, N, A, P, Q, G, D, I, X>::unprotectRegionSlow(uintptr_t l
gc::UnprotectPages(addr, size);
}
template<typename T, size_t N, class A, bool P, bool Q, bool G, bool D, size_t I, uint8_t X>
template<typename T, size_t A, class B, bool C, bool D, size_t E, bool F, uint8_t G>
MOZ_NEVER_INLINE void
PageProtectingVector<T, N, A, P, Q, G, D, I, X>::reprotectRegionSlow(uintptr_t l, uintptr_t r)
PageProtectingVector<T, A, B, C, D, E, F, G>::reprotectRegionSlow(uintptr_t l, uintptr_t r)
{
if (l < initPage)
l = initPage;
@ -501,17 +424,17 @@ PageProtectingVector<T, N, A, P, Q, G, D, I, X>::reprotectRegionSlow(uintptr_t l
gc::MakePagesReadOnly(addr, size);
}
template<typename T, size_t N, class A, bool P, bool Q, bool G, bool D, size_t I, uint8_t X>
template<typename T, size_t A, class B, bool C, bool D, size_t E, bool F, uint8_t G>
MOZ_NEVER_INLINE MOZ_MUST_USE bool
PageProtectingVector<T, N, A, P, Q, G, D, I, X>::reserveSlow(size_t size)
PageProtectingVector<T, A, B, C, D, E, F, G>::reserveSlow(size_t size)
{
return reserveNewBuffer(size);
}
template<typename T, size_t N, class A, bool P, bool Q, bool G, bool D, size_t I, uint8_t X>
template<typename T, size_t A, class B, bool C, bool D, size_t E, bool F, uint8_t G>
template<typename U>
MOZ_NEVER_INLINE void
PageProtectingVector<T, N, A, P, Q, G, D, I, X>::infallibleAppendSlow(const U* values, size_t size)
PageProtectingVector<T, A, B, C, D, E, F, G>::infallibleAppendSlow(const U* values, size_t size)
{
// Ensure that we're here because we reached a page
// boundary and not because of a buffer overflow.
@ -520,30 +443,18 @@ PageProtectingVector<T, N, A, P, Q, G, D, I, X>::infallibleAppendSlow(const U* v
infallibleAppendNewPage(values, size);
}
template<typename T, size_t N, class A, bool P, bool Q, bool G, bool D, size_t I, uint8_t X>
template<typename T, size_t A, class B, bool C, bool D, size_t E, bool F, uint8_t G>
template<typename U>
MOZ_NEVER_INLINE MOZ_MUST_USE bool
PageProtectingVector<T, N, A, P, Q, G, D, I, X>::appendSlow(const U* values, size_t size)
PageProtectingVector<T, A, B, C, D, E, F, G>::appendSlow(const U* values, size_t size)
{
if (MOZ_LIKELY(length() + size <= capacity()))
return appendNewPage(values, size);
return appendNewBuffer(values, size);
}
template<typename T, size_t N, class A, bool P, bool Q, bool G, bool D, size_t I, uint8_t X>
MOZ_NEVER_INLINE void
PageProtectingVector<T, N, A, P, Q, G, D, I, X>::lockSlow() const
{
MOZ_CRASH("Cannot access PageProtectingVector from more than one thread at a time!");
}
class ProtectedReallocPolicy
{
/* We hardcode the page size here to minimize administrative overhead. */
static const size_t pageShift = 12;
static const size_t pageSize = 1 << pageShift;
static const size_t pageMask = pageSize - 1;
public:
template <typename T> T* maybe_pod_malloc(size_t numElems) {
return js_pod_malloc<T>(numElems);
@ -553,35 +464,34 @@ class ProtectedReallocPolicy
}
template <typename T> T* maybe_pod_realloc(T* oldAddr, size_t oldSize, size_t newSize) {
MOZ_ASSERT_IF(oldAddr, oldSize);
MOZ_ASSERT(gc::SystemPageSize() == pageSize);
if (MOZ_UNLIKELY(!newSize))
return nullptr;
if (MOZ_UNLIKELY(!oldAddr))
return js_pod_malloc<T>(newSize);
T* newAddr = nullptr;
size_t initPage = (uintptr_t(oldAddr - 1) >> pageShift) + 1;
size_t lastPage = (uintptr_t(oldAddr + oldSize) >> pageShift) - 1;
size_t toCopy = (newSize >= oldSize ? oldSize : newSize) * sizeof(T);
if (MOZ_UNLIKELY(oldSize >= 32 * 1024 && lastPage >= initPage)) {
T* protectAddr = reinterpret_cast<T*>(initPage << pageShift);
size_t protectSize = (lastPage - initPage + 1) << pageShift;
MemoryProtectionExceptionHandler::addRegion(protectAddr, protectSize);
gc::MakePagesReadOnly(protectAddr, protectSize);
newAddr = js_pod_malloc<T>(newSize);
if (MOZ_LIKELY(newAddr))
memcpy(newAddr, oldAddr, toCopy);
gc::UnprotectPages(protectAddr, protectSize);
MemoryProtectionExceptionHandler::removeRegion(protectAddr);
if (MOZ_LIKELY(newAddr))
js_free(oldAddr);
} else {
newAddr = js_pod_malloc<T>(newSize);
if (MOZ_LIKELY(newAddr)) {
memcpy(newAddr, oldAddr, toCopy);
js_free(oldAddr);
}
T* tmpAddr = js_pod_malloc<T>(newSize);
if (MOZ_UNLIKELY(!tmpAddr))
return js_pod_realloc<T>(oldAddr, oldSize, newSize);
size_t bytes = (newSize >= oldSize ? oldSize : newSize) * sizeof(T);
memcpy(tmpAddr, oldAddr, bytes);
T* newAddr = js_pod_realloc<T>(oldAddr, oldSize, newSize);
if (MOZ_UNLIKELY(!newAddr)) {
js_free(tmpAddr);
return js_pod_realloc<T>(oldAddr, oldSize, newSize);
}
const uint8_t* newAddrBytes = reinterpret_cast<const uint8_t*>(newAddr);
const uint8_t* tmpAddrBytes = reinterpret_cast<const uint8_t*>(tmpAddr);
if (!mozilla::PodEqual(tmpAddrBytes, newAddrBytes, bytes)) {
if (oldAddr == newAddr)
MOZ_CRASH("New buffer doesn't match the old buffer (newAddr == oldAddr)!");
else
MOZ_CRASH("New buffer doesn't match the old buffer (newAddr != oldAddr)!");
}
js_free(tmpAddr);
return newAddr;
}

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

@ -0,0 +1,4 @@
function async() { return 42; } // overwritten by subsequent declaration
export default async // ASI occurs here due to the [no LineTerminator here] restriction on default-exporting an async function
function async() { return 17; }

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

@ -0,0 +1,6 @@
var async = 42;
var x = 3;
var g = 2;
export default async
/x/g;

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

@ -0,0 +1,16 @@
// |jit-test| error: TypeError
var g = newGlobal();
g.parent = this;
g.eval("new Debugger(parent).onExceptionUnwind = function () { };");
function f() {
[[]] = [];
}
try {
f();
} catch (e) {};
try {
f();
} catch (e) {};
f();

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

@ -0,0 +1,7 @@
// |jit-test| module
import v from "export-default-async-asi.js";
assertEq(typeof v, "function");
assertEq(v.name, "async");
assertEq(v(), 17);

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

@ -0,0 +1,5 @@
// |jit-test| module
import v from "export-default-async-regexpy.js";
assertEq(v, 7);

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

@ -487,7 +487,7 @@ GetNextNonLoopEntryPc(jsbytecode* pc)
}
static bool
HasLiveIteratorAtStackDepth(JSScript* script, jsbytecode* pc, uint32_t stackDepth)
HasLiveStackValueAtDepth(JSScript* script, jsbytecode* pc, uint32_t stackDepth)
{
if (!script->hasTrynotes())
return false;
@ -501,14 +501,37 @@ HasLiveIteratorAtStackDepth(JSScript* script, jsbytecode* pc, uint32_t stackDept
if (pcOffset >= tn->start + tn->length)
continue;
// For-in loops have only the iterator on stack.
if (tn->kind == JSTRY_FOR_IN && stackDepth == tn->stackDepth)
return true;
switch (tn->kind) {
case JSTRY_FOR_IN:
// For-in loops have only the iterator on stack.
if (stackDepth == tn->stackDepth)
return true;
break;
// For-of loops have both the iterator and the result object on
// stack. The iterator is below the result object.
if (tn->kind == JSTRY_FOR_OF && stackDepth == tn->stackDepth - 1)
return true;
case JSTRY_FOR_OF:
// For-of loops have both the iterator and the result object on
// stack. The iterator is below the result object.
if (stackDepth == tn->stackDepth - 1)
return true;
break;
case JSTRY_ITERCLOSE:
// Code that need to call IteratorClose have the iterator on the
// stack.
if (stackDepth == tn->stackDepth)
return true;
break;
case JSTRY_DESTRUCTURING_ITERCLOSE:
// Destructuring code that need to call IteratorClose have both
// the iterator and the "done" value on the stack.
if (stackDepth == tn->stackDepth || stackDepth == tn->stackDepth - 1)
return true;
break;
default:
break;
}
}
return false;
@ -943,7 +966,7 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
// iterators, however, so read them out. They will be closed by
// HandleExceptionBaseline.
MOZ_ASSERT(cx->compartment()->isDebuggee());
if (iter.moreFrames() || HasLiveIteratorAtStackDepth(script, pc, i + 1)) {
if (iter.moreFrames() || HasLiveStackValueAtDepth(script, pc, i + 1)) {
v = iter.read();
} else {
iter.skip();

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

@ -993,16 +993,22 @@ jit::EliminateDeadResumePointOperands(MIRGenerator* mir, MIRGraph& graph)
if (mir->shouldCancel("Eliminate Dead Resume Point Operands (main loop)"))
return false;
if (MResumePoint* rp = block->entryResumePoint())
if (MResumePoint* rp = block->entryResumePoint()) {
if (!graph.alloc().ensureBallast())
return false;
EliminateTriviallyDeadResumePointOperands(graph, rp);
}
// The logic below can get confused on infinite loops.
if (block->isLoopHeader() && block->backedge() == *block)
continue;
for (MInstructionIterator ins = block->begin(); ins != block->end(); ins++) {
if (MResumePoint* rp = ins->resumePoint())
if (MResumePoint* rp = ins->resumePoint()) {
if (!graph.alloc().ensureBallast())
return false;
EliminateTriviallyDeadResumePointOperands(graph, rp);
}
// No benefit to replacing constant operands with other constants.
if (ins->isConstant())

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

@ -362,9 +362,8 @@ class Assembler : public AssemblerX86Shared
// This is for patching during code generation, not after.
void patchAddq(CodeOffset offset, int32_t n) {
unsigned char* code = masm.acquireData();
unsigned char* code = masm.data();
X86Encoding::SetInt32(code + offset.offset(), n);
masm.releaseData();
}
// Load an ImmWord value into a register. Note that this instruction will

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

@ -97,9 +97,8 @@ AssemblerX86Shared::trace(JSTracer* trc)
}
if (dataRelocations_.length()) {
CompactBufferReader reader(dataRelocations_);
unsigned char* code = masm.acquireData();
unsigned char* code = masm.data();
::TraceDataRelocations(trc, code, reader);
masm.releaseData();
}
}
@ -263,9 +262,8 @@ AssemblerX86Shared::verifyHeapAccessDisassembly(uint32_t begin, uint32_t end,
#ifdef DEBUG
if (masm.oom())
return;
unsigned char* code = masm.acquireData();
unsigned char* code = masm.data();
Disassembler::VerifyHeapAccess(code + begin, code + end, heapAccess);
masm.releaseData();
#endif
}

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

@ -1073,17 +1073,15 @@ class AssemblerX86Shared : public AssemblerShared
}
void patchCall(uint32_t callerOffset, uint32_t calleeOffset) {
unsigned char* code = masm.acquireData();
unsigned char* code = masm.data();
X86Encoding::SetRel32(code + callerOffset, code + calleeOffset);
masm.releaseData();
}
CodeOffset farJumpWithPatch() {
return CodeOffset(masm.jmp().offset());
}
void patchFarJump(CodeOffset farJump, uint32_t targetOffset) {
unsigned char* code = masm.acquireData();
unsigned char* code = masm.data();
X86Encoding::SetRel32(code + farJump.offset(), code + targetOffset);
masm.releaseData();
}
static void repatchFarJump(uint8_t* code, uint32_t farJumpOffset, uint32_t targetOffset) {
X86Encoding::SetRel32(code + farJumpOffset, code + targetOffset);
@ -1091,9 +1089,8 @@ class AssemblerX86Shared : public AssemblerShared
// This is for patching during code generation, not after.
void patchAddl(CodeOffset offset, int32_t n) {
unsigned char* code = masm.acquireData();
unsigned char* code = masm.data();
X86Encoding::SetInt32(code + offset.offset(), n);
masm.releaseData();
}
CodeOffset twoByteNop() {

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

@ -126,15 +126,18 @@ namespace jit {
return m_oom;
}
#ifndef RELEASE_OR_BETA
const unsigned char* acquireBuffer() const
const unsigned char* buffer() const
{
MOZ_RELEASE_ASSERT(!m_oom);
return m_buffer.acquire();
return m_buffer.begin();
}
void releaseBuffer() const { m_buffer.release(); }
unsigned char* acquireData() { return m_buffer.acquire(); }
void releaseData() const { m_buffer.release(); }
unsigned char* data()
{
return m_buffer.begin();
}
#ifndef RELEASE_OR_BETA
void disableProtection() { m_buffer.disableProtection(); }
void enableProtection() { m_buffer.enableProtection(); }
void setLowerBoundForProtection(size_t size)
@ -150,14 +153,6 @@ namespace jit {
m_buffer.reprotectRegion(first, size);
}
#else
const unsigned char* acquireBuffer() const
{
MOZ_RELEASE_ASSERT(!m_oom);
return m_buffer.begin();
}
void releaseBuffer() const {}
unsigned char* acquireData() { return m_buffer.begin(); }
void releaseData() const {}
void disableProtection() {}
void enableProtection() {}
void setLowerBoundForProtection(size_t) {}
@ -180,16 +175,15 @@ namespace jit {
*
* See also the |buffer| method.
*/
void oomDetected() {
void oomDetected()
{
m_oom = true;
m_buffer.clear();
}
#ifndef RELEASE_OR_BETA
PageProtectingVector<unsigned char, 256, ProtectedReallocPolicy,
/* ProtectUsed = */ false, /* ProtectUnused = */ false,
/* GuardAgainstReentrancy = */ true, /* DetectPoison = */ true,
/* InitialLowerBound = */ 32 * 1024> m_buffer;
/* ProtectUsed = */ false, /* ProtectUnused = */ false> m_buffer;
#else
mozilla::Vector<unsigned char, 256, SystemAllocPolicy> m_buffer;
#endif
@ -202,11 +196,10 @@ namespace jit {
public:
GenericAssembler()
: printer(NULL)
{}
GenericAssembler() : printer(nullptr) {}
void setPrinter(Sprinter* sp) {
void setPrinter(Sprinter* sp)
{
printer = sp;
}

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

@ -54,10 +54,8 @@ public:
void disableVEX() { useVEX_ = false; }
size_t size() const { return m_formatter.size(); }
const unsigned char* acquireBuffer() const { return m_formatter.acquireBuffer(); }
void releaseBuffer() const { m_formatter.releaseBuffer(); }
unsigned char* acquireData() { return m_formatter.acquireData(); }
void releaseData() const { m_formatter.releaseData(); }
const unsigned char* buffer() const { return m_formatter.buffer(); }
unsigned char* data() { return m_formatter.data(); }
bool oom() const { return m_formatter.oom(); }
void disableProtection() { m_formatter.disableProtection(); }
@ -3814,9 +3812,8 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off
assertValidJmpSrc(from);
const unsigned char* code = m_formatter.acquireData();
const unsigned char* code = m_formatter.data();
int32_t offset = GetInt32(code + from.offset());
m_formatter.releaseData();
if (offset == -1)
return false;
@ -3859,9 +3856,8 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off
assertValidJmpSrc(from);
MOZ_RELEASE_ASSERT(to.offset() == -1 || size_t(to.offset()) <= size());
unsigned char* code = m_formatter.acquireData();
unsigned char* code = m_formatter.data();
SetInt32(code + from.offset(), to.offset());
m_formatter.releaseData();
}
void linkJump(JmpSrc from, JmpDst to)
@ -3878,22 +3874,19 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off
MOZ_RELEASE_ASSERT(size_t(to.offset()) <= size());
spew(".set .Lfrom%d, .Llabel%d", from.offset(), to.offset());
unsigned char* code = m_formatter.acquireData();
unsigned char* code = m_formatter.data();
SetRel32(code + from.offset(), code + to.offset());
m_formatter.releaseData();
}
void executableCopy(void* dst)
{
const unsigned char* src = m_formatter.acquireBuffer();
const unsigned char* src = m_formatter.buffer();
memcpy(dst, src, size());
m_formatter.releaseBuffer();
}
MOZ_MUST_USE bool appendBuffer(const BaseAssembler& other)
{
const unsigned char* buf = other.m_formatter.acquireBuffer();
const unsigned char* buf = other.m_formatter.buffer();
bool ret = m_formatter.append(buf, other.size());
other.m_formatter.releaseBuffer();
return ret;
}
@ -5158,10 +5151,8 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off
// Administrative methods:
size_t size() const { return m_buffer.size(); }
const unsigned char* acquireBuffer() const { return m_buffer.acquireBuffer(); }
void releaseBuffer() const { m_buffer.releaseBuffer(); }
unsigned char* acquireData() { return m_buffer.acquireData(); }
void releaseData() const { m_buffer.releaseData(); }
const unsigned char* buffer() const { return m_buffer.buffer(); }
unsigned char* data() { return m_buffer.data(); }
bool oom() const { return m_buffer.oom(); }
bool isAligned(int alignment) const { return m_buffer.isAligned(alignment); }

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

@ -7672,3 +7672,28 @@ js::gc::Cell::dump() const
dump(stderr);
}
#endif
JS_PUBLIC_API(bool)
js::gc::detail::CellIsMarkedGrayIfKnown(const Cell* cell)
{
MOZ_ASSERT(cell);
if (!cell->isTenured())
return false;
// We ignore the gray marking state of cells and return false in two cases:
//
// 1) When OOM has caused us to clear the gcGrayBitsValid_ flag.
//
// 2) When we are in an incremental GC and examine a cell that is in a zone
// that is not being collected. Gray targets of CCWs that are marked black
// by a barrier will eventually be marked black in the next GC slice.
auto tc = &cell->asTenured();
auto rt = tc->runtimeFromMainThread();
if (!rt->areGCGrayBitsValid() ||
(rt->gc.isIncrementalGCInProgress() && !tc->zone()->wasGCStarted()))
{
return false;
}
return detail::CellIsMarkedGray(tc);
}

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

@ -67,8 +67,8 @@ fuzzy-if(true,1,33) fuzzy-if(d2d,48,350) fuzzy-if(cocoaWidget,1,332) fuzzy-if(An
== table-collapse-1.html table-collapse-1-ref.html # border-radius is ignored on internal table elements
# when border-collapse: collapse
fuzzy-if(azureQuartz,1,3) fuzzy-if(skiaContent,1,116) == invalidate-1a.html invalidate-1-ref.html
fuzzy-if(azureQuartz,1,3) fuzzy-if(skiaContent,1,117) == invalidate-1b.html invalidate-1-ref.html
fuzzy-if(skiaContent,1,116) == invalidate-1a.html invalidate-1-ref.html
fuzzy-if(skiaContent,1,117) == invalidate-1b.html invalidate-1-ref.html
# test that border-radius is reduced for scrollbars
fails-if(Android) fuzzy-if(asyncPan&&!layersGPUAccelerated,12,12) fuzzy-if(browserIsRemote&&layersGPUAccelerated&&/^Windows\x20NT\x206\.1/.test(http.oscpu),12,12) fuzzy-if(skiaContent&&!Android,1,50) fuzzy-if(gtkWidget&&layersGPUAccelerated,12,12) == scrollbar-clamping-1.html scrollbar-clamping-1-ref.html

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

@ -1748,8 +1748,8 @@ fuzzy-if(true,17,5886) == 759036-2.html 759036-2-ref.html
== 786254-1.html 786254-1-ref.html
== 787947-1.html 787947-1-ref.html
== 796847-1.svg 796847-1-ref.svg
fuzzy(40,875) fuzzy-if(azureQuartz,73,542) fuzzy-if(skiaContent,1,2500) == 797797-1.html 797797-1-ref.html # 'opacity:N' and rgba(,,,N) text don't match precisely
fuzzy(40,850) fuzzy-if(azureQuartz,68,586) fuzzy-if(skiaContent,2,2310) == 797797-2.html 797797-2-ref.html # 'opacity:N' and rgba(,,,N) text don't match precisely
fuzzy(40,875) fuzzy-if(skiaContent,1,2500) == 797797-1.html 797797-1-ref.html # 'opacity:N' and rgba(,,,N) text don't match precisely
fuzzy(40,850) fuzzy-if(skiaContent,2,2310) == 797797-2.html 797797-2-ref.html # 'opacity:N' and rgba(,,,N) text don't match precisely
== 801994-1.html 801994-1-ref.html
== 804323-1.html 804323-1-ref.html
fuzzy-if(Android,8,608) == 811301-1.html 811301-1-ref.html

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

@ -63,10 +63,10 @@ random != text-emoji.html text-emoji-notref.html
# azure quartz uses CGDrawLinearGradient instead of DrawShading
# so we have less control over degenerate behaviour as tested by this
# test
fails-if((azureSkia&&!azureSkiaGL)||azureQuartz||(azureSkiaGL&&Android)) == linear-gradient-1a.html linear-gradient-1-ref.html
fails-if((azureSkia&&!azureSkiaGL)||(azureSkiaGL&&Android)) == linear-gradient-1a.html linear-gradient-1-ref.html
# this passes with cairo on 10.7 and 10.8 but not with azure for reasons unknown
fails-if((azureSkia&&!azureSkiaGL)||azureQuartz||(azureSkiaGL&&Android)) == linear-gradient-1b.html linear-gradient-1-ref.html
fails-if((azureSkia&&!azureSkiaGL)||(azureSkiaGL&&Android)) == linear-gradient-1b.html linear-gradient-1-ref.html
== zero-dimensions.html zero-dimensions-ref.html
@ -94,7 +94,7 @@ fuzzy-if(azureSkia,1,15) fuzzy-if(skiaContent,1,20) == transformed-gradient.html
== 749467-1.html 749467-1-ref.html
# You get a little bit of rounding fuzz on OSX from transforming the paths between user space and device space
fuzzy-if(azureQuartz,2,128) fuzzy-if(d2d,12,21) fuzzy-if(skiaContent,12,7) fuzzy-if(d2d&&/^Windows\x20NT\x2010\.0/.test(http.oscpu),2,141) == 784573-1.html 784573-1-ref.html
fuzzy-if(d2d,12,21) fuzzy-if(skiaContent,12,7) fuzzy-if(d2d&&/^Windows\x20NT\x2010\.0/.test(http.oscpu),2,141) == 784573-1.html 784573-1-ref.html
== 802658-1.html 802658-1-ref.html
== 1074733-1.html 1074733-1-ref.html

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

@ -7,11 +7,11 @@ pref(layout.css.mix-blend-mode.enabled,true) == blend-difference-stacking.html b
fuzzy-if(skiaContent,1,30000) pref(layout.css.background-blend-mode.enabled,true) == background-blending-alpha.html background-blending-alpha-ref.html
pref(layout.css.background-blend-mode.enabled,true) == background-blending-gradient-color.html background-blending-gradient-color-ref.html
fuzzy-if(azureSkiaGL,3,7597) fuzzy-if(cocoaWidget,3,7597) fuzzy-if(d2d,1,3800) fuzzy-if(d3d11,1,4200) fuzzy-if(skiaContent,2,9450) pref(layout.css.background-blend-mode.enabled,true) == background-blending-gradient-gradient.html background-blending-gradient-gradient-ref.html
fuzzy-if(azureSkiaGL,2,7174) fuzzy-if(azureQuartz,2,7174) pref(layout.css.background-blend-mode.enabled,true) == background-blending-gradient-image.html background-blending-gradient-color-ref.html
fuzzy-if(azureQuartz,2,10000) fuzzy-if(azureSkia||d2d||gtkWidget,1,10000) pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-color-jpg.html background-blending-image-color-ref.html
fuzzy-if(azureSkiaGL,2,7174) pref(layout.css.background-blend-mode.enabled,true) == background-blending-gradient-image.html background-blending-gradient-color-ref.html
fuzzy-if(azureSkia||d2d||gtkWidget,1,10000) pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-color-jpg.html background-blending-image-color-ref.html
pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-color-png.html background-blending-image-color-ref.html
pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-color-svg.html background-blending-image-color-ref.html
fuzzy-if(azureSkiaGL,2,7174) fuzzy-if(azureQuartz,2,7174) pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-gradient.html background-blending-gradient-color-ref.html
fuzzy-if(azureSkiaGL,2,7174) pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-gradient.html background-blending-gradient-color-ref.html
pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-image.html background-blending-image-color-ref.html
pref(layout.css.background-blend-mode.enabled,true) == background-blending-isolation.html background-blending-isolation-ref.html
pref(layout.css.background-blend-mode.enabled,true) == background-blending-list-repeat.html background-blending-list-repeat-ref.html
@ -20,22 +20,22 @@ pref(layout.css.background-blend-mode.enabled,true) == background-blending-multi
pref(layout.css.background-blend-mode.enabled,true) == background-blending-color-burn.html background-blending-color-burn-ref.svg
pref(layout.css.background-blend-mode.enabled,true) == background-blending-color-dodge.html background-blending-color-dodge-ref.svg
# need to investigate why these tests are fuzzy - first suspect is a possible color space conversion on some platforms; same for mix-blend-mode tests
fuzzy-if(azureQuartz,2,8000) fuzzy-if(azureSkia||gtkWidget,2,9600) fuzzy-if(d2d,1,8000) pref(layout.css.background-blend-mode.enabled,true) == background-blending-color.html background-blending-color-ref.svg
fuzzy-if(azureSkia||gtkWidget,2,9600) fuzzy-if(d2d,1,8000) pref(layout.css.background-blend-mode.enabled,true) == background-blending-color.html background-blending-color-ref.svg
pref(layout.css.background-blend-mode.enabled,true) == background-blending-darken.html background-blending-darken-ref.svg
pref(layout.css.background-blend-mode.enabled,true) == background-blending-difference.html background-blending-difference-ref.svg
fuzzy-if(skiaContent,1,1600) pref(layout.css.background-blend-mode.enabled,true) == background-blending-exclusion.html background-blending-exclusion-ref.svg
fuzzy-if(cocoaWidget||d2d,1,1600) pref(layout.css.background-blend-mode.enabled,true) == background-blending-hard-light.html background-blending-hard-light-ref.svg
fuzzy-if(azureQuartz,2,8000) fuzzy-if(d2d,1,9600) fuzzy-if(azureSkia||gtkWidget,2,9600) pref(layout.css.background-blend-mode.enabled,true) == background-blending-hue.html background-blending-hue-ref.svg
fuzzy-if(d2d,1,9600) fuzzy-if(azureSkia||gtkWidget,2,9600) pref(layout.css.background-blend-mode.enabled,true) == background-blending-hue.html background-blending-hue-ref.svg
pref(layout.css.background-blend-mode.enabled,true) == background-blending-lighten.html background-blending-lighten-ref.svg
fuzzy-if(azureQuartz,2,8000) fuzzy-if(d2d,1,8000) fuzzy-if(azureSkia||gtkWidget,2,9600) pref(layout.css.background-blend-mode.enabled,true) == background-blending-luminosity.html background-blending-luminosity-ref.svg
fuzzy-if(d2d,1,8000) fuzzy-if(azureSkia||gtkWidget,2,9600) pref(layout.css.background-blend-mode.enabled,true) == background-blending-luminosity.html background-blending-luminosity-ref.svg
pref(layout.css.background-blend-mode.enabled,true) == background-blending-multiply.html background-blending-multiply-ref.svg
pref(layout.css.background-blend-mode.enabled,true) == background-blending-normal.html background-blending-normal-ref.svg
fuzzy-if(azureSkia||gtkWidget,1,1600) pref(layout.css.background-blend-mode.enabled,true) == background-blending-overlay.html background-blending-overlay-ref.svg
fuzzy-if(d2d,1,1600) fuzzy-if(azureSkia||gtkWidget,2,12800) pref(layout.css.background-blend-mode.enabled,true) == background-blending-saturation.html background-blending-saturation-ref.svg
fuzzy-if(d2d||azureSkia||gtkWidget,1,1600) pref(layout.css.background-blend-mode.enabled,true) == background-blending-screen.html background-blending-screen-ref.svg
fuzzy-if(azureQuartz,1,1600) fuzzy-if(d2d||azureSkia||gtkWidget,10,4800) pref(layout.css.background-blend-mode.enabled,true) == background-blending-soft-light.html background-blending-soft-light-ref.svg
fuzzy-if(d2d||azureSkia||gtkWidget,10,4800) pref(layout.css.background-blend-mode.enabled,true) == background-blending-soft-light.html background-blending-soft-light-ref.svg
fuzzy-if(azureQuartz,2,40000) fuzzy-if(azureSkia||d2d||gtkWidget,1,40000) pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-color-959674.html background-blending-image-color-959674-ref.html
fuzzy-if(azureSkia||d2d||gtkWidget,1,40000) pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-color-959674.html background-blending-image-color-959674-ref.html
#fuzzy due to inconsistencies in rounded rect cliping between parent and child; may be related to antialiasing. Between platforms, the max difference is the same, and the number of different pixels is either 36 or 37. (Win, Mac and Lin)
fuzzy(64,53) pref(layout.css.mix-blend-mode.enabled,true) == mix-blend-mode-952051.html mix-blend-mode-952051-ref.html

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

@ -1,9 +1,9 @@
fuzzy-if(!contentSameGfxBackendAsCanvas,4,88500) fuzzy-if(azureSkiaGL||skiaContent,4,89700) fuzzy-if(azureQuartz,1,34792) == linear-1a.html linear-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,4,88500) fuzzy-if(azureSkiaGL||skiaContent,4,89700) fuzzy-if(azureQuartz,1,34792) == linear-1b.html linear-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,2,88500) fuzzy-if(azureSkiaGL,2,89997) fuzzy-if(azureQuartz,1,11469) fuzzy-if(skiaContent,1,16000) == linear-keywords-1a.html linear-keywords-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,2,88500) fuzzy-if(azureSkiaGL,2,89997) fuzzy-if(azureQuartz,1,11985) fuzzy-if(skiaContent,1,16000) == linear-keywords-1b.html linear-keywords-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,2,88500) fuzzy-if(azureQuartz,1,10230) fuzzy-if(skiaContent,1,18000) == linear-percent.html linear-percent-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,4,92400) fuzzy-if(azureSkiaGL||skiaContent,3,143400) fuzzy-if(azureQuartz,1,27827) fuzzy-if(Android,4,93000) == linear-mix.html linear-mix-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,4,88500) fuzzy-if(azureSkiaGL||skiaContent,4,89700) == linear-1a.html linear-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,4,88500) fuzzy-if(azureSkiaGL||skiaContent,4,89700) == linear-1b.html linear-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,2,88500) fuzzy-if(azureSkiaGL,2,89997) fuzzy-if(skiaContent,1,16000) == linear-keywords-1a.html linear-keywords-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,2,88500) fuzzy-if(azureSkiaGL,2,89997) fuzzy-if(skiaContent,1,16000) == linear-keywords-1b.html linear-keywords-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,2,88500) fuzzy-if(skiaContent,1,18000) == linear-percent.html linear-percent-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,4,92400) fuzzy-if(azureSkiaGL||skiaContent,3,143400) fuzzy-if(Android,4,93000) == linear-mix.html linear-mix-ref.html
== linear-diagonal-1a.html linear-diagonal-1-ref.html
== linear-diagonal-1b.html linear-diagonal-1-ref.html
== linear-diagonal-1c.html linear-diagonal-1-ref.html
@ -45,11 +45,11 @@ fuzzy-if(winWidget,1,36000) fuzzy-if(skiaContent,1,45000) == linear-size-1a.html
== linear-stops-1d.html linear-stops-1-ref.html
== linear-stops-1e.html linear-stops-1-ref.html
== linear-stops-1f.html linear-stops-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,3,88500) fuzzy-if(azureSkiaGL||skiaContent,3,89700) fuzzy-if(azureQuartz,1,22367) == linear-vertical-1a.html linear-vertical-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,3,88500) fuzzy-if(azureSkiaGL||skiaContent,3,89700) fuzzy-if(azureQuartz,1,22367) == linear-vertical-1b.html linear-vertical-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,3,88500) fuzzy-if(azureSkiaGL||skiaContent,3,89700) fuzzy-if(azureQuartz,2,26777) == linear-vertical-1c.html linear-vertical-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,3,88500) fuzzy-if(azureSkiaGL||skiaContent,3,89700) fuzzy-if(azureQuartz,2,26777) == linear-vertical-1d.html linear-vertical-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,3,88500) fuzzy-if(azureSkiaGL||skiaContent,3,89700) fuzzy-if(azureQuartz,1,22367) == linear-vertical-1e.html linear-vertical-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,3,88500) fuzzy-if(azureSkiaGL||skiaContent,3,89700) == linear-vertical-1a.html linear-vertical-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,3,88500) fuzzy-if(azureSkiaGL||skiaContent,3,89700) == linear-vertical-1b.html linear-vertical-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,3,88500) fuzzy-if(azureSkiaGL||skiaContent,3,89700) == linear-vertical-1c.html linear-vertical-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,3,88500) fuzzy-if(azureSkiaGL||skiaContent,3,89700) == linear-vertical-1d.html linear-vertical-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,3,88500) fuzzy-if(azureSkiaGL||skiaContent,3,89700) == linear-vertical-1e.html linear-vertical-1-ref.html
== linear-vertical-subpixel-1.html linear-vertical-subpixel-1-ref.html
== linear-viewport.html linear-viewport-ref.html
fails-if(OSX==1010&&!skiaContent) fuzzy-if(Android,4,248) == linear-zero-length-1a.html linear-zero-length-1-ref.html
@ -70,7 +70,7 @@ fuzzy(3,7860) fuzzy-if(cocoaWidget,5,89041) fuzzy-if(azureSkiaGL,4,90000) == rad
fuzzy-if(cocoaWidget,1,28) fuzzy-if(winWidget,1,18) fuzzy-if(skiaContent,1,50) == radial-position-1b.html radial-position-1-ref.html
fuzzy-if(cocoaWidget,4,22317) fuzzy-if(Android,8,771) == radial-shape-closest-corner-1a.html radial-shape-closest-corner-1-ref.html
fuzzy(1,238) fuzzy-if(cocoaWidget,4,22608) fuzzy-if((/^Windows\x20NT\x2010\.0/.test(http.oscpu)||/^Windows\x20NT\x206\./.test(http.oscpu))&&d2d,1,336) fuzzy-if(Android,8,787) fuzzy-if(skiaContent,2,300) == radial-shape-closest-corner-1b.html radial-shape-closest-corner-1-ref.html
fuzzy-if(azureQuartz,2,41171) fuzzy-if(Android,8,771) == radial-shape-closest-corner-1c.html radial-shape-closest-corner-1-ref.html
fuzzy-if(Android,8,771) == radial-shape-closest-corner-1c.html radial-shape-closest-corner-1-ref.html
fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)||/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) fuzzy-if(Android,17,3880) == radial-shape-closest-side-1a.html radial-shape-closest-side-1-ref.html
fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)||/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) fuzzy-if(Android,17,3880) == radial-shape-closest-side-1b.html radial-shape-closest-side-1-ref.html
fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)||/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) fuzzy-if(Android,17,3880) == radial-shape-closest-side-1c.html radial-shape-closest-side-1-ref.html
@ -125,12 +125,12 @@ fuzzy-if(!contentSameGfxBackendAsCanvas,2,20000) fuzzy-if(azureSkiaGL||skiaConte
fuzzy-if(!contentSameGfxBackendAsCanvas,2,20000) fuzzy-if(azureSkiaGL||skiaContent,8,20000) == aja-linear-2b.html aja-linear-2-ref.html
fails == aja-linear-2c.html aja-linear-2-ref.html # bug 522607
fails-if(!d2d&&!(skiaContent&&winWidget)) fuzzy-if(skiaContent&&!winWidget,1,200) == aja-linear-2d.html aja-linear-2-ref.html # bug 526694
fuzzy-if(!contentSameGfxBackendAsCanvas,2,19999) fuzzy-if(azureSkiaGL||skiaContent,8,20000) fuzzy-if(azureQuartz,1,10553) == aja-linear-3a.html aja-linear-3-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,2,19999) fuzzy-if(azureSkiaGL||skiaContent,8,20000) fuzzy-if(azureQuartz,1,10553) == aja-linear-3b.html aja-linear-3-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,2,19999) fuzzy-if(azureSkiaGL||skiaContent,8,20000) == aja-linear-3a.html aja-linear-3-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,2,19999) fuzzy-if(azureSkiaGL||skiaContent,8,20000) == aja-linear-3b.html aja-linear-3-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,4,20000) fuzzy-if(azureSkiaGL||skiaContent,8,20000) == aja-linear-4a.html aja-linear-4-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,4,20000) fuzzy-if(azureSkiaGL||skiaContent,8,20000) == aja-linear-4b.html aja-linear-4-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,4,20000) fuzzy-if(azureSkiaGL||skiaContent,8,20000) == aja-linear-5a.html aja-linear-5-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,2,16500) fuzzy-if(azureSkiaGL||skiaContent,8,20000) fuzzy-if(azureQuartz,2,10163) == aja-linear-6a.html aja-linear-6-ref.html # bug 526708
fuzzy-if(!contentSameGfxBackendAsCanvas,2,16500) fuzzy-if(azureSkiaGL||skiaContent,8,20000) == aja-linear-6a.html aja-linear-6-ref.html # bug 526708
fails == aja-linear-6b.html aja-linear-6-ref.html # bug 522607
fuzzy-if(Android,6,10576) == height-dependence-1.html height-dependence-1-ref.html
fuzzy-if(cocoaWidget,1,40000) fuzzy-if(Android,6,10576) == height-dependence-2.html height-dependence-2-ref.html

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

@ -32,7 +32,7 @@ include svg-integration/reftest.list
== clip-02a.svg clip-02-ref.svg
== clip-02b.svg clip-02-ref.svg
== clipPath-advanced-01.svg pass.svg
fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)||/^Windows\x20NT\x206\.[12]/.test(http.oscpu),1,5) fuzzy-if(azureQuartz,1,6) fuzzy-if(OSX,1,6) fuzzy-if(skiaContent,1,630) == clipPath-and-shape-rendering-01.svg clipPath-and-shape-rendering-01-ref.svg # bug 614840
fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)||/^Windows\x20NT\x206\.[12]/.test(http.oscpu),1,5) fuzzy-if(OSX,1,6) fuzzy-if(skiaContent,1,630) == clipPath-and-shape-rendering-01.svg clipPath-and-shape-rendering-01-ref.svg # bug 614840
== clipPath-and-transform-01.svg pass.svg
== clipPath-basic-01.svg pass.svg
== clipPath-basic-02.svg pass.svg

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

@ -167,7 +167,7 @@ fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)||/^Windows\x20NT\x206\.[12]/
== dynamic-font-size-4.svg dynamic-font-size-4-ref.svg
== dynamic-dominant-baseline.svg dynamic-dominant-baseline-ref.svg
== dynamic-multiple-x.svg dynamic-multiple-x-ref.svg
fuzzy-if(!d2d,14,2) fuzzy-if(azureQuartz,1,6) fuzzy-if(skiaContent,1,200) == dynamic-non-scaling-stroke.svg dynamic-non-scaling-stroke-ref.svg #Bug 885316
fuzzy-if(!d2d,14,2) fuzzy-if(skiaContent,1,200) == dynamic-non-scaling-stroke.svg dynamic-non-scaling-stroke-ref.svg #Bug 885316
== dynamic-text-shadow.svg text-shadow-ref.svg
# text and masks

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

@ -945,7 +945,13 @@ Gecko_EnsureStyleAnimationArrayLength(void* aArray, size_t aLen)
auto base =
reinterpret_cast<nsStyleAutoArray<StyleAnimation>*>(aArray);
size_t oldLength = base->Length();
base->EnsureLengthAtLeast(aLen);
for (size_t i = oldLength; i < aLen; ++i) {
(*base)[i].SetInitialValues();
}
}
Keyframe*

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

@ -98,7 +98,7 @@ load 827591-1.html
load 829817.html
load 840898.html
load 842134.html
skip-if(stylo) load 861489-1.html # bug 1334982
load 861489-1.html
load 862113.html
asserts-if(stylo,5) load 867487.html # bug 1324634
load 873222.html
@ -137,7 +137,7 @@ load 1227501-1.html
skip-if(stylo) load 1230408-1.html # bug 1323716
skip-if(stylo) load 1233135-1.html # bug 1323716
skip-if(stylo) load 1233135-2.html # bug 1323716
skip-if(stylo) load 1238660-1.html # bug 1334982
load 1238660-1.html
load 1245260-1.html
load 1247865-1.html
asserts-if(stylo,0-1) load 1264396-1.html # bug 1324677
@ -166,6 +166,6 @@ load 1315894-1.html
skip-if(stylo) load 1319072-1.html # bug 1323733
HTTP load 1320423-1.html
asserts-if(stylo,5-28) load 1321357-1.html # bug 1324669
skip-if(stylo) load 1328535-1.html # bug 1334982
load 1328535-1.html
load 1331272.html
asserts-if(stylo,4) HTTP load 1333001-1.html

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

@ -664,7 +664,6 @@ function BuildConditionSandbox(aURL) {
sandbox.gpuProcess = gfxInfo.usingGPUProcess;
sandbox.azureCairo = canvasBackend == "cairo";
sandbox.azureQuartz = canvasBackend == "quartz";
sandbox.azureSkia = canvasBackend == "skia";
sandbox.skiaContent = contentBackend == "skia";
sandbox.azureSkiaGL = canvasAccelerated; // FIXME: assumes GL right now

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

@ -1598,14 +1598,20 @@ WebrtcVideoConduit::ReconfigureSendCodec(unsigned short width,
static_cast<unsigned int>(video_stream.height), mSendingFramerate,
video_stream.min_bitrate_bps, video_stream.max_bitrate_bps);
});
if (!mSendStream->ReconfigureVideoEncoder(mEncoderConfig.GenerateConfig())) {
CSFLogError(logTag, "%s: ReconfigureVideoEncoder failed", __FUNCTION__);
return NS_ERROR_FAILURE;
}
if (frame) {
// XXX I really don't like doing this from MainThread...
mSendStream->Input()->IncomingCapturedFrame(*frame);
CSFLogDebug(logTag, "%s Inserted a frame from reconfig lambda", __FUNCTION__);
// Test in case the stream hasn't started yet! We could get a frame in
// before we get around to StartTransmitting(), and that would dispatch a
// runnable to call this.
if (mSendStream) {
if (!mSendStream->ReconfigureVideoEncoder(mEncoderConfig.GenerateConfig())) {
CSFLogError(logTag, "%s: ReconfigureVideoEncoder failed", __FUNCTION__);
return NS_ERROR_FAILURE;
}
if (frame) {
// XXX I really don't like doing this from MainThread...
mSendStream->Input()->IncomingCapturedFrame(*frame);
CSFLogDebug(logTag, "%s Inserted a frame from reconfig lambda", __FUNCTION__);
}
}
return NS_OK;
}
@ -1690,7 +1696,9 @@ WebrtcVideoConduit::SendVideoFrame(webrtc::VideoFrame& frame)
}
}
mSendStream->Input()->IncomingCapturedFrame(frame);
if (mSendStream) { // can happen before StartTransmitting()
mSendStream->Input()->IncomingCapturedFrame(frame);
}
}
mSendStreamStats.SentFrame();

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

@ -7,5 +7,5 @@ MFBT uses standard Mozilla style, with the following exceptions.
codebase. However, new files should follow standard Mozilla style and use an
upper-case letter at the start of function names.
- Imported third-party code (such as decimal/*, double-conversion/*, and lz4*)
remains in its original style.
- Imported third-party code (such as decimal/*, double-conversion/source/*, and
lz4*) remains in its original style.

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

@ -10,7 +10,7 @@
// of Decimal.cpp under the Mozilla source without blink core dependencies. Do
// not include it into any file other than Decimal.cpp.
#include "../double-conversion/double-conversion.h"
#include "../double-conversion/source/double-conversion.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Casting.h"
#include "mozilla/FloatingPoint.h"

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

@ -0,0 +1,9 @@
commit d8d4e668ee1e6e10b728f0671a89b07d7c4d45be
Merge: 79fb300 48b5e70
Author: Florian Loitsch <florian@loitsch.com>
Date: Wed Nov 23 19:14:38 2016 +0100
Merge pull request #39 from uburuntu/master
Some small fixes: compilation, null ptr derefence and const qualifiers

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

@ -1,11 +0,0 @@
http://code.google.com/p/double-conversion
This project (double-conversion) provides binary-decimal and decimal-binary
routines for IEEE doubles.
The library consists of efficient conversion routines that have been extracted
from the V8 JavaScript engine. The code has been refactored and improved so that
it can be used more easily in other projects.
There is extensive documentation in src/double-conversion.h. Other examples can
be found in test/cctest/test-conversions.cc.

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

@ -1,8 +1,8 @@
1e7bf0c636b8cca54dd83456a0f8fa219343e2a1 Bug 608195 - part 2 - extend ToPrecision to tell use whether exponential notation was used
diff --git a/mfbt/double-conversion/double-conversion.cc b/mfbt/double-conversion/double-conversion.cc
diff --git a/mfbt/double-conversion/source/double-conversion.cc b/mfbt/double-conversion/source/double-conversion.cc
index febba6c..394b6a0 100644
--- a/mfbt/double-conversion/double-conversion.cc
+++ b/mfbt/double-conversion/double-conversion.cc
--- a/mfbt/double-conversion/source/double-conversion.cc
+++ b/mfbt/double-conversion/source/double-conversion.cc
@@ -283,7 +283,9 @@ bool DoubleToStringConverter::ToExponential(
bool DoubleToStringConverter::ToPrecision(double value,
@ -21,10 +21,10 @@ index febba6c..394b6a0 100644
CreateExponentialRepresentation(decimal_rep,
precision,
exponent,
diff --git a/mfbt/double-conversion/double-conversion.h b/mfbt/double-conversion/double-conversion.h
diff --git a/mfbt/double-conversion/source/double-conversion.h b/mfbt/double-conversion/source/double-conversion.h
index 0900ba0..957575c 100644
--- a/mfbt/double-conversion/double-conversion.h
+++ b/mfbt/double-conversion/double-conversion.h
--- a/mfbt/double-conversion/source/double-conversion.h
+++ b/mfbt/double-conversion/source/double-conversion.h
@@ -270,6 +270,7 @@ class DoubleToStringConverter {
// exponent character, the exponent's sign, and at most 3 exponent digits).
MFBT_API bool ToPrecision(double value,

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

@ -1,7 +1,7 @@
diff --git a/mfbt/double-conversion/double-conversion.h b/mfbt/double-conversion/double-conversion.h
diff --git a/mfbt/double-conversion/source/double-conversion.h b/mfbt/double-conversion/source/double-conversion.h
index f98edae..c62b16b 100644
--- a/mfbt/double-conversion/double-conversion.h
+++ b/mfbt/double-conversion/double-conversion.h
--- a/mfbt/double-conversion/source/double-conversion.h
+++ b/mfbt/double-conversion/source/double-conversion.h
@@ -28,6 +28,7 @@
#ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
#define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_

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

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

@ -0,0 +1,54 @@
https://github.com/google/double-conversion
This project (double-conversion) provides binary-decimal and decimal-binary
routines for IEEE doubles.
The library consists of efficient conversion routines that have been extracted
from the V8 JavaScript engine. The code has been refactored and improved so that
it can be used more easily in other projects.
There is extensive documentation in `double-conversion/double-conversion.h`. Other
examples can be found in `test/cctest/test-conversions.cc`.
Building
========
This library can be built with [scons][0] or [cmake][1].
The checked-in Makefile simply forwards to scons, and provides a
shortcut to run all tests:
make
make test
Scons
-----
The easiest way to install this library is to use `scons`. It builds
the static and shared library, and is set up to install those at the
correct locations:
scons install
Use the `DESTDIR` option to change the target directory:
scons DESTDIR=alternative_directory install
Cmake
-----
To use cmake run `cmake .` in the root directory. This overwrites the
existing Makefile.
Use `-DBUILD_SHARED_LIBS=ON` to enable the compilation of shared libraries.
Note that this disables static libraries. There is currently no way to
build both libraries at the same time with cmake.
Use `-DBUILD_TESTING=ON` to build the test executable.
cmake . -DBUILD_TESTING=ON
make
test/cctest/cctest --list | tr -d '<' | xargs test/cctest/cctest
[0]: http://www.scons.org/
[1]: https://cmake.org/

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

@ -192,13 +192,13 @@ static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
delta_plus = delta_minus;
}
*length = 0;
while (true) {
for (;;) {
uint16_t digit;
digit = numerator->DivideModuloIntBignum(*denominator);
ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive.
// digit = numerator / denominator (integer division).
// numerator = numerator % denominator.
buffer[(*length)++] = digit + '0';
buffer[(*length)++] = static_cast<char>(digit + '0');
// Can we stop already?
// If the remainder of the division is less than the distance to the lower
@ -282,7 +282,7 @@ static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
// exponent (decimal_point), when rounding upwards.
static void GenerateCountedDigits(int count, int* decimal_point,
Bignum* numerator, Bignum* denominator,
Vector<char>(buffer), int* length) {
Vector<char> buffer, int* length) {
ASSERT(count >= 0);
for (int i = 0; i < count - 1; ++i) {
uint16_t digit;
@ -290,7 +290,7 @@ static void GenerateCountedDigits(int count, int* decimal_point,
ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive.
// digit = numerator / denominator (integer division).
// numerator = numerator % denominator.
buffer[i] = digit + '0';
buffer[i] = static_cast<char>(digit + '0');
// Prepare for next iteration.
numerator->Times10();
}
@ -300,7 +300,8 @@ static void GenerateCountedDigits(int count, int* decimal_point,
if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) {
digit++;
}
buffer[count - 1] = digit + '0';
ASSERT(digit <= 10);
buffer[count - 1] = static_cast<char>(digit + '0');
// Correct bad digits (in case we had a sequence of '9's). Propagate the
// carry until we hat a non-'9' or til we reach the first digit.
for (int i = count - 1; i > 0; --i) {

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

@ -40,6 +40,7 @@ Bignum::Bignum()
template<typename S>
static int BitSize(S value) {
(void) value; // Mark variable as used.
return 8 * sizeof(value);
}
@ -103,7 +104,7 @@ void Bignum::AssignDecimalString(Vector<const char> value) {
const int kMaxUint64DecimalDigits = 19;
Zero();
int length = value.length();
int pos = 0;
unsigned int pos = 0;
// Let's just say that each digit needs 4 bits.
while (length >= kMaxUint64DecimalDigits) {
uint64_t digits = ReadUInt64(value, pos, kMaxUint64DecimalDigits);
@ -122,9 +123,8 @@ void Bignum::AssignDecimalString(Vector<const char> value) {
static int HexCharValue(char c) {
if ('0' <= c && c <= '9') return c - '0';
if ('a' <= c && c <= 'f') return 10 + c - 'a';
if ('A' <= c && c <= 'F') return 10 + c - 'A';
UNREACHABLE();
return 0; // To make compiler happy.
ASSERT('A' <= c && c <= 'F');
return 10 + c - 'A';
}
@ -505,9 +505,10 @@ uint16_t Bignum::DivideModuloIntBignum(const Bignum& other) {
// is big. This function is implemented for doubleToString where
// the result should be small (less than 10).
ASSERT(other.bigits_[other.used_digits_ - 1] >= ((1 << kBigitSize) / 16));
ASSERT(bigits_[used_digits_ - 1] < 0x10000);
// Remove the multiples of the first digit.
// Example this = 23 and other equals 9. -> Remove 2 multiples.
result += bigits_[used_digits_ - 1];
result += static_cast<uint16_t>(bigits_[used_digits_ - 1]);
SubtractTimes(other, bigits_[used_digits_ - 1]);
}
@ -523,13 +524,15 @@ uint16_t Bignum::DivideModuloIntBignum(const Bignum& other) {
// Shortcut for easy (and common) case.
int quotient = this_bigit / other_bigit;
bigits_[used_digits_ - 1] = this_bigit - other_bigit * quotient;
result += quotient;
ASSERT(quotient < 0x10000);
result += static_cast<uint16_t>(quotient);
Clamp();
return result;
}
int division_estimate = this_bigit / (other_bigit + 1);
result += division_estimate;
ASSERT(division_estimate < 0x10000);
result += static_cast<uint16_t>(division_estimate);
SubtractTimes(other, division_estimate);
if (other_bigit * (division_estimate + 1) > this_bigit) {
@ -560,8 +563,8 @@ static int SizeInHexChars(S number) {
static char HexCharOfValue(int value) {
ASSERT(0 <= value && value <= 16);
if (value < 10) return value + '0';
return value - 10 + 'A';
if (value < 10) return static_cast<char>(value + '0');
return static_cast<char>(value - 10 + 'A');
}

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

@ -49,7 +49,6 @@ class Bignum {
void AssignPowerUInt16(uint16_t base, int exponent);
void AddUInt16(uint16_t operand);
void AddUInt64(uint64_t operand);
void AddBignum(const Bignum& other);
// Precondition: this >= other.

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

@ -131,7 +131,6 @@ static const CachedPower kCachedPowers[] = {
{UINT64_2PART_C(0xaf87023b, 9bf0ee6b), 1066, 340},
};
static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers);
static const int kCachedPowersOffset = 348; // -1 * the first decimal_exponent.
static const double kD_1_LOG2_10 = 0.30102999566398114; // 1 / lg(10)
// Difference between the decimal exponents in the table above.
@ -149,9 +148,10 @@ void PowersOfTenCache::GetCachedPowerForBinaryExponentRange(
int foo = kCachedPowersOffset;
int index =
(foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1;
ASSERT(0 <= index && index < kCachedPowersLength);
ASSERT(0 <= index && index < static_cast<int>(ARRAY_SIZE(kCachedPowers)));
CachedPower cached_power = kCachedPowers[index];
ASSERT(min_exponent <= cached_power.binary_exponent);
(void) max_exponent; // Mark variable as used.
ASSERT(cached_power.binary_exponent <= max_exponent);
*decimal_exponent = cached_power.decimal_exponent;
*power = DiyFp(cached_power.significand, cached_power.binary_exponent);

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

@ -42,7 +42,7 @@ class DiyFp {
static const int kSignificandSize = 64;
DiyFp() : f_(0), e_(0) {}
DiyFp(uint64_t f, int e) : f_(f), e_(e) {}
DiyFp(uint64_t significand, int exponent) : f_(significand), e_(exponent) {}
// this = this - other.
// The exponents of both numbers must be the same and the significand of this
@ -76,22 +76,22 @@ class DiyFp {
void Normalize() {
ASSERT(f_ != 0);
uint64_t f = f_;
int e = e_;
uint64_t significand = f_;
int exponent = e_;
// This method is mainly called for normalizing boundaries. In general
// boundaries need to be shifted by 10 bits. We thus optimize for this case.
const uint64_t k10MSBits = UINT64_2PART_C(0xFFC00000, 00000000);
while ((f & k10MSBits) == 0) {
f <<= 10;
e -= 10;
while ((significand & k10MSBits) == 0) {
significand <<= 10;
exponent -= 10;
}
while ((f & kUint64MSB) == 0) {
f <<= 1;
e--;
while ((significand & kUint64MSB) == 0) {
significand <<= 1;
exponent--;
}
f_ = f;
e_ = e;
f_ = significand;
e_ = exponent;
}
static DiyFp Normalize(const DiyFp& a) {

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

@ -118,7 +118,7 @@ void DoubleToStringConverter::CreateDecimalRepresentation(
StringBuilder* result_builder) const {
// Create a representation that is padded with zeros if needed.
if (decimal_point <= 0) {
// "0.00000decimal_rep".
// "0.00000decimal_rep" or "0.000decimal_rep00".
result_builder->AddCharacter('0');
if (digits_after_point > 0) {
result_builder->AddCharacter('.');
@ -129,7 +129,7 @@ void DoubleToStringConverter::CreateDecimalRepresentation(
result_builder->AddPadding('0', remaining_digits);
}
} else if (decimal_point >= length) {
// "decimal_rep0000.00000" or "decimal_rep.0000"
// "decimal_rep0000.00000" or "decimal_rep.0000".
result_builder->AddSubstring(decimal_digits, length);
result_builder->AddPadding('0', decimal_point - length);
if (digits_after_point > 0) {
@ -137,7 +137,7 @@ void DoubleToStringConverter::CreateDecimalRepresentation(
result_builder->AddPadding('0', digits_after_point);
}
} else {
// "decima.l_rep000"
// "decima.l_rep000".
ASSERT(digits_after_point > 0);
result_builder->AddSubstring(decimal_digits, decimal_point);
result_builder->AddCharacter('.');
@ -351,7 +351,6 @@ static BignumDtoaMode DtoaToBignumDtoaMode(
case DoubleToStringConverter::PRECISION: return BIGNUM_DTOA_PRECISION;
default:
UNREACHABLE();
return BIGNUM_DTOA_SHORTEST; // To silence compiler.
}
}
@ -406,8 +405,8 @@ void DoubleToStringConverter::DoubleToAscii(double v,
vector, length, point);
break;
default:
UNREACHABLE();
fast_worked = false;
UNREACHABLE();
}
if (fast_worked) return;
@ -420,8 +419,9 @@ void DoubleToStringConverter::DoubleToAscii(double v,
// Consumes the given substring from the iterator.
// Returns false, if the substring does not match.
static bool ConsumeSubString(const char** current,
const char* end,
template <class Iterator>
static bool ConsumeSubString(Iterator* current,
Iterator end,
const char* substring) {
ASSERT(**current == *substring);
for (substring++; *substring != '\0'; substring++) {
@ -443,10 +443,36 @@ static bool ConsumeSubString(const char** current,
const int kMaxSignificantDigits = 772;
static const char kWhitespaceTable7[] = { 32, 13, 10, 9, 11, 12 };
static const int kWhitespaceTable7Length = ARRAY_SIZE(kWhitespaceTable7);
static const uc16 kWhitespaceTable16[] = {
160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195,
8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279
};
static const int kWhitespaceTable16Length = ARRAY_SIZE(kWhitespaceTable16);
static bool isWhitespace(int x) {
if (x < 128) {
for (int i = 0; i < kWhitespaceTable7Length; i++) {
if (kWhitespaceTable7[i] == x) return true;
}
} else {
for (int i = 0; i < kWhitespaceTable16Length; i++) {
if (kWhitespaceTable16[i] == x) return true;
}
}
return false;
}
// Returns true if a nonspace found and false if the end has reached.
static inline bool AdvanceToNonspace(const char** current, const char* end) {
template <class Iterator>
static inline bool AdvanceToNonspace(Iterator* current, Iterator end) {
while (*current != end) {
if (**current != ' ') return true;
if (!isWhitespace(**current)) return true;
++*current;
}
return false;
@ -465,26 +491,57 @@ static double SignedZero(bool sign) {
}
// Returns true if 'c' is a decimal digit that is valid for the given radix.
//
// The function is small and could be inlined, but VS2012 emitted a warning
// because it constant-propagated the radix and concluded that the last
// condition was always true. By moving it into a separate function the
// compiler wouldn't warn anymore.
#if _MSC_VER
#pragma optimize("",off)
static bool IsDecimalDigitForRadix(int c, int radix) {
return '0' <= c && c <= '9' && (c - '0') < radix;
}
#pragma optimize("",on)
#else
static bool inline IsDecimalDigitForRadix(int c, int radix) {
return '0' <= c && c <= '9' && (c - '0') < radix;
}
#endif
// Returns true if 'c' is a character digit that is valid for the given radix.
// The 'a_character' should be 'a' or 'A'.
//
// The function is small and could be inlined, but VS2012 emitted a warning
// because it constant-propagated the radix and concluded that the first
// condition was always false. By moving it into a separate function the
// compiler wouldn't warn anymore.
static bool IsCharacterDigitForRadix(int c, int radix, char a_character) {
return radix > 10 && c >= a_character && c < a_character + radix - 10;
}
// Parsing integers with radix 2, 4, 8, 16, 32. Assumes current != end.
template <int radix_log_2>
static double RadixStringToIeee(const char* current,
const char* end,
template <int radix_log_2, class Iterator>
static double RadixStringToIeee(Iterator* current,
Iterator end,
bool sign,
bool allow_trailing_junk,
double junk_string_value,
bool read_as_double,
const char** trailing_pointer) {
ASSERT(current != end);
bool* result_is_junk) {
ASSERT(*current != end);
const int kDoubleSize = Double::kSignificandSize;
const int kSingleSize = Single::kSignificandSize;
const int kSignificandSize = read_as_double? kDoubleSize: kSingleSize;
*result_is_junk = true;
// Skip leading 0s.
while (*current == '0') {
++current;
if (current == end) {
*trailing_pointer = end;
while (**current == '0') {
++(*current);
if (*current == end) {
*result_is_junk = false;
return SignedZero(sign);
}
}
@ -495,14 +552,14 @@ static double RadixStringToIeee(const char* current,
do {
int digit;
if (*current >= '0' && *current <= '9' && *current < '0' + radix) {
digit = static_cast<char>(*current) - '0';
} else if (radix > 10 && *current >= 'a' && *current < 'a' + radix - 10) {
digit = static_cast<char>(*current) - 'a' + 10;
} else if (radix > 10 && *current >= 'A' && *current < 'A' + radix - 10) {
digit = static_cast<char>(*current) - 'A' + 10;
if (IsDecimalDigitForRadix(**current, radix)) {
digit = static_cast<char>(**current) - '0';
} else if (IsCharacterDigitForRadix(**current, radix, 'a')) {
digit = static_cast<char>(**current) - 'a' + 10;
} else if (IsCharacterDigitForRadix(**current, radix, 'A')) {
digit = static_cast<char>(**current) - 'A' + 10;
} else {
if (allow_trailing_junk || !AdvanceToNonspace(&current, end)) {
if (allow_trailing_junk || !AdvanceToNonspace(current, end)) {
break;
} else {
return junk_string_value;
@ -526,14 +583,14 @@ static double RadixStringToIeee(const char* current,
exponent = overflow_bits_count;
bool zero_tail = true;
while (true) {
++current;
if (current == end || !isDigit(*current, radix)) break;
zero_tail = zero_tail && *current == '0';
for (;;) {
++(*current);
if (*current == end || !isDigit(**current, radix)) break;
zero_tail = zero_tail && **current == '0';
exponent += radix_log_2;
}
if (!allow_trailing_junk && AdvanceToNonspace(&current, end)) {
if (!allow_trailing_junk && AdvanceToNonspace(current, end)) {
return junk_string_value;
}
@ -555,13 +612,13 @@ static double RadixStringToIeee(const char* current,
}
break;
}
++current;
} while (current != end);
++(*current);
} while (*current != end);
ASSERT(number < ((int64_t)1 << kSignificandSize));
ASSERT(static_cast<int64_t>(static_cast<double>(number)) == number);
*trailing_pointer = current;
*result_is_junk = false;
if (exponent == 0) {
if (sign) {
@ -576,13 +633,14 @@ static double RadixStringToIeee(const char* current,
}
template <class Iterator>
double StringToDoubleConverter::StringToIeee(
const char* input,
Iterator input,
int length,
int* processed_characters_count,
bool read_as_double) const {
const char* current = input;
const char* end = input + length;
bool read_as_double,
int* processed_characters_count) const {
Iterator current = input;
Iterator end = input + length;
*processed_characters_count = 0;
@ -603,7 +661,7 @@ double StringToDoubleConverter::StringToIeee(
if (allow_leading_spaces || allow_trailing_spaces) {
if (!AdvanceToNonspace(&current, end)) {
*processed_characters_count = current - input;
*processed_characters_count = static_cast<int>(current - input);
return empty_string_value_;
}
if (!allow_leading_spaces && (input != current)) {
@ -629,7 +687,7 @@ double StringToDoubleConverter::StringToIeee(
if (*current == '+' || *current == '-') {
sign = (*current == '-');
++current;
const char* next_non_space = current;
Iterator next_non_space = current;
// Skip following spaces (if allowed).
if (!AdvanceToNonspace(&next_non_space, end)) return junk_string_value_;
if (!allow_spaces_after_sign && (current != next_non_space)) {
@ -652,7 +710,7 @@ double StringToDoubleConverter::StringToIeee(
}
ASSERT(buffer_pos == 0);
*processed_characters_count = current - input;
*processed_characters_count = static_cast<int>(current - input);
return sign ? -Double::Infinity() : Double::Infinity();
}
}
@ -671,7 +729,7 @@ double StringToDoubleConverter::StringToIeee(
}
ASSERT(buffer_pos == 0);
*processed_characters_count = current - input;
*processed_characters_count = static_cast<int>(current - input);
return sign ? -Double::NaN() : Double::NaN();
}
}
@ -680,7 +738,7 @@ double StringToDoubleConverter::StringToIeee(
if (*current == '0') {
++current;
if (current == end) {
*processed_characters_count = current - input;
*processed_characters_count = static_cast<int>(current - input);
return SignedZero(sign);
}
@ -693,17 +751,17 @@ double StringToDoubleConverter::StringToIeee(
return junk_string_value_; // "0x".
}
const char* tail_pointer = NULL;
double result = RadixStringToIeee<4>(current,
bool result_is_junk;
double result = RadixStringToIeee<4>(&current,
end,
sign,
allow_trailing_junk,
junk_string_value_,
read_as_double,
&tail_pointer);
if (tail_pointer != NULL) {
if (allow_trailing_spaces) AdvanceToNonspace(&tail_pointer, end);
*processed_characters_count = tail_pointer - input;
&result_is_junk);
if (!result_is_junk) {
if (allow_trailing_spaces) AdvanceToNonspace(&current, end);
*processed_characters_count = static_cast<int>(current - input);
}
return result;
}
@ -712,7 +770,7 @@ double StringToDoubleConverter::StringToIeee(
while (*current == '0') {
++current;
if (current == end) {
*processed_characters_count = current - input;
*processed_characters_count = static_cast<int>(current - input);
return SignedZero(sign);
}
}
@ -760,7 +818,7 @@ double StringToDoubleConverter::StringToIeee(
while (*current == '0') {
++current;
if (current == end) {
*processed_characters_count = current - input;
*processed_characters_count = static_cast<int>(current - input);
return SignedZero(sign);
}
exponent--; // Move this 0 into the exponent.
@ -804,9 +862,9 @@ double StringToDoubleConverter::StringToIeee(
return junk_string_value_;
}
}
char sign = '+';
char exponen_sign = '+';
if (*current == '+' || *current == '-') {
sign = static_cast<char>(*current);
exponen_sign = static_cast<char>(*current);
++current;
if (current == end) {
if (allow_trailing_junk) {
@ -840,7 +898,7 @@ double StringToDoubleConverter::StringToIeee(
++current;
} while (current != end && *current >= '0' && *current <= '9');
exponent += (sign == '-' ? -num : num);
exponent += (exponen_sign == '-' ? -num : num);
}
if (!(allow_trailing_spaces || allow_trailing_junk) && (current != end)) {
@ -858,16 +916,17 @@ double StringToDoubleConverter::StringToIeee(
if (octal) {
double result;
const char* tail_pointer = NULL;
result = RadixStringToIeee<3>(buffer,
bool result_is_junk;
char* start = buffer;
result = RadixStringToIeee<3>(&start,
buffer + buffer_pos,
sign,
allow_trailing_junk,
junk_string_value_,
read_as_double,
&tail_pointer);
ASSERT(tail_pointer != NULL);
*processed_characters_count = current - input;
&result_is_junk);
ASSERT(!result_is_junk);
*processed_characters_count = static_cast<int>(current - input);
return result;
}
@ -885,8 +944,42 @@ double StringToDoubleConverter::StringToIeee(
} else {
converted = Strtof(Vector<const char>(buffer, buffer_pos), exponent);
}
*processed_characters_count = current - input;
*processed_characters_count = static_cast<int>(current - input);
return sign? -converted: converted;
}
double StringToDoubleConverter::StringToDouble(
const char* buffer,
int length,
int* processed_characters_count) const {
return StringToIeee(buffer, length, true, processed_characters_count);
}
double StringToDoubleConverter::StringToDouble(
const uc16* buffer,
int length,
int* processed_characters_count) const {
return StringToIeee(buffer, length, true, processed_characters_count);
}
float StringToDoubleConverter::StringToFloat(
const char* buffer,
int length,
int* processed_characters_count) const {
return static_cast<float>(StringToIeee(buffer, length, false,
processed_characters_count));
}
float StringToDoubleConverter::StringToFloat(
const uc16* buffer,
int length,
int* processed_characters_count) const {
return static_cast<float>(StringToIeee(buffer, length, false,
processed_characters_count));
}
} // namespace double_conversion

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

@ -417,9 +417,10 @@ class StringToDoubleConverter {
// junk, too.
// - ALLOW_TRAILING_JUNK: ignore trailing characters that are not part of
// a double literal.
// - ALLOW_LEADING_SPACES: skip over leading spaces.
// - ALLOW_TRAILING_SPACES: ignore trailing spaces.
// - ALLOW_SPACES_AFTER_SIGN: ignore spaces after the sign.
// - ALLOW_LEADING_SPACES: skip over leading whitespace, including spaces,
// new-lines, and tabs.
// - ALLOW_TRAILING_SPACES: ignore trailing whitespace.
// - ALLOW_SPACES_AFTER_SIGN: ignore whitespace after the sign.
// Ex: StringToDouble("- 123.2") -> -123.2.
// StringToDouble("+ 123.2") -> 123.2
//
@ -504,19 +505,24 @@ class StringToDoubleConverter {
// in the 'processed_characters_count'. Trailing junk is never included.
double StringToDouble(const char* buffer,
int length,
int* processed_characters_count) const {
return StringToIeee(buffer, length, processed_characters_count, true);
}
int* processed_characters_count) const;
// Same as StringToDouble above but for 16 bit characters.
double StringToDouble(const uc16* buffer,
int length,
int* processed_characters_count) const;
// Same as StringToDouble but reads a float.
// Note that this is not equivalent to static_cast<float>(StringToDouble(...))
// due to potential double-rounding.
float StringToFloat(const char* buffer,
int length,
int* processed_characters_count) const {
return static_cast<float>(StringToIeee(buffer, length,
processed_characters_count, false));
}
int* processed_characters_count) const;
// Same as StringToFloat above but for 16 bit characters.
float StringToFloat(const uc16* buffer,
int length,
int* processed_characters_count) const;
private:
const int flags_;
@ -525,10 +531,11 @@ class StringToDoubleConverter {
const char* const infinity_symbol_;
const char* const nan_symbol_;
double StringToIeee(const char* buffer,
template <class Iterator>
double StringToIeee(Iterator start_pointer,
int length,
int* processed_characters_count,
bool read_as_double) const;
bool read_as_double,
int* processed_characters_count) const;
DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter);
};

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

@ -248,10 +248,7 @@ static void BiggestPowerTen(uint32_t number,
// Note: kPowersOf10[i] == 10^(i-1).
exponent_plus_one_guess++;
// We don't have any guarantees that 2^number_bits <= number.
// TODO(floitsch): can we change the 'while' into an 'if'? We definitely see
// number < (2^number_bits - 1), but I haven't encountered
// number < (2^number_bits - 2) yet.
while (number < kSmallPowersOfTen[exponent_plus_one_guess]) {
if (number < kSmallPowersOfTen[exponent_plus_one_guess]) {
exponent_plus_one_guess--;
}
*power = kSmallPowersOfTen[exponent_plus_one_guess];
@ -350,7 +347,8 @@ static bool DigitGen(DiyFp low,
// that is smaller than integrals.
while (*kappa > 0) {
int digit = integrals / divisor;
buffer[*length] = '0' + digit;
ASSERT(digit <= 9);
buffer[*length] = static_cast<char>('0' + digit);
(*length)++;
integrals %= divisor;
(*kappa)--;
@ -379,13 +377,14 @@ static bool DigitGen(DiyFp low,
ASSERT(one.e() >= -60);
ASSERT(fractionals < one.f());
ASSERT(UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF) / 10 >= one.f());
while (true) {
for (;;) {
fractionals *= 10;
unit *= 10;
unsafe_interval.set_f(unsafe_interval.f() * 10);
// Integer division by one.
int digit = static_cast<int>(fractionals >> -one.e());
buffer[*length] = '0' + digit;
ASSERT(digit <= 9);
buffer[*length] = static_cast<char>('0' + digit);
(*length)++;
fractionals &= one.f() - 1; // Modulo by one.
(*kappa)--;
@ -459,7 +458,8 @@ static bool DigitGenCounted(DiyFp w,
// that is smaller than 'integrals'.
while (*kappa > 0) {
int digit = integrals / divisor;
buffer[*length] = '0' + digit;
ASSERT(digit <= 9);
buffer[*length] = static_cast<char>('0' + digit);
(*length)++;
requested_digits--;
integrals %= divisor;
@ -492,7 +492,8 @@ static bool DigitGenCounted(DiyFp w,
w_error *= 10;
// Integer division by one.
int digit = static_cast<int>(fractionals >> -one.e());
buffer[*length] = '0' + digit;
ASSERT(digit <= 9);
buffer[*length] = static_cast<char>('0' + digit);
(*length)++;
requested_digits--;
fractionals &= one.f() - 1; // Modulo by one.

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

@ -98,7 +98,7 @@ class UInt128 {
return high_bits_ == 0 && low_bits_ == 0;
}
int BitAt(int position) {
int BitAt(int position) const {
if (position >= 64) {
return static_cast<int>(high_bits_ >> (position - 64)) & 1;
} else {
@ -133,7 +133,7 @@ static void FillDigits32(uint32_t number, Vector<char> buffer, int* length) {
while (number != 0) {
int digit = number % 10;
number /= 10;
buffer[(*length) + number_length] = '0' + digit;
buffer[(*length) + number_length] = static_cast<char>('0' + digit);
number_length++;
}
// Exchange the digits.
@ -150,7 +150,7 @@ static void FillDigits32(uint32_t number, Vector<char> buffer, int* length) {
}
static void FillDigits64FixedLength(uint64_t number, int requested_length,
static void FillDigits64FixedLength(uint64_t number,
Vector<char> buffer, int* length) {
const uint32_t kTen7 = 10000000;
// For efficiency cut the number into 3 uint32_t parts, and print those.
@ -253,7 +253,8 @@ static void FillFractionals(uint64_t fractionals, int exponent,
fractionals *= 5;
point--;
int digit = static_cast<int>(fractionals >> point);
buffer[*length] = '0' + digit;
ASSERT(digit <= 9);
buffer[*length] = static_cast<char>('0' + digit);
(*length)++;
fractionals -= static_cast<uint64_t>(digit) << point;
}
@ -274,7 +275,8 @@ static void FillFractionals(uint64_t fractionals, int exponent,
fractionals128.Multiply(5);
point--;
int digit = fractionals128.DivModPowerOf2(point);
buffer[*length] = '0' + digit;
ASSERT(digit <= 9);
buffer[*length] = static_cast<char>('0' + digit);
(*length)++;
}
if (fractionals128.BitAt(point - 1) == 1) {
@ -358,7 +360,7 @@ bool FastFixedDtoa(double v,
remainder = (dividend % divisor) << exponent;
}
FillDigits32(quotient, buffer, length);
FillDigits64FixedLength(remainder, divisor_power, buffer, length);
FillDigits64FixedLength(remainder, buffer, length);
*decimal_point = *length;
} else if (exponent >= 0) {
// 0 <= exponent <= 11

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

@ -99,7 +99,7 @@ class Double {
}
double PreviousDouble() const {
if (d64_ == (kInfinity | kSignMask)) return -Double::Infinity();
if (d64_ == (kInfinity | kSignMask)) return -Infinity();
if (Sign() < 0) {
return Double(d64_ + 1).value();
} else {
@ -256,6 +256,8 @@ class Double {
return (significand & kSignificandMask) |
(biased_exponent << kPhysicalSignificandSize);
}
DISALLOW_COPY_AND_ASSIGN(Double);
};
class Single {
@ -391,6 +393,8 @@ class Single {
static const uint32_t kNaN = 0x7FC00000;
const uint32_t d32_;
DISALLOW_COPY_AND_ASSIGN(Single);
};
} // namespace double_conversion

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

@ -137,6 +137,7 @@ static void TrimAndCut(Vector<const char> buffer, int exponent,
Vector<const char> right_trimmed = TrimTrailingZeros(left_trimmed);
exponent += left_trimmed.length() - right_trimmed.length();
if (right_trimmed.length() > kMaxSignificantDecimalDigits) {
(void) space_size; // Mark variable as used.
ASSERT(space_size >= kMaxSignificantDecimalDigits);
CutToMaxSignificantDigits(right_trimmed, exponent,
buffer_copy_space, updated_exponent);
@ -263,7 +264,6 @@ static DiyFp AdjustmentPowerOfTen(int exponent) {
case 7: return DiyFp(UINT64_2PART_C(0x98968000, 00000000), -40);
default:
UNREACHABLE();
return DiyFp(0, 0);
}
}
@ -286,7 +286,7 @@ static bool DiyFpStrtod(Vector<const char> buffer,
const int kDenominator = 1 << kDenominatorLog;
// Move the remaining decimals into the exponent.
exponent += remaining_decimals;
int error = (remaining_decimals == 0 ? 0 : kDenominator / 2);
uint64_t error = (remaining_decimals == 0 ? 0 : kDenominator / 2);
int old_e = input.e();
input.Normalize();
@ -515,7 +515,7 @@ float Strtof(Vector<const char> buffer, int exponent) {
double double_next2 = Double(double_next).NextDouble();
f4 = static_cast<float>(double_next2);
}
(void) f2; // Mark variable as used.
(void) f2; // Mark variable as used.
ASSERT(f1 <= f2 && f2 <= f3 && f3 <= f4);
// If the guess doesn't lie near a single-precision boundary we can simply

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

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

@ -33,14 +33,29 @@
#include "mozilla/Assertions.h"
#ifndef ASSERT
#define ASSERT(condition) MOZ_ASSERT(condition)
#define ASSERT(condition) \
MOZ_ASSERT(condition)
#endif
#ifndef UNIMPLEMENTED
#define UNIMPLEMENTED() MOZ_CRASH()
#endif
#ifndef DOUBLE_CONVERSION_NO_RETURN
#ifdef _MSC_VER
#define DOUBLE_CONVERSION_NO_RETURN __declspec(noreturn)
#else
#define DOUBLE_CONVERSION_NO_RETURN __attribute__((noreturn))
#endif
#endif
#ifndef UNREACHABLE
#ifdef _MSC_VER
void DOUBLE_CONVERSION_NO_RETURN abort_noreturn();
inline void abort_noreturn() { MOZ_CRASH(); }
#define UNREACHABLE() (abort_noreturn())
#else
#define UNREACHABLE() MOZ_CRASH()
#endif
#endif
// Double operations detection based on target architecture.
// Linux uses a 80bit wide floating point stack on x86. This induces double
@ -57,11 +72,15 @@
defined(__hppa__) || defined(__ia64__) || \
defined(__mips__) || \
defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \
defined(_POWER) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \
defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
defined(__SH4__) || defined(__alpha__) || \
defined(_MIPS_ARCH_MIPS32R2) || \
defined(__AARCH64EL__) || defined(__aarch64__)
defined(__AARCH64EL__) || defined(__aarch64__) || \
defined(__riscv)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(__mc68000__)
#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
#if defined(_WIN32)
// Windows uses a 64bit wide floating point stack.
@ -73,9 +92,16 @@
#error Target architecture was not detected as supported by Double-Conversion.
#endif
#if defined(__GNUC__)
#define DOUBLE_CONVERSION_UNUSED __attribute__((unused))
#else
#define DOUBLE_CONVERSION_UNUSED
#endif
#include <stdint.h>
typedef uint16_t uc16;
// The following macro works on both 32 and 64-bit platforms.
// Usage: instead of writing 0x1234567890123456
// write UINT64_2PART_C(0x12345678,90123456);
@ -280,8 +306,10 @@ class StringBuilder {
// another thus avoiding the warning.
template <class Dest, class Source>
inline Dest BitCast(const Source& source) {
static_assert(sizeof(Dest) == sizeof(Source),
"BitCast's source and destination types must be the same size");
// Compile time assertion: sizeof(Dest) == sizeof(Source)
// A compile error here means your Dest and Source have different sizes.
DOUBLE_CONVERSION_UNUSED
typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
Dest dest;
memmove(&dest, &source, sizeof(dest));

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

@ -1,23 +1,76 @@
# Usage: ./update.sh <double-conversion-src-directory>
#!/bin/bash
# Usage: ./update.sh [<git-rev-to-use>]
#
# Copies the needed files from a directory containing the original
# double-conversion source that we need.
# This was last updated with git rev 04cae7a8d5ef3d62ceffb03cdc3d38f258457a52.
# double-conversion source that we need. If no revision is specified, the tip
# revision is used. See GIT-INFO for the last revision used.
set -e
cp $1/LICENSE ./
cp $1/README ./
LOCAL_PATCHES=""
LOCAL_PATCHES="$LOCAL_PATCHES add-mfbt-api-markers.patch"
LOCAL_PATCHES="$LOCAL_PATCHES use-StandardInteger.patch"
LOCAL_PATCHES="$LOCAL_PATCHES use-mozilla-assertions.patch"
LOCAL_PATCHES="$LOCAL_PATCHES ToPrecision-exponential.patch"
TMPDIR=`mktemp --directory`
LOCAL_CLONE="$TMPDIR/double-conversion"
git clone https://github.com/google/double-conversion.git "$LOCAL_CLONE"
# If a particular revision was requested, check it out.
if [ "$1" != "" ]; then
git -C "$LOCAL_CLONE" checkout "$1"
fi
# First clear out everything already present.
DEST=./source
mv "$DEST" "$TMPDIR"/
mkdir "$DEST"
# Copy over critical files.
cp "$LOCAL_CLONE/LICENSE" "$DEST/"
cp "$LOCAL_CLONE/README.md" "$DEST/"
# Includes
cp $1/src/*.h ./
for header in "$LOCAL_CLONE/double-conversion/"*.h; do
cp "$header" "$DEST/"
done
# Source
cp $1/src/*.cc ./
for ccfile in "$LOCAL_CLONE/double-conversion/"*.cc; do
cp "$ccfile" "$DEST/"
done
patch -p3 < add-mfbt-api-markers.patch
patch -p3 < use-StandardInteger.patch
patch -p3 < use-mozilla-assertions.patch
patch -p3 < use-static_assert.patch
patch -p3 < ToPrecision-exponential.patch
# Now apply our local patches.
for patch in $LOCAL_PATCHES; do
patch --directory "$DEST" --strip 4 < "$patch"
# Out-of-date patches may spew *.{orig,rej} when applied. Report an error if
# any such file is found, and roll the source directory back to its previous
# state in such case.
detritus_files=`find "$DEST" -name '*.orig' -o -name '*.rej'`
if [ "$detritus_files" != "" ]; then
echo "ERROR: Local patch $patch created these detritus files when applied:"
echo ""
echo " $detritus_files"
echo ""
echo "Please fix $patch before running $0."
rm -rf "$DEST"
mv "$TMPDIR"/source "$DEST"
exit 1
fi
done
# Update Mercurial file status.
hg addremove "$DEST"
# Note the revision used in this update.
git -C "$LOCAL_CLONE" show > ./GIT-INFO
# Delete the tmpdir.
rm -rf "$TMPDIR"

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

@ -1,10 +1,14 @@
diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
index cd3e330..bdc7d4b 100644
--- a/mfbt/double-conversion/utils.h
+++ b/mfbt/double-conversion/utils.h
@@ -74,23 +74,7 @@
diff --git a/mfbt/double-conversion/source/utils.h b/mfbt/double-conversion/source/utils.h
--- a/mfbt/double-conversion/source/utils.h
+++ b/mfbt/double-conversion/source/utils.h
@@ -93,34 +93,18 @@ inline void abort_noreturn() { abort();
#endif
#if defined(__GNUC__)
#define DOUBLE_CONVERSION_UNUSED __attribute__((unused))
#else
#define DOUBLE_CONVERSION_UNUSED
#endif
-#if defined(_WIN32) && !defined(__MINGW32__)
-
@ -20,10 +24,15 @@ index cd3e330..bdc7d4b 100644
-
-#else
-
-#include <stdint.h>
-
#include <stdint.h>
-#endif
+#include <stdint.h>
-
typedef uint16_t uc16;
// The following macro works on both 32 and 64-bit platforms.
// Usage: instead of writing 0x1234567890123456
// write UINT64_2PART_C(0x12345678,90123456);
#define UINT64_2PART_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u))

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

@ -1,23 +1,47 @@
diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
--- a/mfbt/double-conversion/utils.h
+++ b/mfbt/double-conversion/utils.h
@@ -31,15 +31,15 @@
diff --git a/mfbt/double-conversion/source/utils.h b/mfbt/double-conversion/source/utils.h
--- a/mfbt/double-conversion/source/utils.h
+++ b/mfbt/double-conversion/source/utils.h
@@ -26,38 +26,38 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef DOUBLE_CONVERSION_UTILS_H_
#define DOUBLE_CONVERSION_UTILS_H_
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
+#include "mozilla/Assertions.h"
#ifndef ASSERT
-#define ASSERT(condition) (assert(condition))
+#define ASSERT(condition) MOZ_ASSERT(condition)
#define ASSERT(condition) \
- assert(condition);
+ MOZ_ASSERT(condition)
#endif
#ifndef UNIMPLEMENTED
-#define UNIMPLEMENTED() (abort())
+#define UNIMPLEMENTED() MOZ_CRASH()
#endif
#ifndef DOUBLE_CONVERSION_NO_RETURN
#ifdef _MSC_VER
#define DOUBLE_CONVERSION_NO_RETURN __declspec(noreturn)
#else
#define DOUBLE_CONVERSION_NO_RETURN __attribute__((noreturn))
#endif
#endif
#ifndef UNREACHABLE
#ifdef _MSC_VER
void DOUBLE_CONVERSION_NO_RETURN abort_noreturn();
-inline void abort_noreturn() { abort(); }
+inline void abort_noreturn() { MOZ_CRASH(); }
#define UNREACHABLE() (abort_noreturn())
#else
-#define UNREACHABLE() (abort())
+#define UNREACHABLE() MOZ_CRASH()
#endif
#endif
// Double operations detection based on target architecture.
// Linux uses a 80bit wide floating point stack on x86. This induces double
// rounding, which in turn leads to wrong results.
// An easy way to test if the floating-point operations are correct is to

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

@ -1,25 +0,0 @@
diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
--- a/mfbt/double-conversion/utils.h
+++ b/mfbt/double-conversion/utils.h
@@ -275,19 +275,18 @@ class StringBuilder {
// There is an additional use for BitCast.
// Recent gccs will warn when they see casts that may result in breakage due to
// the type-based aliasing rule. If you have checked that there is no breakage
// you can use BitCast to cast one pointer type to another. This confuses gcc
// enough that it can no longer see that you have cast one pointer type to
// another thus avoiding the warning.
template <class Dest, class Source>
inline Dest BitCast(const Source& source) {
- // Compile time assertion: sizeof(Dest) == sizeof(Source)
- // A compile error here means your Dest and Source have different sizes.
- typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
+ static_assert(sizeof(Dest) == sizeof(Source),
+ "BitCast's source and destination types must be the same size");
Dest dest;
memmove(&dest, &source, sizeof(dest));
return dest;
}
template <class Dest, class Source>
inline Dest BitCast(Source* source) {

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

@ -33,8 +33,8 @@ EXPORTS.mozilla = [
'Compression.h',
'DebugOnly.h',
'decimal/Decimal.h',
'double-conversion/double-conversion.h',
'double-conversion/utils.h',
'double-conversion/source/double-conversion.h',
'double-conversion/source/utils.h',
'EndianUtils.h',
'EnumeratedArray.h',
'EnumeratedRange.h',

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

@ -7,14 +7,14 @@
mfbt_src_lcppsrcs = [
'Assertions.cpp',
'ChaosMode.cpp',
'double-conversion/bignum-dtoa.cc',
'double-conversion/bignum.cc',
'double-conversion/cached-powers.cc',
'double-conversion/diy-fp.cc',
'double-conversion/double-conversion.cc',
'double-conversion/fast-dtoa.cc',
'double-conversion/fixed-dtoa.cc',
'double-conversion/strtod.cc',
'double-conversion/source/bignum-dtoa.cc',
'double-conversion/source/bignum.cc',
'double-conversion/source/cached-powers.cc',
'double-conversion/source/diy-fp.cc',
'double-conversion/source/double-conversion.cc',
'double-conversion/source/fast-dtoa.cc',
'double-conversion/source/fixed-dtoa.cc',
'double-conversion/source/strtod.cc',
'FloatingPoint.cpp',
'HashFunctions.cpp',
'JSONWriter.cpp',

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

@ -14,6 +14,7 @@ from distutils import dir_util
from devicemanager import DeviceManager, DMError
from mozprocess import ProcessHandler
import mozfile
import version_codes
class DeviceManagerADB(DeviceManager):
@ -34,6 +35,7 @@ class DeviceManagerADB(DeviceManager):
_packageName = None
_tempDir = None
_adb_version = None
_sdk_version = None
connected = False
def __init__(self, host=None, port=5555, retryLimit=5, packageName='fennec',
@ -448,15 +450,31 @@ class DeviceManagerADB(DeviceManager):
return outputFile
def killProcess(self, appname, sig=None):
shell_args = ["shell"]
if self._sdk_version >= version_codes.N:
# Bug 1334613 - force use of root
if self._haveRootShell is None and self._haveSu is None:
self._checkForRoot()
if not self._haveRootShell and not self._haveSu:
raise DMError(
"killProcess '%s' requested to run as root but root "
"is not available on this device. Root your device or "
"refactor the test/harness to not require root." %
appname)
if not self._haveRootShell:
shell_args.extend(["su", self._suModifier])
procs = self.getProcessList()
for (pid, name, user) in procs:
if name == appname:
args = ["shell", "kill"]
args = list(shell_args)
args.append("kill")
if sig:
args.append("-%d" % sig)
args.append(str(pid))
p = self._runCmd(args, timeout=self.short_timeout)
if p.returncode != 0:
if p.returncode != 0 and len(p.output) > 0 and \
'No such process' not in p.output[0]:
raise DMError("Error killing process "
"'%s': %s" % (appname, p.output))
@ -738,10 +756,14 @@ class DeviceManagerADB(DeviceManager):
raise DMError("invalid adb path, or adb not executable: %s" % self._adbPath)
try:
proc = self._runCmd(["version"], timeout=self.short_timeout)
re_version = re.compile(r'Android Debug Bridge version (.*)')
proc = self._runCmd(["version"], timeout=self.short_timeout)
self._adb_version = re_version.match(proc.output[0]).group(1)
self._logger.info("Detected adb %s", self._adb_version)
proc = self._runCmd(["shell", "getprop", "ro.build.version.sdk"],
timeout=self.short_timeout)
self._sdk_version = int(proc.output[0])
self._logger.info("Detected Android sdk %s", self._sdk_version)
except os.error as err:
raise DMError(
"unable to execute ADB (%s): ensure Android SDK is installed "

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

@ -1,6 +0,0 @@
[postMessage_event_properties.htm]
type: testharness
[ postMessage(): MessageEvent properties ]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=952139

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

@ -13,13 +13,9 @@ CRCCheck on
RequestExecutionLevel admin
; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can
; be removed after we require NSIS 3.0a2 or greater.
!ifdef NSIS_PACKEDVERSION
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!endif
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!addplugindir ./
@ -127,14 +123,6 @@ Function un.onInit
; This only effects LoadLibrary calls and not implicitly loaded DLLs.
System::Call 'kernel32::SetDllDirectoryW(w "")'
; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
; removed after we require NSIS 3.0a2 or greater.
!ifndef NSIS_PACKEDVERSION
${If} ${AtLeastWinVista}
System::Call 'user32::SetProcessDPIAware()'
${EndIf}
!endif
StrCpy $BrandFullNameDA "${MaintFullName}"
StrCpy $BrandFullName "${MaintFullName}"
FunctionEnd

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

@ -38,21 +38,25 @@ enum class ScalarActionType : uint32_t {
eSetMaximum = 2
};
typedef mozilla::Variant<uint32_t, bool, nsString> ScalarVariant;
struct ScalarAction
{
ScalarID mId;
uint32_t mScalarType;
ScalarActionType mActionType;
nsCOMPtr<nsIVariant> mData;
// We need to wrap mData in a Maybe otherwise the IPC system
// is unable to instantiate a ScalarAction.
Maybe<ScalarVariant> mData;
};
struct KeyedScalarAction
{
ScalarID mId;
uint32_t mScalarType;
ScalarActionType mActionType;
nsCString mKey;
nsCOMPtr<nsIVariant> mData;
// We need to wrap mData in a Maybe otherwise the IPC system
// is unable to instantiate a ScalarAction.
Maybe<ScalarVariant> mData;
};
} // namespace Telemetry
@ -121,90 +125,71 @@ ParamTraits<mozilla::Telemetry::ScalarAction>
{
// Write the message type
aMsg->WriteUInt32(static_cast<uint32_t>(aParam.mId));
WriteParam(aMsg, aParam.mScalarType);
WriteParam(aMsg, static_cast<uint32_t>(aParam.mActionType));
switch(aParam.mScalarType) {
case nsITelemetry::SCALAR_COUNT:
{
uint32_t val = 0;
nsresult rv = aParam.mData->GetAsUint32(&val);
if (NS_FAILED(rv)) {
MOZ_ASSERT(false, "Count Scalar unable to convert variant to bool from child process.");
return;
}
WriteParam(aMsg, val);
break;
}
case nsITelemetry::SCALAR_STRING:
{
nsAutoString val;
nsresult rv = aParam.mData->GetAsAString(val);
if (NS_FAILED(rv)) {
MOZ_ASSERT(false, "Conversion failed.");
return;
}
WriteParam(aMsg, val);
break;
}
case nsITelemetry::SCALAR_BOOLEAN:
{
bool val = 0;
nsresult rv = aParam.mData->GetAsBool(&val);
if (NS_FAILED(rv)) {
MOZ_ASSERT(false, "Boolean Scalar unable to convert variant to bool from child process.");
return;
}
WriteParam(aMsg, val);
break;
}
default:
MOZ_ASSERT(false, "Unknown scalar type.");
if (aParam.mData.isNothing()) {
MOZ_CRASH("There is no data in the ScalarAction.");
return;
}
if (aParam.mData->is<uint32_t>()) {
// That's a nsITelemetry::SCALAR_COUNT.
WriteParam(aMsg, static_cast<uint32_t>(nsITelemetry::SCALAR_COUNT));
WriteParam(aMsg, aParam.mData->as<uint32_t>());
} else if (aParam.mData->is<nsString>()) {
// That's a nsITelemetry::SCALAR_STRING.
WriteParam(aMsg, static_cast<uint32_t>(nsITelemetry::SCALAR_STRING));
WriteParam(aMsg, aParam.mData->as<nsString>());
} else if (aParam.mData->is<bool>()) {
// That's a nsITelemetry::SCALAR_BOOLEAN.
WriteParam(aMsg, static_cast<uint32_t>(nsITelemetry::SCALAR_BOOLEAN));
WriteParam(aMsg, aParam.mData->as<bool>());
} else {
MOZ_CRASH("Unknown scalar type.");
}
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
// Read the scalar ID and the scalar type.
uint32_t scalarType = 0;
if (!aMsg->ReadUInt32(aIter, reinterpret_cast<uint32_t*>(&(aResult->mId))) ||
!ReadParam(aMsg, aIter, &(aResult->mScalarType)) ||
!ReadParam(aMsg, aIter, reinterpret_cast<uint32_t*>(&(aResult->mActionType)))) {
!ReadParam(aMsg, aIter, reinterpret_cast<uint32_t*>(&(aResult->mActionType))) ||
!ReadParam(aMsg, aIter, &scalarType)) {
return false;
}
// De-serialize the data based on the scalar type.
nsCOMPtr<nsIWritableVariant> outVar(new nsVariant());
switch (aResult->mScalarType)
switch (scalarType)
{
case nsITelemetry::SCALAR_COUNT:
{
uint32_t data = 0;
// De-serialize the data.
if (!ReadParam(aMsg, aIter, &data) ||
NS_FAILED(outVar->SetAsUint32(data))) {
if (!ReadParam(aMsg, aIter, &data)) {
return false;
}
aResult->mData = mozilla::Some(mozilla::AsVariant(data));
break;
}
case nsITelemetry::SCALAR_STRING:
{
nsAutoString data;
nsString data;
// De-serialize the data.
if (!ReadParam(aMsg, aIter, &data) ||
NS_FAILED(outVar->SetAsAString(data))) {
if (!ReadParam(aMsg, aIter, &data)) {
return false;
}
aResult->mData = mozilla::Some(mozilla::AsVariant(data));
break;
}
case nsITelemetry::SCALAR_BOOLEAN:
{
bool data = false;
// De-serialize the data.
if (!ReadParam(aMsg, aIter, &data) ||
NS_FAILED(outVar->SetAsBool(data))) {
if (!ReadParam(aMsg, aIter, &data)) {
return false;
}
aResult->mData = mozilla::Some(mozilla::AsVariant(data));
break;
}
default:
@ -212,7 +197,6 @@ ParamTraits<mozilla::Telemetry::ScalarAction>
return false;
}
aResult->mData = outVar.forget();
return true;
}
};
@ -230,67 +214,53 @@ ParamTraits<mozilla::Telemetry::KeyedScalarAction>
{
// Write the message type
aMsg->WriteUInt32(static_cast<uint32_t>(aParam.mId));
WriteParam(aMsg, aParam.mScalarType);
WriteParam(aMsg, static_cast<uint32_t>(aParam.mActionType));
WriteParam(aMsg, aParam.mKey);
switch(aParam.mScalarType) {
case nsITelemetry::SCALAR_COUNT:
{
uint32_t val = 0;
nsresult rv = aParam.mData->GetAsUint32(&val);
if (NS_FAILED(rv)) {
MOZ_ASSERT(false, "Keyed Count Scalar unable to convert variant to uint from child process.");
return;
}
WriteParam(aMsg, val);
break;
}
case nsITelemetry::SCALAR_STRING:
{
// Keyed string scalars are not supported.
MOZ_ASSERT(false, "Keyed String Scalar unable to be write from child process. Not supported.");
break;
}
case nsITelemetry::SCALAR_BOOLEAN:
{
bool val = 0;
nsresult rv = aParam.mData->GetAsBool(&val);
if (NS_FAILED(rv)) {
MOZ_ASSERT(false, "Keyed Boolean Scalar unable to convert variant to bool from child process.");
return;
}
WriteParam(aMsg, val);
break;
}
default:
MOZ_ASSERT(false, "Unknown keyed scalar type.");
if (aParam.mData.isNothing()) {
MOZ_CRASH("There is no data in the KeyedScalarAction.");
return;
}
if (aParam.mData->is<uint32_t>()) {
// That's a nsITelemetry::SCALAR_COUNT.
WriteParam(aMsg, static_cast<uint32_t>(nsITelemetry::SCALAR_COUNT));
WriteParam(aMsg, aParam.mData->as<uint32_t>());
} else if (aParam.mData->is<nsString>()) {
// That's a nsITelemetry::SCALAR_STRING.
// Keyed string scalars are not supported.
MOZ_ASSERT(false, "Keyed String Scalar unable to be write from child process. Not supported.");
} else if (aParam.mData->is<bool>()) {
// That's a nsITelemetry::SCALAR_BOOLEAN.
WriteParam(aMsg, static_cast<uint32_t>(nsITelemetry::SCALAR_BOOLEAN));
WriteParam(aMsg, aParam.mData->as<bool>());
} else {
MOZ_CRASH("Unknown keyed scalar type.");
}
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
// Read the scalar ID and the scalar type.
uint32_t scalarType = 0;
if (!aMsg->ReadUInt32(aIter, reinterpret_cast<uint32_t*>(&(aResult->mId))) ||
!ReadParam(aMsg, aIter, &(aResult->mScalarType)) ||
!ReadParam(aMsg, aIter, reinterpret_cast<uint32_t*>(&(aResult->mActionType))) ||
!ReadParam(aMsg, aIter, &(aResult->mKey))) {
!ReadParam(aMsg, aIter, &(aResult->mKey)) ||
!ReadParam(aMsg, aIter, &scalarType)) {
return false;
}
// De-serialize the data based on the scalar type.
nsCOMPtr<nsIWritableVariant> outVar(new nsVariant());
switch (aResult->mScalarType)
switch (scalarType)
{
case nsITelemetry::SCALAR_COUNT:
{
uint32_t data = 0;
// De-serialize the data.
if (!ReadParam(aMsg, aIter, &data) ||
NS_FAILED(outVar->SetAsUint32(data))) {
if (!ReadParam(aMsg, aIter, &data)) {
return false;
}
aResult->mData = mozilla::Some(mozilla::AsVariant(data));
break;
}
case nsITelemetry::SCALAR_STRING:
@ -303,10 +273,10 @@ ParamTraits<mozilla::Telemetry::KeyedScalarAction>
{
bool data = false;
// De-serialize the data.
if (!ReadParam(aMsg, aIter, &data) ||
NS_FAILED(outVar->SetAsBool(data))) {
if (!ReadParam(aMsg, aIter, &data)) {
return false;
}
aResult->mData = mozilla::Some(mozilla::AsVariant(data));
break;
}
default:
@ -314,7 +284,6 @@ ParamTraits<mozilla::Telemetry::KeyedScalarAction>
return false;
}
aResult->mData = outVar.forget();
return true;
}
};

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

@ -26,6 +26,7 @@ using mozilla::Telemetry::KeyedAccumulation;
using mozilla::Telemetry::ScalarActionType;
using mozilla::Telemetry::ScalarAction;
using mozilla::Telemetry::KeyedScalarAction;
using mozilla::Telemetry::ScalarVariant;
// Sending each remote accumulation immediately places undue strain on the
// IPC subsystem. Batch the remote accumulations for a period of time before
@ -134,8 +135,8 @@ TelemetryIPCAccumulator::AccumulateChildKeyedHistogram(mozilla::Telemetry::ID aI
}
void
TelemetryIPCAccumulator::RecordChildScalarAction(mozilla::Telemetry::ScalarID aId, uint32_t aKind,
ScalarActionType aAction, nsIVariant* aValue)
TelemetryIPCAccumulator::RecordChildScalarAction(mozilla::Telemetry::ScalarID aId,
ScalarActionType aAction, const ScalarVariant& aValue)
{
StaticMutexAutoLock locker(gTelemetryIPCAccumulatorMutex);
// Make sure to have the storage.
@ -143,14 +144,15 @@ TelemetryIPCAccumulator::RecordChildScalarAction(mozilla::Telemetry::ScalarID aI
gChildScalarsActions = new nsTArray<ScalarAction>();
}
// Store the action.
gChildScalarsActions->AppendElement(ScalarAction{aId, aKind, aAction, aValue});
gChildScalarsActions->AppendElement(ScalarAction{aId, aAction, Some(aValue)});
ArmIPCTimer(locker);
}
void
TelemetryIPCAccumulator::RecordChildKeyedScalarAction(mozilla::Telemetry::ScalarID aId,
const nsAString& aKey, uint32_t aKind,
ScalarActionType aAction, nsIVariant* aValue)
const nsAString& aKey,
ScalarActionType aAction,
const ScalarVariant& aValue)
{
StaticMutexAutoLock locker(gTelemetryIPCAccumulatorMutex);
// Make sure to have the storage.
@ -159,7 +161,7 @@ TelemetryIPCAccumulator::RecordChildKeyedScalarAction(mozilla::Telemetry::Scalar
}
// Store the action.
gChildKeyedScalarsActions->AppendElement(
KeyedScalarAction{aId, aKind, aAction, NS_ConvertUTF16toUTF8(aKey), aValue});
KeyedScalarAction{aId, aAction, NS_ConvertUTF16toUTF8(aKey), Some(aValue)});
ArmIPCTimer(locker);
}

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

@ -7,22 +7,12 @@
#define TelemetryIPCAccumulator_h__
#include "mozilla/AlreadyAddRefed.h"
#include "TelemetryComms.h"
class nsIRunnable;
class nsITimer;
class nsAString;
class nsCString;
class nsIVariant;
namespace mozilla {
namespace Telemetry {
enum ID : uint32_t;
enum class ScalarID : uint32_t;
enum class ScalarActionType : uint32_t;
} // Telemetry
} // mozilla
namespace TelemetryIPCAccumulator {
@ -32,12 +22,13 @@ void AccumulateChildKeyedHistogram(mozilla::Telemetry::ID aId, const nsCString&
uint32_t aSample);
// Scalar accumulation functions.
void RecordChildScalarAction(mozilla::Telemetry::ScalarID aId, uint32_t aKind,
mozilla::Telemetry::ScalarActionType aAction, nsIVariant* aValue);
void RecordChildScalarAction(mozilla::Telemetry::ScalarID aId,
mozilla::Telemetry::ScalarActionType aAction,
const mozilla::Telemetry::ScalarVariant& aValue);
void RecordChildKeyedScalarAction(mozilla::Telemetry::ScalarID aId, const nsAString& aKey,
uint32_t aKind, mozilla::Telemetry::ScalarActionType aAction,
nsIVariant* aValue);
mozilla::Telemetry::ScalarActionType aAction,
const mozilla::Telemetry::ScalarVariant& aValue);
void IPCTimerFired(nsITimer* aTimer, void* aClosure);
void DeInitializeGlobalState();

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

@ -31,6 +31,7 @@ using mozilla::Telemetry::Common::CanRecordDataset;
using mozilla::Telemetry::Common::IsInDataset;
using mozilla::Telemetry::Common::LogToBrowserConsole;
using mozilla::Telemetry::ScalarActionType;
using mozilla::Telemetry::ScalarVariant;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -114,43 +115,49 @@ IsValidEnumId(mozilla::Telemetry::ScalarID aID)
}
/**
* The following helpers are used to get a nsIVariant from a uint32_t,
* nsAString or bool data.
* Convert a nsIVariant to a mozilla::Variant, which is used for
* accumulating child process scalars.
*/
nsresult
GetVariant(uint32_t aValue, nsCOMPtr<nsIVariant>& aResult)
ScalarResult
GetVariantFromIVariant(nsIVariant* aInput, uint32_t aScalarKind,
mozilla::Maybe<ScalarVariant>& aOutput)
{
nsCOMPtr<nsIWritableVariant> outVar(new nsVariant());
nsresult rv = outVar->SetAsUint32(aValue);
if (NS_FAILED(rv)) {
return rv;
switch (aScalarKind) {
case nsITelemetry::SCALAR_COUNT:
{
uint32_t val = 0;
nsresult rv = aInput->GetAsUint32(&val);
if (NS_FAILED(rv)) {
return ScalarResult::CannotUnpackVariant;
}
aOutput = mozilla::Some(mozilla::AsVariant(val));
break;
}
case nsITelemetry::SCALAR_STRING:
{
nsString val;
nsresult rv = aInput->GetAsAString(val);
if (NS_FAILED(rv)) {
return ScalarResult::CannotUnpackVariant;
}
aOutput = mozilla::Some(mozilla::AsVariant(val));
break;
}
case nsITelemetry::SCALAR_BOOLEAN:
{
bool val = false;
nsresult rv = aInput->GetAsBool(&val);
if (NS_FAILED(rv)) {
return ScalarResult::CannotUnpackVariant;
}
aOutput = mozilla::Some(mozilla::AsVariant(val));
break;
}
default:
MOZ_ASSERT(false, "Unknown scalar kind.");
return ScalarResult::UnknownScalar;
}
aResult = outVar.forget();
return NS_OK;
}
nsresult
GetVariant(const nsAString& aValue, nsCOMPtr<nsIVariant>& aResult)
{
nsCOMPtr<nsIWritableVariant> outVar(new nsVariant());
nsresult rv = outVar->SetAsAString(aValue);
if (NS_FAILED(rv)) {
return rv;
}
aResult = outVar.forget();
return NS_OK;
}
nsresult
GetVariant(bool aValue, nsCOMPtr<nsIVariant>& aResult)
{
nsCOMPtr<nsIWritableVariant> outVar(new nsVariant());
nsresult rv = outVar->SetAsBool(aValue);
if (NS_FAILED(rv)) {
return rv;
}
aResult = outVar.forget();
return NS_OK;
return ScalarResult::Ok;
}
// Implements the methods for ScalarInfo.
@ -307,7 +314,13 @@ ScalarUnsigned::SetMaximum(uint32_t aValue)
nsresult
ScalarUnsigned::GetValue(nsCOMPtr<nsIVariant>& aResult) const
{
return GetVariant(mStorage, aResult);
nsCOMPtr<nsIWritableVariant> outVar(new nsVariant());
nsresult rv = outVar->SetAsUint32(mStorage);
if (NS_FAILED(rv)) {
return rv;
}
aResult = outVar.forget();
return NS_OK;
}
size_t
@ -402,7 +415,13 @@ ScalarString::SetValue(const nsAString& aValue)
nsresult
ScalarString::GetValue(nsCOMPtr<nsIVariant>& aResult) const
{
return GetVariant(mStorage, aResult);
nsCOMPtr<nsIWritableVariant> outVar(new nsVariant());
nsresult rv = outVar->SetAsAString(mStorage);
if (NS_FAILED(rv)) {
return rv;
}
aResult = outVar.forget();
return NS_OK;
}
size_t
@ -470,7 +489,13 @@ ScalarBoolean::SetValue(bool aValue)
nsresult
ScalarBoolean::GetValue(nsCOMPtr<nsIVariant>& aResult) const
{
return GetVariant(mStorage, aResult);
nsCOMPtr<nsIWritableVariant> outVar(new nsVariant());
nsresult rv = outVar->SetAsBool(mStorage);
if (NS_FAILED(rv)) {
return rv;
}
aResult = outVar.forget();
return NS_OK;
}
size_t
@ -1046,7 +1071,14 @@ internal_UpdateScalar(const nsACString& aName, ScalarActionType aType,
// Accumulate in the child process if needed.
if (!XRE_IsParentProcess()) {
const ScalarInfo &info = gScalars[static_cast<uint32_t>(id)];
TelemetryIPCAccumulator::RecordChildScalarAction(id, info.kind, aType, aValue);
// Convert the nsIVariant to a Variant.
mozilla::Maybe<ScalarVariant> variantValue;
sr = GetVariantFromIVariant(aValue, info.kind, variantValue);
if (sr != ScalarResult::Ok) {
MOZ_ASSERT(false, "Unable to convert nsIVariant to mozilla::Variant.");
return sr;
}
TelemetryIPCAccumulator::RecordChildScalarAction(id, aType, variantValue.ref());
return ScalarResult::Ok;
}
@ -1180,7 +1212,14 @@ internal_UpdateKeyedScalar(const nsACString& aName, const nsAString& aKey,
// Accumulate in the child process if needed.
if (!XRE_IsParentProcess()) {
const ScalarInfo &info = gScalars[static_cast<uint32_t>(id)];
TelemetryIPCAccumulator::RecordChildKeyedScalarAction(id, aKey, info.kind, aType, aValue);
// Convert the nsIVariant to a Variant.
mozilla::Maybe<ScalarVariant> variantValue;
sr = GetVariantFromIVariant(aValue, info.kind, variantValue);
if (sr != ScalarResult::Ok) {
MOZ_ASSERT(false, "Unable to convert nsIVariant to mozilla::Variant.");
return sr;
}
TelemetryIPCAccumulator::RecordChildKeyedScalarAction(id, aKey, aType, variantValue.ref());
return ScalarResult::Ok;
}
@ -1362,14 +1401,8 @@ TelemetryScalar::Add(mozilla::Telemetry::ScalarID aId, uint32_t aValue)
// Accumulate in the child process if needed.
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIVariant> scalarValue;
nsresult rv = GetVariant(aValue, scalarValue);
if (NS_FAILED(rv)) {
return;
}
const ScalarInfo &info = gScalars[static_cast<uint32_t>(aId)];
TelemetryIPCAccumulator::RecordChildScalarAction(aId, info.kind, ScalarActionType::eAdd,
scalarValue);
TelemetryIPCAccumulator::RecordChildScalarAction(aId, ScalarActionType::eAdd,
ScalarVariant(aValue));
return;
}
@ -1402,14 +1435,8 @@ TelemetryScalar::Add(mozilla::Telemetry::ScalarID aId, const nsAString& aKey,
// Accumulate in the child process if needed.
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIVariant> scalarValue;
nsresult rv = GetVariant(aValue, scalarValue);
if (NS_FAILED(rv)) {
return;
}
const ScalarInfo &info = gScalars[static_cast<uint32_t>(aId)];
TelemetryIPCAccumulator::RecordChildKeyedScalarAction(
aId, aKey, info.kind, ScalarActionType::eAdd, scalarValue);
aId, aKey, ScalarActionType::eAdd, ScalarVariant(aValue));
return;
}
@ -1512,14 +1539,8 @@ TelemetryScalar::Set(mozilla::Telemetry::ScalarID aId, uint32_t aValue)
// Accumulate in the child process if needed.
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIVariant> scalarValue;
nsresult rv = GetVariant(aValue, scalarValue);
if (NS_FAILED(rv)) {
return;
}
const ScalarInfo &info = gScalars[static_cast<uint32_t>(aId)];
TelemetryIPCAccumulator::RecordChildScalarAction(aId, info.kind, ScalarActionType::eSet,
scalarValue);
TelemetryIPCAccumulator::RecordChildScalarAction(aId, ScalarActionType::eSet,
ScalarVariant(aValue));
return;
}
@ -1550,14 +1571,8 @@ TelemetryScalar::Set(mozilla::Telemetry::ScalarID aId, const nsAString& aValue)
// Accumulate in the child process if needed.
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIVariant> scalarValue;
nsresult rv = GetVariant(aValue, scalarValue);
if (NS_FAILED(rv)) {
return;
}
const ScalarInfo &info = gScalars[static_cast<uint32_t>(aId)];
TelemetryIPCAccumulator::RecordChildScalarAction(aId, info.kind, ScalarActionType::eSet,
scalarValue);
TelemetryIPCAccumulator::RecordChildScalarAction(aId, ScalarActionType::eSet,
ScalarVariant(nsString(aValue)));
return;
}
@ -1588,14 +1603,8 @@ TelemetryScalar::Set(mozilla::Telemetry::ScalarID aId, bool aValue)
// Accumulate in the child process if needed.
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIVariant> scalarValue;
nsresult rv = GetVariant(aValue, scalarValue);
if (NS_FAILED(rv)) {
return;
}
const ScalarInfo &info = gScalars[static_cast<uint32_t>(aId)];
TelemetryIPCAccumulator::RecordChildScalarAction(aId, info.kind, ScalarActionType::eSet,
scalarValue);
TelemetryIPCAccumulator::RecordChildScalarAction(aId, ScalarActionType::eSet,
ScalarVariant(aValue));
return;
}
@ -1628,14 +1637,8 @@ TelemetryScalar::Set(mozilla::Telemetry::ScalarID aId, const nsAString& aKey,
// Accumulate in the child process if needed.
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIVariant> scalarValue;
nsresult rv = GetVariant(aValue, scalarValue);
if (NS_FAILED(rv)) {
return;
}
const ScalarInfo &info = gScalars[static_cast<uint32_t>(aId)];
TelemetryIPCAccumulator::RecordChildKeyedScalarAction(
aId, aKey, info.kind, ScalarActionType::eSet, scalarValue);
aId, aKey, ScalarActionType::eSet, ScalarVariant(aValue));
return;
}
@ -1668,14 +1671,8 @@ TelemetryScalar::Set(mozilla::Telemetry::ScalarID aId, const nsAString& aKey,
// Accumulate in the child process if needed.
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIVariant> scalarValue;
nsresult rv = GetVariant(aValue, scalarValue);
if (NS_FAILED(rv)) {
return;
}
const ScalarInfo &info = gScalars[static_cast<uint32_t>(aId)];
TelemetryIPCAccumulator::RecordChildKeyedScalarAction(
aId, aKey, info.kind, ScalarActionType::eSet, scalarValue);
aId, aKey, ScalarActionType::eSet, ScalarVariant(aValue));
return;
}
@ -1778,14 +1775,8 @@ TelemetryScalar::SetMaximum(mozilla::Telemetry::ScalarID aId, uint32_t aValue)
// Accumulate in the child process if needed.
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIVariant> scalarValue;
nsresult rv = GetVariant(aValue, scalarValue);
if (NS_FAILED(rv)) {
return;
}
const ScalarInfo &info = gScalars[static_cast<uint32_t>(aId)];
TelemetryIPCAccumulator::RecordChildScalarAction(aId, info.kind, ScalarActionType::eSetMaximum,
scalarValue);
TelemetryIPCAccumulator::RecordChildScalarAction(aId, ScalarActionType::eSetMaximum,
ScalarVariant(aValue));
return;
}
@ -1818,14 +1809,8 @@ TelemetryScalar::SetMaximum(mozilla::Telemetry::ScalarID aId, const nsAString& a
// Accumulate in the child process if needed.
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIVariant> scalarValue;
nsresult rv = GetVariant(aValue, scalarValue);
if (NS_FAILED(rv)) {
return;
}
const ScalarInfo &info = gScalars[static_cast<uint32_t>(aId)];
TelemetryIPCAccumulator::RecordChildKeyedScalarAction(
aId, aKey, info.kind, ScalarActionType::eSetMaximum, scalarValue);
aId, aKey, ScalarActionType::eSetMaximum, ScalarVariant(aValue));
return;
}
@ -2143,17 +2128,54 @@ TelemetryScalar::UpdateChildData(GeckoProcessType aProcessType,
continue;
}
if (upd.mData.isNothing()) {
MOZ_ASSERT(false, "There is no data in the ScalarActionType.");
continue;
}
// Get the type of this scalar from the scalar ID. We already checked
// for its validity a few lines above.
const uint32_t scalarType = gScalars[static_cast<uint32_t>(upd.mId)].kind;
// Extract the data from the mozilla::Variant.
switch (upd.mActionType)
{
case ScalarActionType::eSet:
scalar->SetValue(upd.mData);
break;
{
switch (scalarType)
{
case nsITelemetry::SCALAR_COUNT:
scalar->SetValue(upd.mData->as<uint32_t>());
break;
case nsITelemetry::SCALAR_BOOLEAN:
scalar->SetValue(upd.mData->as<bool>());
break;
case nsITelemetry::SCALAR_STRING:
scalar->SetValue(upd.mData->as<nsString>());
break;
}
break;
}
case ScalarActionType::eAdd:
scalar->AddValue(upd.mData);
break;
{
if (scalarType != nsITelemetry::SCALAR_COUNT) {
NS_WARNING("Attempting to add on a non count scalar.");
continue;
}
// We only support adding uint32_t.
scalar->AddValue(upd.mData->as<uint32_t>());
break;
}
case ScalarActionType::eSetMaximum:
scalar->SetMaximum(upd.mData);
break;
{
if (scalarType != nsITelemetry::SCALAR_COUNT) {
NS_WARNING("Attempting to add on a non count scalar.");
continue;
}
// We only support SetMaximum on uint32_t.
scalar->SetMaximum(upd.mData->as<uint32_t>());
break;
}
default:
NS_WARNING("Unsupported action coming from scalar child updates.");
}
@ -2192,17 +2214,53 @@ TelemetryScalar::UpdateChildKeyedData(GeckoProcessType aProcessType,
continue;
}
if (upd.mData.isNothing()) {
MOZ_ASSERT(false, "There is no data in the KeyedScalarAction.");
continue;
}
// Get the type of this scalar from the scalar ID. We already checked
// for its validity a few lines above.
const uint32_t scalarType = gScalars[static_cast<uint32_t>(upd.mId)].kind;
// Extract the data from the mozilla::Variant.
switch (upd.mActionType)
{
case ScalarActionType::eSet:
scalar->SetValue(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData);
break;
{
switch (scalarType)
{
case nsITelemetry::SCALAR_COUNT:
scalar->SetValue(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<uint32_t>());
break;
case nsITelemetry::SCALAR_BOOLEAN:
scalar->SetValue(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<bool>());
break;
default:
NS_WARNING("Unsupported type coming from scalar child updates.");
}
break;
}
case ScalarActionType::eAdd:
scalar->AddValue(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData);
break;
{
if (scalarType != nsITelemetry::SCALAR_COUNT) {
NS_WARNING("Attempting to add on a non count scalar.");
continue;
}
// We only support adding on uint32_t.
scalar->AddValue(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<uint32_t>());
break;
}
case ScalarActionType::eSetMaximum:
scalar->SetMaximum(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData);
break;
{
if (scalarType != nsITelemetry::SCALAR_COUNT) {
NS_WARNING("Attempting to add on a non count scalar.");
continue;
}
// We only support SetMaximum on uint32_t.
scalar->SetMaximum(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<uint32_t>());
break;
}
default:
NS_WARNING("Unsupported action coming from keyed scalar child updates.");
}

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

@ -9,6 +9,7 @@
#include "mozilla/Unused.h"
#include "nsJSUtils.h" // nsAutoJSString
#include "nsITelemetry.h"
#include "nsThreadUtils.h"
#include "Telemetry.h"
#include "TelemetryFixture.h"
@ -293,3 +294,28 @@ TEST_F(TelemetryTestFixture, KeyedScalarBoolean) {
CheckKeyedBoolScalar(kScalarName, "key2", cx.GetJSContext(), scalarsSnapshot, true);
CheckNumberOfProperties(kScalarName, cx.GetJSContext(), scalarsSnapshot, 2);
}
TEST_F(TelemetryTestFixture, NonMainThreadAdd) {
AutoJSContextWithGlobal cx(mCleanGlobal);
Unused << mTelemetry->ClearScalars();
// Define the function that will be called on the testing thread.
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([]() -> void {
Telemetry::ScalarAdd(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, 37);
});
// Spawn the testing thread and run the function.
nsCOMPtr<nsIThread> testingThread;
nsresult rv =
NS_NewNamedThread("Test thread", getter_AddRefs(testingThread), runnable);
ASSERT_EQ(rv, NS_OK);
// Shutdown the thread. This also waits for the runnable to complete.
testingThread->Shutdown();
// Check the recorded value.
JS::RootedValue scalarsSnapshot(cx.GetJSContext());
GetScalarsSnapshot(false, cx.GetJSContext(), &scalarsSnapshot);
CheckUintScalar("telemetry.test.unsigned_int_kind", cx.GetJSContext(), scalarsSnapshot, 37);
}

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

@ -1376,10 +1376,7 @@
; behaviors depending on the windows version. The following code attempts
; to address these differences.
;
; On XP (no SP, SP1, SP2), Vista: An empty default string
; must be set under ddeexec. Empty strings propagate to CR.
;
; Win7: IE does not configure ddeexec, so issues with left over ddeexec keys
; IE does not configure ddeexec, so issues with left over ddeexec keys
; in LM are reduced. We configure an empty ddeexec key with an empty default
; string in CU to be sure.
;
@ -1450,8 +1447,7 @@
!macro RegisterDLL DLL
; The x64 regsvr32.exe registers x86 DLL's properly on Windows Vista and above
; (not on Windows XP http://support.microsoft.com/kb/282747) so just use it
; The x64 regsvr32.exe registers x86 DLL's properly so just use it
; when installing on an x64 systems even when installing an x86 application.
${If} ${RunningX64}
${DisableX64FSRedirection}
@ -1465,8 +1461,7 @@
!macro UnregisterDLL DLL
; The x64 regsvr32.exe registers x86 DLL's properly on Windows Vista and above
; (not on Windows XP http://support.microsoft.com/kb/282747) so just use it
; The x64 regsvr32.exe registers x86 DLL's properly so just use it
; when installing on an x64 systems even when installing an x86 application.
${If} ${RunningX64}
${DisableX64FSRedirection}
@ -5656,7 +5651,7 @@
# UAC Related Macros
/**
* Provides UAC elevation support for Vista and above (requires the UAC plugin).
* Provides UAC elevation support (requires the UAC plugin).
*
* $0 = return values from calls to the UAC plugin (always uses $0)
* $R9 = return values from GetParameters and GetOptions macros
@ -5680,88 +5675,84 @@
Push $0
!ifndef NONADMIN_ELEVATE
${If} ${AtLeastWinVista}
UAC::IsAdmin
; If the user is not an admin already
${If} "$0" != "1"
UAC::SupportsUAC
; If the system supports UAC
${If} "$0" == "1"
UAC::GetElevationType
; If the user account has a split token
${If} "$0" == "3"
UAC::RunElevated
UAC::Unload
; Nothing besides UAC initialized so no need to call OnEndCommon
Quit
${EndIf}
${EndIf}
${Else}
${GetParameters} $R9
${If} $R9 != ""
ClearErrors
${GetOptions} "$R9" "/UAC:" $0
; If the command line contains /UAC then we need to initialize
; the UAC plugin to use UAC::ExecCodeSegment to execute code in
; the non-elevated context.
${Unless} ${Errors}
UAC::RunElevated
${EndUnless}
${EndIf}
UAC::IsAdmin
; If the user is not an admin already
${If} "$0" != "1"
UAC::SupportsUAC
; If the system supports UAC
${If} "$0" == "1"
UAC::GetElevationType
; If the user account has a split token
${If} "$0" == "3"
UAC::RunElevated
UAC::Unload
; Nothing besides UAC initialized so no need to call OnEndCommon
Quit
${EndIf}
${EndIf}
!else
${If} ${AtLeastWinVista}
UAC::IsAdmin
; If the user is not an admin already
${If} "$0" != "1"
UAC::SupportsUAC
; If the system supports UAC require that the user elevate
${If} "$0" == "1"
UAC::GetElevationType
; If the user account has a split token
${If} "$0" == "3"
UAC::RunElevated
UAC::Unload
; Nothing besides UAC initialized so no need to call OnEndCommon
Quit
${EndIf}
${Else}
; Check if UAC is enabled. If the user has turned UAC on or off
; without rebooting this value will be incorrect. This is an
; edgecase that we have to live with when trying to allow
; installing when the user doesn't have privileges such as a public
; computer while trying to also achieve UAC elevation. When this
; happens the user will be presented with the runas dialog if the
; value is 1 and won't be presented with the UAC dialog when the
; value is 0.
ReadRegDWord $R9 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" "EnableLUA"
${If} "$R9" == "1"
; This will display the UAC version of the runas dialog which
; requires a password for an existing user account.
UAC::RunElevated
${If} "$0" == "0" ; Was elevation successful
UAC::Unload
; Nothing besides UAC initialized so no need to call OnEndCommon
Quit
${EndIf}
; Unload UAC since the elevation request was not successful and
; install anyway.
UAC::Unload
${EndIf}
${EndIf}
${Else}
${Else}
${GetParameters} $R9
${If} $R9 != ""
ClearErrors
${${_MOZFUNC_UN}GetParameters} $R9
${${_MOZFUNC_UN}GetOptions} "$R9" "/UAC:" $R9
; If the command line contains /UAC then we need to initialize the UAC
; plugin to use UAC::ExecCodeSegment to execute code in the
; non-elevated context.
${GetOptions} "$R9" "/UAC:" $0
; If the command line contains /UAC then we need to initialize
; the UAC plugin to use UAC::ExecCodeSegment to execute code in
; the non-elevated context.
${Unless} ${Errors}
UAC::RunElevated
${EndUnless}
${EndIf}
${EndIf}
!else
UAC::IsAdmin
; If the user is not an admin already
${If} "$0" != "1"
UAC::SupportsUAC
; If the system supports UAC require that the user elevate
${If} "$0" == "1"
UAC::GetElevationType
; If the user account has a split token
${If} "$0" == "3"
UAC::RunElevated
UAC::Unload
; Nothing besides UAC initialized so no need to call OnEndCommon
Quit
${EndIf}
${Else}
; Check if UAC is enabled. If the user has turned UAC on or off
; without rebooting this value will be incorrect. This is an
; edgecase that we have to live with when trying to allow
; installing when the user doesn't have privileges such as a public
; computer while trying to also achieve UAC elevation. When this
; happens the user will be presented with the runas dialog if the
; value is 1 and won't be presented with the UAC dialog when the
; value is 0.
ReadRegDWord $R9 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" "EnableLUA"
${If} "$R9" == "1"
; This will display the UAC version of the runas dialog which
; requires a password for an existing user account.
UAC::RunElevated
${If} "$0" == "0" ; Was elevation successful
UAC::Unload
; Nothing besides UAC initialized so no need to call OnEndCommon
Quit
${EndIf}
; Unload UAC since the elevation request was not successful and
; install anyway.
UAC::Unload
${EndIf}
${EndIf}
${Else}
ClearErrors
${${_MOZFUNC_UN}GetParameters} $R9
${${_MOZFUNC_UN}GetOptions} "$R9" "/UAC:" $R9
; If the command line contains /UAC then we need to initialize the UAC
; plugin to use UAC::ExecCodeSegment to execute code in the
; non-elevated context.
${Unless} ${Errors}
UAC::RunElevated
${EndUnless}
${EndIf}
!endif
ClearErrors
@ -5824,10 +5815,6 @@
!define ${_MOZFUNC_UN}UnloadUAC "!insertmacro ${_MOZFUNC_UN}UnloadUACCall"
Function ${_MOZFUNC_UN}UnloadUAC
${Unless} ${AtLeastWinVista}
Return
${EndUnless}
Push $R9
ClearErrors
@ -5957,13 +5944,7 @@
${LogMsg} "App Version: $R8"
${LogMsg} "GRE Version: $R9"
${If} ${IsWinXP}
${LogMsg} "OS Name : Windows XP"
${ElseIf} ${IsWin2003}
${LogMsg} "OS Name : Windows 2003"
${ElseIf} ${IsWinVista}
${LogMsg} "OS Name : Windows Vista"
${ElseIf} ${IsWin7}
${If} ${IsWin7}
${LogMsg} "OS Name : Windows 7"
${ElseIf} ${IsWin8}
${LogMsg} "OS Name : Windows 8"
@ -6445,8 +6426,8 @@
# Macros for managing specific Windows version features
/**
* Sets the permitted layered service provider (LSP) categories on Windows
* Vista and above for the application. Consumers should call this after an
* Sets the permitted layered service provider (LSP) categories
* for the application. Consumers should call this after an
* installation log section has completed since this macro will log the results
* to the installation log along with a header.
*
@ -6479,10 +6460,6 @@
!define ${_MOZFUNC_UN}SetAppLSPCategories "!insertmacro ${_MOZFUNC_UN}SetAppLSPCategoriesCall"
Function ${_MOZFUNC_UN}SetAppLSPCategories
${Unless} ${AtLeastWinVista}
Return
${EndUnless}
Exch $R9
Push $R8
Push $R7

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

@ -44,7 +44,7 @@ media/sphinxbase/
media/webrtc/trunk/
memory/jemalloc/src/
mfbt/decimal/
mfbt/double-conversion/
mfbt/double-conversion/source/
mfbt/lz4
mobile/android/thirdparty/
modules/brotli/