From 3df65b3ab1783fd9273454cb030e2fda27de2c52 Mon Sep 17 00:00:00 2001 From: Simon Lewis Date: Tue, 20 Aug 2024 09:45:42 -0700 Subject: [PATCH] Update serialization for NSURLRequest https://bugs.webkit.org/show_bug.cgi?id=278024 rdar://133775452 Reviewed by Alex Christensen. Increase platforms to WatchOS and tvOS. * Source/WTF/wtf/PlatformHave.h: * Source/WebKit/Shared/Cocoa/CoreIPCNSURLRequest.mm: (WebKit::CoreIPCNSURLRequest::toID const): Canonical link: https://commits.webkit.org/282499@main --- Source/WTF/wtf/PlatformHave.h | 4 +++- Source/WebKit/Shared/Cocoa/CoreIPCNSURLRequest.mm | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/WTF/wtf/PlatformHave.h b/Source/WTF/wtf/PlatformHave.h index 637781620700e..41879f52ce803 100644 --- a/Source/WTF/wtf/PlatformHave.h +++ b/Source/WTF/wtf/PlatformHave.h @@ -1437,7 +1437,9 @@ #if ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 150000) \ || ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 180000) \ - || (PLATFORM(VISION) && __VISION_OS_VERSION_MIN_REQUIRED >= 20000)) + || (PLATFORM(VISION) && __VISION_OS_VERSION_MIN_REQUIRED >= 20000)) \ + || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 110000) \ + || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 180000) #define HAVE_WK_SECURE_CODING_NSURLREQUEST 1 #endif diff --git a/Source/WebKit/Shared/Cocoa/CoreIPCNSURLRequest.mm b/Source/WebKit/Shared/Cocoa/CoreIPCNSURLRequest.mm index c526dab32eba8..061c820efd879 100644 --- a/Source/WebKit/Shared/Cocoa/CoreIPCNSURLRequest.mm +++ b/Source/WebKit/Shared/Cocoa/CoreIPCNSURLRequest.mm @@ -222,7 +222,7 @@ - (instancetype)_initWithWebKitPropertyListData:(NSDictionary *)plist; RetainPtr CoreIPCNSURLRequest::toID() const { - auto dict = adoptNS([[NSMutableDictionary alloc] initWithCapacity:19]); + auto dict = adoptNS([[NSMutableDictionary alloc] initWithCapacity:43]); // Initialized with the count of members in CoreIPCNSURLRequestData SET_DICT_FROM_OPTIONAL_MEMBER(protocolProperties); SET_DICT_FROM_PRIMITIVE(isMutable, NSNumber, Bool); @@ -310,7 +310,7 @@ - (instancetype)_initWithWebKitPropertyListData:(NSDictionary *)plist; SET_DICT_FROM_PRIMITIVE(isWebSearchContent, NSInteger, Bool); if (m_data.contentDispositionEncodingFallbackArray) { - auto array = adoptNS([[NSMutableArray alloc] initWithCapacity:(*m_data.contentDispositionEncodingFallbackArray).size()]); + auto array = adoptNS([[NSMutableArray alloc] initWithCapacity:m_data.contentDispositionEncodingFallbackArray->size()]); for (auto& value : *m_data.contentDispositionEncodingFallbackArray) [array addObject:value.toID().get()]; [dict setObject:array.get() forKey:@"contentDispositionEncodingFallbackArray"];