Bug 1608213 - Add redirection for GetThemeMetric, r=jlast.

Differential Revision: https://phabricator.services.mozilla.com/D59390

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brian Hackett 2020-01-09 19:12:24 +00:00
Родитель de90ee3e51
Коммит 24d0620f93
1 изменённых файлов: 60 добавлений и 90 удалений

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

@ -2186,13 +2186,12 @@ static SystemRedirection gSystemRedirections[] = {
nullptr, nullptr, Preamble_WaitForever},
{"socketpair",
RR_SaveRvalHadErrorNegative<RR_WriteBufferFixedSize<3, 2 * sizeof(int)>>},
{"fileport_makeport",
RR_SaveRvalHadErrorNegative<RR_WriteBufferFixedSize<1, sizeof(size_t)>>},
{"fileport_makeport", RR_SaveRvalHadErrorNegative<RR_OutParam<1, size_t>>},
{"getsockopt", RR_SaveRvalHadErrorNegative<RR_getsockopt>},
{"gettimeofday",
RR_SaveRvalHadErrorNegative<RR_Compose<
RR_WriteOptionalBufferFixedSize<0, sizeof(struct timeval)>,
RR_WriteOptionalBufferFixedSize<1, sizeof(struct timezone)>>>,
RR_OutParam<0, struct timeval>,
RR_OutParam<1, struct timezone>>>,
nullptr, nullptr, Preamble_PassThrough},
{"getuid", RR_ScalarRval},
{"geteuid", RR_ScalarRval},
@ -2204,56 +2203,41 @@ static SystemRedirection gSystemRedirections[] = {
{"fcntl", RR_SaveRvalHadErrorNegative, Preamble_fcntl, nullptr,
MiddlemanPreamble_fcntl},
{"getattrlist", RR_SaveRvalHadErrorNegative<RR_WriteBuffer<2, 3>>},
{"fstat$INODE64",
RR_SaveRvalHadErrorNegative<
RR_WriteBufferFixedSize<1, sizeof(struct stat)>>,
{"fstat$INODE64", RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct stat>>,
nullptr, nullptr, Preamble_SetError},
{"lstat$INODE64",
RR_SaveRvalHadErrorNegative<
RR_WriteBufferFixedSize<1, sizeof(struct stat)>>,
{"lstat$INODE64", RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct stat>>,
nullptr, nullptr, Preamble_SetError},
{"stat$INODE64",
RR_SaveRvalHadErrorNegative<
RR_WriteBufferFixedSize<1, sizeof(struct stat)>>,
{"stat$INODE64", RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct stat>>,
nullptr, nullptr, Preamble_SetError},
{"statfs$INODE64",
RR_SaveRvalHadErrorNegative<
RR_WriteBufferFixedSize<1, sizeof(struct statfs)>>,
RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct statfs>>,
nullptr, nullptr, Preamble_SetError},
{"fstatfs$INODE64",
RR_SaveRvalHadErrorNegative<
RR_WriteBufferFixedSize<1, sizeof(struct statfs)>>,
RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct statfs>>,
nullptr, nullptr, Preamble_SetError},
{"readlink", RR_SaveRvalHadErrorNegative<RR_WriteBuffer<1, 2>>},
{"__getdirentries64",
RR_SaveRvalHadErrorNegative<RR_Compose<
RR_WriteBuffer<1, 2>, RR_WriteBufferFixedSize<3, sizeof(size_t)>>>},
RR_WriteBuffer<1, 2>, RR_OutParam<3, size_t>>>},
{"getdirentriesattr",
RR_SaveRvalHadErrorNegative<RR_Compose<
RR_WriteBufferFixedSize<1, sizeof(struct attrlist)>,
RR_WriteBuffer<2, 3>, RR_WriteBufferFixedSize<4, sizeof(size_t)>,
RR_WriteBufferFixedSize<5, sizeof(size_t)>,
RR_WriteBufferFixedSize<6, sizeof(size_t)>>>},
{"getrusage",
RR_SaveRvalHadErrorNegative<
RR_WriteBufferFixedSize<1, sizeof(struct rusage)>>,
RR_WriteBuffer<2, 3>,
RR_OutParam<4, size_t>,
RR_OutParam<5, size_t>,
RR_OutParam<6, size_t>>>},
{"getrusage", RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct rusage>>,
nullptr, nullptr, Preamble_SetError},
{"getrlimit", RR_SaveRvalHadErrorNegative<
RR_WriteBufferFixedSize<1, sizeof(struct rlimit)>>},
{"getrlimit", RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct rlimit>>},
{"setrlimit", RR_SaveRvalHadErrorNegative},
{"sigprocmask",
RR_SaveRvalHadErrorNegative<
RR_WriteOptionalBufferFixedSize<2, sizeof(sigset_t)>>,
{"sigprocmask", RR_SaveRvalHadErrorNegative<RR_OutParam<2, sigset_t>>,
nullptr, nullptr, Preamble_PassThrough},
{"sigaltstack", RR_SaveRvalHadErrorNegative<
RR_WriteOptionalBufferFixedSize<2, sizeof(stack_t)>>},
{"sigaltstack", RR_SaveRvalHadErrorNegative<RR_OutParam<2, stack_t>>},
{"sigaction",
RR_SaveRvalHadErrorNegative<
RR_WriteOptionalBufferFixedSize<2, sizeof(struct sigaction)>>},
RR_SaveRvalHadErrorNegative<RR_OutParam<2, struct sigaction>>},
{"signal", RR_ScalarRval},
{"__pthread_sigmask",
RR_SaveRvalHadErrorNegative<
RR_WriteOptionalBufferFixedSize<2, sizeof(sigset_t)>>},
RR_SaveRvalHadErrorNegative<RR_OutParam<2, sigset_t>>},
{"__fsgetpath", RR_SaveRvalHadErrorNegative<RR_WriteBuffer<0, 1>>},
{"sysconf", RR_ScalarRval},
{"__sysctl", RR_SaveRvalHadErrorNegative<RR_sysctl<2>>},
@ -2263,20 +2247,19 @@ static SystemRedirection gSystemRedirections[] = {
{"__mac_syscall", RR_SaveRvalHadErrorNegative},
{"syscall", RR_SaveRvalHadErrorNegative},
{"getaudit_addr",
RR_SaveRvalHadErrorNegative<
RR_WriteBufferFixedSize<0, sizeof(auditinfo_addr_t)>>},
RR_SaveRvalHadErrorNegative<RR_OutParam<0, auditinfo_addr_t>>},
{"umask", RR_ScalarRval},
{"__select",
RR_SaveRvalHadErrorNegative<
RR_Compose<RR_WriteBufferFixedSize<1, sizeof(fd_set)>,
RR_WriteBufferFixedSize<2, sizeof(fd_set)>,
RR_WriteBufferFixedSize<3, sizeof(fd_set)>,
RR_WriteOptionalBufferFixedSize<4, sizeof(timeval)>>>,
RR_Compose<RR_OutParam<1, fd_set>,
RR_OutParam<2, fd_set>,
RR_OutParam<3, fd_set>,
RR_OutParam<4, timeval>>>,
nullptr, nullptr, Preamble_WaitForever},
{"__process_policy", RR_SaveRvalHadErrorNegative},
{"__kdebug_trace", RR_SaveRvalHadErrorNegative},
{"guarded_kqueue_np",
RR_SaveRvalHadErrorNegative<RR_WriteBufferFixedSize<0, sizeof(size_t)>>},
RR_SaveRvalHadErrorNegative<RR_OutParam<0, size_t>>},
{"csops", RR_SaveRvalHadErrorNegative<RR_WriteBuffer<2, 3>>},
{"__getlogin", RR_SaveRvalHadErrorNegative<RR_WriteBuffer<0, 1>>},
{"__workq_kernreturn", nullptr, Preamble___workq_kernreturn},
@ -2323,22 +2306,22 @@ static SystemRedirection gSystemRedirections[] = {
{"fwrite", RR_ScalarRval},
{"getenv", RR_CStringRval, Preamble_getenv, nullptr, Preamble_Veto<0>},
{"localtime_r",
RR_SaveRvalHadErrorZero<RR_Compose<
RR_WriteBufferFixedSize<1, sizeof(struct tm)>, RR_RvalIsArgument<1>>>,
RR_SaveRvalHadErrorZero<RR_Compose<RR_OutParam<1, struct tm>,
RR_RvalIsArgument<1>>>,
nullptr, nullptr, Preamble_PassThrough},
{"gmtime_r",
RR_SaveRvalHadErrorZero<RR_Compose<
RR_WriteBufferFixedSize<1, sizeof(struct tm)>, RR_RvalIsArgument<1>>>,
RR_SaveRvalHadErrorZero<RR_Compose<RR_OutParam<1, struct tm>,
RR_RvalIsArgument<1>>>,
nullptr, nullptr, Preamble_PassThrough},
{"localtime", nullptr, Preamble_localtime, nullptr, Preamble_PassThrough},
{"gmtime", nullptr, Preamble_gmtime, nullptr, Preamble_PassThrough},
{"mktime",
RR_Compose<RR_ScalarRval, RR_WriteBufferFixedSize<0, sizeof(struct tm)>>},
RR_Compose<RR_ScalarRval, RR_OutParam<0, struct tm>>},
{"setlocale", RR_CStringRval},
{"strftime", RR_Compose<RR_ScalarRval, RR_WriteBufferViaRval<0, 1, 1>>},
{"arc4random", RR_ScalarRval, nullptr, nullptr, Preamble_PassThrough},
{"arc4random_buf", RR_WriteBuffer<0, 1>},
{"bootstrap_look_up", RR_WriteBufferFixedSize<2, sizeof(mach_port_t)>},
{"bootstrap_look_up", RR_OutParam<2, mach_port_t>},
{"clock_gettime", RR_Compose<RR_ScalarRval, RR_OutParam<1, timespec>>},
{"clock_get_time",
RR_Compose<RR_ScalarRval, RR_OutParam<1, mach_timespec_t>>},
@ -2466,8 +2449,7 @@ static SystemRedirection gSystemRedirections[] = {
{"CFDictionaryGetValue", RR_ScalarRval, nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_CFTypeArg<1>, EX_CFTypeRval>},
{"CFDictionaryGetValueIfPresent",
RR_Compose<RR_ScalarRval, RR_WriteBufferFixedSize<2, sizeof(const void*)>>,
nullptr,
RR_Compose<RR_ScalarRval, RR_OutParam<2, const void*>>, nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_CFTypeArg<1>, EX_CFTypeOutputArg<2>>},
{"CFDictionaryReplaceValue", nullptr, nullptr,
EX_Compose<EX_UpdateCFTypeArg<0>, EX_CFTypeArg<1>, EX_CFTypeArg<2>>},
@ -2536,7 +2518,7 @@ static SystemRedirection gSystemRedirections[] = {
// Argument indexes are off by one here as the CFRange argument uses two
// slots.
RR_Compose<RR_ScalarRval, RR_WriteOptionalBuffer<6, 7>,
RR_WriteOptionalBufferFixedSize<8, sizeof(CFIndex)>>},
RR_OutParam<8, CFIndex>>},
{"CFStringGetCharacters",
// Argument indexes are off by one here as the CFRange argument uses two
// slots.
@ -2562,8 +2544,7 @@ static SystemRedirection gSystemRedirections[] = {
{"CFURLCreateWithString", RR_ScalarRval},
{"CFURLGetFileSystemRepresentation",
RR_Compose<RR_ScalarRval, RR_WriteBuffer<2, 3>>},
{"CFURLGetFSRef",
RR_Compose<RR_ScalarRval, RR_WriteBufferFixedSize<1, sizeof(FSRef)>>},
{"CFURLGetFSRef", RR_Compose<RR_ScalarRval, RR_OutParam<1, FSRef>>},
{"CFUUIDCreate", RR_ScalarRval, nullptr,
EX_Compose<EX_RequireDefaultAllocator<0>, EX_CreateCFTypeRval>},
{"CFUUIDCreateString", RR_ScalarRval},
@ -2841,9 +2822,9 @@ static SystemRedirection gSystemRedirections[] = {
// Argument indexes are off by one here as the CFRange argument uses two
// slots.
RR_Compose<RR_FloatRval,
RR_WriteOptionalBufferFixedSize<3, sizeof(CGFloat)>,
RR_WriteOptionalBufferFixedSize<4, sizeof(CGFloat)>,
RR_WriteOptionalBufferFixedSize<5, sizeof(CGFloat)>>,
RR_OutParam<3, CGFloat>,
RR_OutParam<4, CGFloat>,
RR_OutParam<5, CGFloat>>,
nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_ScalarArg<1>, EX_ScalarArg<2>,
EX_OutParam<3, CGFloat>, EX_OutParam<4, CGFloat>,
@ -2853,23 +2834,20 @@ static SystemRedirection gSystemRedirections[] = {
EX_StackArgumentData<sizeof(CGRect)>>},
{"FSCompareFSRefs", RR_ScalarRval},
{"FSGetVolumeInfo",
RR_Compose<RR_ScalarRval, RR_WriteBufferFixedSize<5, sizeof(HFSUniStr255)>,
RR_WriteBufferFixedSize<6, sizeof(FSRef)>>},
{"FSFindFolder",
RR_Compose<RR_ScalarRval, RR_WriteBufferFixedSize<3, sizeof(FSRef)>>},
{"Gestalt",
RR_Compose<RR_ScalarRval, RR_WriteBufferFixedSize<1, sizeof(SInt32)>>},
RR_Compose<RR_ScalarRval,
RR_OutParam<5, HFSUniStr255>,
RR_OutParam<6, FSRef>>},
{"FSFindFolder", RR_Compose<RR_ScalarRval, RR_OutParam<3, FSRef>>},
{"Gestalt", RR_Compose<RR_ScalarRval, RR_OutParam<1, SInt32>>},
{"GetEventClass", RR_ScalarRval},
{"GetCurrentEventQueue", RR_ScalarRval},
{"GetCurrentProcess",
RR_Compose<RR_ScalarRval,
RR_WriteBufferFixedSize<0, sizeof(ProcessSerialNumber)>>},
RR_Compose<RR_ScalarRval, RR_OutParam<0, ProcessSerialNumber>>},
{"GetEventAttributes", RR_ScalarRval},
{"GetEventDispatcherTarget", RR_ScalarRval},
{"GetEventKind", RR_ScalarRval},
{"HIThemeDrawButton",
RR_Compose<RR_WriteOptionalBufferFixedSize<4, sizeof(HIRect)>,
RR_ScalarRval>,
{"GetThemeMetric", RR_Compose<RR_ScalarRval, RR_OutParam<1, SInt32>>},
{"HIThemeDrawButton", RR_Compose<RR_OutParam<4, HIRect>, RR_ScalarRval>,
nullptr,
EX_Compose<EX_InParam<0, HIRect>,
EX_InParam<1, HIThemeButtonDrawInfo>,
@ -2896,9 +2874,7 @@ static SystemRedirection gSystemRedirections[] = {
EX_InParam<1, HIThemeMenuDrawInfo>,
EX_UpdateCFTypeArg<2>,
EX_ScalarArg<3>>},
{"HIThemeDrawMenuItem",
RR_Compose<RR_WriteOptionalBufferFixedSize<5, sizeof(HIRect)>,
RR_ScalarRval>,
{"HIThemeDrawMenuItem", RR_Compose<RR_OutParam<5, HIRect>, RR_ScalarRval>,
nullptr,
EX_Compose<EX_InParam<0, HIRect>,
EX_InParam<1, HIRect>,
@ -2928,7 +2904,7 @@ static SystemRedirection gSystemRedirections[] = {
EX_UpdateCFTypeArg<2>,
EX_ScalarArg<3>>},
{"HIThemeGetGrowBoxBounds",
RR_Compose<RR_ScalarRval, RR_WriteBufferFixedSize<2, sizeof(HIRect)>>,
RR_Compose<RR_ScalarRval, RR_OutParam<2, HIRect>>,
nullptr,
EX_Compose<EX_InParam<0, HIPoint>,
EX_InParam<1, HIThemeGrowBoxDrawInfo>,
@ -2938,25 +2914,21 @@ static SystemRedirection gSystemRedirections[] = {
{"IORegistryEntrySearchCFProperty", RR_ScalarRval},
{"LSCopyAllHandlersForURLScheme", RR_ScalarRval},
{"LSCopyApplicationForMIMEType",
RR_Compose<RR_ScalarRval,
RR_WriteOptionalBufferFixedSize<2, sizeof(CFURLRef)>>},
RR_Compose<RR_ScalarRval, RR_OutParam<2, CFURLRef>>},
{"LSCopyItemAttribute",
RR_Compose<RR_ScalarRval,
RR_WriteOptionalBufferFixedSize<3, sizeof(CFTypeRef)>>},
RR_Compose<RR_ScalarRval, RR_OutParam<3, CFTypeRef>>},
{"LSCopyKindStringForMIMEType",
RR_Compose<RR_ScalarRval,
RR_WriteOptionalBufferFixedSize<1, sizeof(CFStringRef)>>},
RR_Compose<RR_ScalarRval, RR_OutParam<1, CFStringRef>>},
{"LSGetApplicationForInfo",
RR_Compose<RR_ScalarRval,
RR_WriteOptionalBufferFixedSize<4, sizeof(FSRef)>,
RR_WriteOptionalBufferFixedSize<5, sizeof(CFURLRef)>>},
RR_OutParam<4, FSRef>,
RR_OutParam<5, CFURLRef>>},
{"LSGetApplicationForURL",
RR_Compose<RR_ScalarRval,
RR_WriteOptionalBufferFixedSize<2, sizeof(FSRef)>,
RR_WriteOptionalBufferFixedSize<3, sizeof(CFURLRef)>>},
RR_OutParam<2, FSRef>,
RR_OutParam<3, CFURLRef>>},
{"LSCopyDefaultApplicationURLForURL",
RR_Compose<RR_ScalarRval,
RR_WriteOptionalBufferFixedSize<2, sizeof(CFErrorRef)>>},
RR_Compose<RR_ScalarRval, RR_OutParam<2, CFErrorRef>>},
{"NSClassFromString", RR_ScalarRval, nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_CFTypeRval>},
{"NSRectFill", nullptr, nullptr, EX_NoOp},
@ -2966,17 +2938,15 @@ static SystemRedirection gSystemRedirections[] = {
{"OSSpinLockLock", nullptr, Preamble_OSSpinLockLock},
{"PMCopyPageFormat", RR_ScalarRval},
{"PMGetAdjustedPaperRect",
RR_Compose<RR_ScalarRval, RR_WriteBufferFixedSize<1, sizeof(PMRect)>>},
RR_Compose<RR_ScalarRval, RR_OutParam<1, PMRect>>},
{"PMGetPageFormatPaper",
RR_Compose<RR_ScalarRval, RR_WriteBufferFixedSize<1, sizeof(PMPaper)>>},
RR_Compose<RR_ScalarRval, RR_OutParam<1, PMPaper>>},
{"PMPageFormatCreateDataRepresentation",
RR_Compose<RR_ScalarRval, RR_WriteBufferFixedSize<1, sizeof(CFDataRef)>>},
RR_Compose<RR_ScalarRval, RR_OutParam<1, CFDataRef>>},
{"PMPageFormatCreateWithDataRepresentation",
RR_Compose<RR_ScalarRval,
RR_WriteBufferFixedSize<1, sizeof(PMPageFormat)>>},
RR_Compose<RR_ScalarRval, RR_OutParam<1, PMPageFormat>>},
{"PMPaperGetMargins",
RR_Compose<RR_ScalarRval,
RR_WriteBufferFixedSize<1, sizeof(PMPaperMargins)>>},
RR_Compose<RR_ScalarRval, RR_OutParam<1, PMPaperMargins>>},
{"ReleaseEvent", RR_ScalarRval},
{"RemoveEventFromQueue", RR_ScalarRval},
{"RetainEvent", RR_ScalarRval},