Title: [225309] trunk/Source
Revision
225309
Author
bfulg...@apple.com
Date
2017-11-29 17:40:56 -0800 (Wed, 29 Nov 2017)

Log Message

Part 2: Adopt updated NSKeyed[Un]Archiver API when available
https://bugs.webkit.org/show_bug.cgi?id=180127
<rdar://problem/35710738>

Reviewed by Simon Fraser.

The API that accepts a user-allocated NSMutableData is deprecated. Switch (for macOS 10.12 and newer)
to the modern API. Use the original API for macOS builds prior to 10.12.

Source/WebCore/PAL:

* pal/spi/cocoa/NSKeyedArchiverSPI.h:
(secureArchiver): Added.
(secureArchiverFromMutableData): Deleted.

Source/WebKit:

* Shared/Cocoa/DataDetectionResult.mm:
(WebKit::DataDetectionResult::encode const):
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::Payment>::encode):
(IPC::ArgumentCoder<WebCore::PaymentContact>::encode):
(IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode):
(IPC::ArgumentCoder<WebCore::PaymentMethod>::encode):
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode const):
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData):
(IPC::ArgumentCoder<Credential>::encodePlatformData):
(IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode):
(IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData):
* Shared/mac/WebHitTestResultData.mm:
(WebKit::WebHitTestResultData::platformEncode const):
* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _setObject:forBundleParameter:]):
(-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/PAL/ChangeLog (225308 => 225309)


--- trunk/Source/WebCore/PAL/ChangeLog	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebCore/PAL/ChangeLog	2017-11-30 01:40:56 UTC (rev 225309)
@@ -1,3 +1,18 @@
+2017-11-29  Brent Fulgham  <bfulg...@apple.com>
+
+        Part 2: Adopt updated NSKeyed[Un]Archiver API when available
+        https://bugs.webkit.org/show_bug.cgi?id=180127
+        <rdar://problem/35710738>
+
+        Reviewed by Simon Fraser.
+
+        The API that accepts a user-allocated NSMutableData is deprecated. Switch (for macOS 10.12 and newer)
+        to the modern API. Use the original API for macOS builds prior to 10.12.
+
+        * pal/spi/cocoa/NSKeyedArchiverSPI.h:
+        (secureArchiver): Added.
+        (secureArchiverFromMutableData): Deleted.
+
 2017-11-29  Alex Christensen  <achristen...@webkit.org>
 
         Fix Mac CMake build.

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h (225308 => 225309)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h	2017-11-30 01:40:56 UTC (rev 225309)
@@ -104,10 +104,14 @@
 #pragma clang diagnostic pop
 }
 
-inline RetainPtr<NSKeyedArchiver> secureArchiverFromMutableData(NSMutableData *_Nonnull mutableData)
+inline RetainPtr<NSKeyedArchiver> secureArchiver()
 {
-    NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:mutableData];
+#if USE(SECURE_ARCHIVER_API)
+    NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initRequiringSecureCoding:YES];
+#else
+    NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] init];
     [archiver setRequiresSecureCoding:YES];
+#endif
     return adoptNS(archiver);
 }
 

Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm (225308 => 225309)


--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm	2017-11-30 01:40:56 UTC (rev 225309)
@@ -72,17 +72,19 @@
     if (!nsResponse)
         return nullptr;
 
+#if USE(SECURE_ARCHIVER_API)
+    auto archiver = secureArchiver();
+    [archiver encodeObject:nsResponse forKey:LegacyWebArchiveResourceResponseKey];
+    return retainPtr((__bridge CFDataRef)archiver.get().encodedData);
+#else
+    // Because of <rdar://problem/34063313> we can't use this for encoding in older OS's.
     CFMutableDataRef responseData = CFDataCreateMutable(0, 0);
-
     auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:(NSMutableData *)responseData]);
-#if USE(SECURE_ARCHIVER_API)
-    // Because of <rdar://problem/34063313> we can't use this for encoding in older OS's.
-    [archiver setRequiresSecureCoding:YES];
-#endif
     [archiver encodeObject:nsResponse forKey:LegacyWebArchiveResourceResponseKey];
     [archiver finishEncoding];
 
     return adoptCF(responseData);
+#endif
 }
 
 }

Modified: trunk/Source/WebKit/ChangeLog (225308 => 225309)


--- trunk/Source/WebKit/ChangeLog	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebKit/ChangeLog	2017-11-30 01:40:56 UTC (rev 225309)
@@ -1,3 +1,38 @@
+2017-11-29  Brent Fulgham  <bfulg...@apple.com>
+
+        Part 2: Adopt updated NSKeyed[Un]Archiver API when available
+        https://bugs.webkit.org/show_bug.cgi?id=180127
+        <rdar://problem/35710738>
+
+        Reviewed by Simon Fraser.
+
+        The API that accepts a user-allocated NSMutableData is deprecated. Switch (for macOS 10.12 and newer)
+        to the modern API. Use the original API for macOS builds prior to 10.12.
+
+        * Shared/Cocoa/DataDetectionResult.mm:
+        (WebKit::DataDetectionResult::encode const):
+        * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+        (IPC::ArgumentCoder<WebCore::Payment>::encode):
+        (IPC::ArgumentCoder<WebCore::PaymentContact>::encode):
+        (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode):
+        (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode):
+        * Shared/ios/InteractionInformationAtPosition.mm:
+        (WebKit::InteractionInformationAtPosition::encode const):
+        * Shared/mac/WebCoreArgumentCodersMac.mm:
+        (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData):
+        (IPC::ArgumentCoder<Credential>::encodePlatformData):
+        (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode):
+        (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData):
+        * Shared/mac/WebHitTestResultData.mm:
+        (WebKit::WebHitTestResultData::platformEncode const):
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        (-[WKProcessPool _setObject:forBundleParameter:]):
+        (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]):
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
+        (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]):
+
 2017-11-29  Brady Eidson  <beid...@apple.com>
 
         When managing context startups, make ServiceWorkerJobDataIdentifier's optional.

Modified: trunk/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm (225308 => 225309)


--- trunk/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm	2017-11-30 01:40:56 UTC (rev 225309)
@@ -41,12 +41,19 @@
 
 void DataDetectionResult::encode(IPC::Encoder& encoder) const
 {
-    RetainPtr<NSMutableData> data = "" alloc] init]);
-    auto archiver = secureArchiverFromMutableData(data.get());
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
+    auto data = "" alloc] init]);
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+    [archiver setRequiresSecureCoding:YES];
     [archiver encodeObject:results.get() forKey:@"dataDetectorResults"];
     [archiver finishEncoding];
-    
-    IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));        
+
+    IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
+#else
+    auto archiver = secureArchiver();
+    [archiver encodeObject:results.get() forKey:@"dataDetectorResults"];
+    IPC::encode(encoder, reinterpret_cast<CFDataRef>(archiver.get().encodedData));
+#endif
 }
 
 bool DataDetectionResult::decode(IPC::Decoder& decoder, DataDetectionResult& result)

Modified: trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (225308 => 225309)


--- trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm	2017-11-30 01:40:56 UTC (rev 225309)
@@ -51,12 +51,22 @@
 
 void ArgumentCoder<WebCore::Payment>::encode(Encoder& encoder, const WebCore::Payment& payment)
 {
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
     auto data = "" alloc] init]);
-    auto archiver = secureArchiverFromMutableData(data.get());
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
 
+    [archiver setRequiresSecureCoding:YES];
+#else
+    auto archiver = secureArchiver();
+#endif
+
     [archiver encodeObject:payment.pkPayment() forKey:NSKeyedArchiveRootObjectKey];
     [archiver finishEncoding];
 
+#if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+    auto data = ""
+#endif
+
     encoder << DataReference(static_cast<const uint8_t*>([data bytes]), [data length]);
 }
 
@@ -103,12 +113,22 @@
 
 void ArgumentCoder<WebCore::PaymentContact>::encode(Encoder& encoder, const WebCore::PaymentContact& paymentContact)
 {
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
     auto data = "" alloc] init]);
-    auto archiver = secureArchiverFromMutableData(data.get());
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
 
+    [archiver setRequiresSecureCoding:YES];
+#else
+    auto archiver = secureArchiver();
+#endif
+
     [archiver encodeObject:paymentContact.pkContact() forKey:NSKeyedArchiveRootObjectKey];
     [archiver finishEncoding];
 
+#if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+    auto data = ""
+#endif
+
     encoder << DataReference(static_cast<const uint8_t*>([data bytes]), [data length]);
 }
 
@@ -161,12 +181,22 @@
 
 void ArgumentCoder<WebCore::PaymentMerchantSession>::encode(Encoder& encoder, const WebCore::PaymentMerchantSession& paymentMerchantSession)
 {
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
     auto data = "" alloc] init]);
-    auto archiver = secureArchiverFromMutableData(data.get());
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
 
+    [archiver setRequiresSecureCoding:YES];
+#else
+    auto archiver = secureArchiver();
+#endif
+
     [archiver encodeObject:paymentMerchantSession.pkPaymentMerchantSession() forKey:NSKeyedArchiveRootObjectKey];
     [archiver finishEncoding];
 
+#if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+    auto data = ""
+#endif
+
     encoder << DataReference(static_cast<const uint8_t*>([data bytes]), [data length]);
 }
 
@@ -192,12 +222,22 @@
 
 void ArgumentCoder<WebCore::PaymentMethod>::encode(Encoder& encoder, const WebCore::PaymentMethod& paymentMethod)
 {
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
     auto data = "" alloc] init]);
-    auto archiver = secureArchiverFromMutableData(data.get());
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
 
+    [archiver setRequiresSecureCoding:YES];
+#else
+    auto archiver = secureArchiver();
+#endif
+
     [archiver encodeObject:paymentMethod.pkPaymentMethod() forKey:NSKeyedArchiveRootObjectKey];
     [archiver finishEncoding];
 
+#if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+    auto data = ""
+#endif
+
     encoder << DataReference(static_cast<const uint8_t*>([data bytes]), [data length]);
 }
 

Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm (225308 => 225309)


--- trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm	2017-11-30 01:40:56 UTC (rev 225309)
@@ -73,12 +73,19 @@
     encoder << isDataDetectorLink;
     if (isDataDetectorLink) {
         encoder << dataDetectorIdentifier;
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
         RetainPtr<NSMutableData> data = "" alloc] init]);
         auto archiver = secureArchiverFromMutableData(data.get());
         [archiver encodeObject:dataDetectorResults.get() forKey:@"dataDetectorResults"];
         [archiver finishEncoding];
         
-        IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));        
+        IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
+#else
+        auto archiver = secureArchiver();
+        [archiver encodeObject:dataDetectorResults.get() forKey:@"dataDetectorResults"];
+
+        IPC::encode(encoder, reinterpret_cast<CFDataRef>(archiver.get().encodedData));
+#endif
     }
 #endif
 }

Modified: trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm (225308 => 225309)


--- trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm	2017-11-30 01:40:56 UTC (rev 225309)
@@ -429,11 +429,18 @@
 
 void ArgumentCoder<ProtectionSpace>::encodePlatformData(Encoder& encoder, const ProtectionSpace& space)
 {
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
     auto data = "" alloc] init]);
-    auto archiver = secureArchiverFromMutableData(data.get());
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+    [archiver setRequiresSecureCoding:YES];
     [archiver encodeObject:space.nsSpace() forKey:@"protectionSpace"];
     [archiver finishEncoding];
     IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
+#else
+    auto archiver = secureArchiver();
+    [archiver encodeObject:space.nsSpace() forKey:@"protectionSpace"];
+    IPC::encode(encoder, reinterpret_cast<CFDataRef>(archiver.get().encodedData));
+#endif
 }
 
 bool ArgumentCoder<ProtectionSpace>::decodePlatformData(Decoder& decoder, ProtectionSpace& space)
@@ -474,11 +481,19 @@
     }
 
     encoder << false;
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
     auto data = "" alloc] init]);
-    auto archiver = secureArchiverFromMutableData(data.get());
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+    [archiver setRequiresSecureCoding:YES];
     [archiver encodeObject:nsCredential forKey:@"credential"];
     [archiver finishEncoding];
     IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
+#else
+    auto archiver = secureArchiver();
+    [archiver encodeObject:nsCredential forKey:@"credential"];
+    IPC::encode(encoder, reinterpret_cast<CFDataRef>(archiver.get().encodedData));
+#endif
 }
 
 bool ArgumentCoder<Credential>::decodePlatformData(Decoder& decoder, Credential& credential)
@@ -575,11 +590,18 @@
 #if ENABLE(CONTENT_FILTERING)
 void ArgumentCoder<ContentFilterUnblockHandler>::encode(Encoder& encoder, const ContentFilterUnblockHandler& contentFilterUnblockHandler)
 {
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
     auto data = "" alloc] init]);
-    auto archiver = secureArchiverFromMutableData(data.get());
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+    [archiver setRequiresSecureCoding:YES];
     contentFilterUnblockHandler.encode(archiver.get());
     [archiver finishEncoding];
     IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
+#else
+    auto archiver = secureArchiver();
+    contentFilterUnblockHandler.encode(archiver.get());
+    IPC::encode(encoder, reinterpret_cast<CFDataRef>(archiver.get().encodedData));
+#endif
 }
 
 bool ArgumentCoder<ContentFilterUnblockHandler>::decode(Decoder& decoder, ContentFilterUnblockHandler& contentFilterUnblockHandler)
@@ -607,8 +629,10 @@
 
 void ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData(Encoder& encoder, const MediaPlaybackTargetContext& target)
 {
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
     auto data = "" alloc] init]);
-    auto archiver = secureArchiverFromMutableData(data.get());
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+    [archiver setRequiresSecureCoding:YES];
 
     if ([getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])
         [archiver encodeObject:target.avOutputContext() forKey:deviceContextKey()];
@@ -615,7 +639,14 @@
 
     [archiver finishEncoding];
     IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
+#else
+    auto archiver = secureArchiver();
 
+    if ([getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])
+        [archiver encodeObject:target.avOutputContext() forKey:deviceContextKey()];
+
+    IPC::encode(encoder, reinterpret_cast<CFDataRef>(archiver.get().encodedData));
+#endif
 }
 
 bool ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData(Decoder& decoder, MediaPlaybackTargetContext& target)

Modified: trunk/Source/WebKit/Shared/mac/WebHitTestResultData.mm (225308 => 225309)


--- trunk/Source/WebKit/Shared/mac/WebHitTestResultData.mm	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebKit/Shared/mac/WebHitTestResultData.mm	2017-11-30 01:40:56 UTC (rev 225309)
@@ -45,13 +45,21 @@
     if (!hasActionContext)
         return;
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
     auto data = "" alloc] init]);
-    auto archiver = secureArchiverFromMutableData(data.get());
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+    [archiver setRequiresSecureCoding:YES];
     [archiver encodeObject:detectedDataActionContext.get() forKey:@"actionContext"];
     [archiver finishEncoding];
 
     IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
+#else
+    auto archiver = secureArchiver();
+    [archiver encodeObject:detectedDataActionContext.get() forKey:@"actionContext"];
 
+    IPC::encode(encoder, reinterpret_cast<CFDataRef>(archiver.get().encodedData));
+#endif
+
     encoder << detectedDataBoundingBox;
     encoder << detectedDataOriginatingPageOverlay;
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm (225308 => 225309)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm	2017-11-30 01:40:56 UTC (rev 225309)
@@ -213,8 +213,13 @@
 {
     auto copy = adoptNS([(NSObject *)object copy]);
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
     auto data = "" alloc] init]);
-    auto keyedArchiver = secureArchiverFromMutableData(data.get());
+    auto keyedArchiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+    [keyedArchiver setRequiresSecureCoding:YES];
+#else
+    auto keyedArchiver = secureArchiver();
+#endif
 
     @try {
         [keyedArchiver encodeObject:copy.get() forKey:@"parameter"];
@@ -228,6 +233,10 @@
     else
         [_processPool->ensureBundleParameters() removeObjectForKey:parameter];
 
+#if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+    auto data = ""
+#endif
+
     _processPool->sendToAllProcesses(Messages::WebProcess::SetInjectedBundleParameter(parameter, IPC::DataReference(static_cast<const uint8_t*>([data bytes]), [data length])));
 }
 
@@ -235,8 +244,13 @@
 {
     auto copy = adoptNS([[NSDictionary alloc] initWithDictionary:dictionary copyItems:YES]);
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
     auto data = "" alloc] init]);
-    auto keyedArchiver = secureArchiverFromMutableData(data.get());
+    auto keyedArchiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+    [keyedArchiver setRequiresSecureCoding:YES];
+#else
+    auto keyedArchiver = secureArchiver();
+#endif
 
     @try {
         [keyedArchiver encodeObject:copy.get() forKey:@"parameters"];
@@ -247,6 +261,10 @@
 
     [_processPool->ensureBundleParameters() setValuesForKeysWithDictionary:copy.get()];
 
+#if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+    auto data = ""
+#endif
+
     _processPool->sendToAllProcesses(Messages::WebProcess::SetInjectedBundleParameters(IPC::DataReference(static_cast<const uint8_t*>([data bytes]), [data length])));
 }
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (225308 => 225309)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2017-11-30 01:40:56 UTC (rev 225309)
@@ -215,9 +215,15 @@
     parameters.fontWhitelist = m_fontWhitelist;
 
     if (m_bundleParameters) {
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
         auto data = "" alloc] init]);
-        auto keyedArchiver = secureArchiverFromMutableData(data.get());
+        auto keyedArchiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
 
+        [keyedArchiver setRequiresSecureCoding:YES];
+#else
+        auto keyedArchiver = secureArchiver();
+#endif
+
         @try {
             [keyedArchiver encodeObject:m_bundleParameters.get() forKey:@"parameters"];
             [keyedArchiver finishEncoding];
@@ -225,6 +231,10 @@
             LOG_ERROR("Failed to encode bundle parameters: %@", exception);
         }
 
+#if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+        auto data = ""
+#endif
+
         parameters.bundleParameterData = API::Data::createWithoutCopying((const unsigned char*)[data bytes], [data length], [] (unsigned char*, const void* data) {
             [(NSData *)data release];
         }, data.leakRef());

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (225308 => 225309)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm	2017-11-30 01:19:25 UTC (rev 225308)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm	2017-11-30 01:40:56 UTC (rev 225309)
@@ -484,8 +484,13 @@
             if (!userObject)
                 return;
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
             auto data = "" alloc] init]);
-            auto archiver = secureArchiverFromMutableData(data.get());
+            auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+            [archiver setRequiresSecureCoding:YES];
+#else
+            auto archiver = secureArchiver();
+#endif
             @try {
                 [archiver encodeObject:userObject forKey:@"userObject"];
             } @catch (NSException *exception) {
@@ -494,6 +499,10 @@
             }
             [archiver finishEncoding];
 
+#if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+            auto data = ""
+#endif
+
             userData = API::Data::createWithoutCopying(WTFMove(data));
         }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to