Diff
Modified: trunk/Source/WebCore/ChangeLog (223888 => 223889)
--- trunk/Source/WebCore/ChangeLog 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebCore/ChangeLog 2017-10-24 16:21:36 UTC (rev 223889)
@@ -1,3 +1,33 @@
+2017-10-24 Brent Fulgham <bfulg...@apple.com>
+
+ Adopt new secure coding APIs
+ https://bugs.webkit.org/show_bug.cgi?id=178484
+ <rdar://problem/34837193>
+
+ Reviewed by Tim Horton.
+
+ Switch to new NSKeyed[Un]Archiver methods that active and use
+ NSSecureCoding by default.
+
+ Most of the new API is wrapped in a set of convenience methods so we can
+ build without the new API on older systems.
+
+ No change in behavior.
+
+ * editing/cocoa/EditorCocoa.mm:
+ (WebCore::archivedDataForAttributedString): Use new convenience method
+ to archive the string object.
+ * loader/archive/cf/LegacyWebArchiveMac.mm:
+ (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Update to
+ use secure coding where possible.
+ (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto.
+ * platform/ios/PlatformPasteboardIOS.mm:
+ (WebCore::PlatformPasteboard::write): Use new secure API.
+ (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
+ * testing/cocoa/WebArchiveDumpSupport.mm:
+ (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to
+ secure coding API where possible.
+
2017-10-24 Miguel Gomez <mago...@igalia.com>
[GTK][X11] Windy.com shows always straight wind lines
Modified: trunk/Source/WebCore/PAL/ChangeLog (223888 => 223889)
--- trunk/Source/WebCore/PAL/ChangeLog 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebCore/PAL/ChangeLog 2017-10-24 16:21:36 UTC (rev 223889)
@@ -1,3 +1,21 @@
+2017-10-24 Brent Fulgham <bfulg...@apple.com>
+
+ Adopt new secure coding APIs
+ https://bugs.webkit.org/show_bug.cgi?id=178484
+ <rdar://problem/34837193>
+
+ Reviewed by Tim Horton.
+
+ Add new convenience methods (and SPI headers) so we can adopt new NSKeyedArchiver
+ API that uses secure coding by default.
+
+ * PAL.xcodeproj/project.pbxproj:
+ * pal/spi/cocoa/NSKeyedArchiverSPI.h: Added.
+ (securelyArchivedDataWithRootObject): New convenience method.
+ (securelyUnarchiveRootObjectOfClassFromData): Ditto.
+ (secureArchiverFromMutableData): Ditto.
+ (secureUnarchiverFromData): Ditto.
+
2017-10-20 Alex Christensen <achristen...@webkit.org>
Expose _boundInterfaceIdentifier and _allowsCellularAccess to WKWebsiteDataStorePrivate
Modified: trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (223888 => 223889)
--- trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj 2017-10-24 16:21:36 UTC (rev 223889)
@@ -108,6 +108,7 @@
1C4876D81F8D7F4E00CCEEBD /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C4876D61F8D7F4E00CCEEBD /* Logging.cpp */; };
1C4876D91F8D7F4E00CCEEBD /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4876D71F8D7F4E00CCEEBD /* Logging.h */; };
1C4876E01F8D837500CCEEBD /* LoggingCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C4876DF1F8D837500CCEEBD /* LoggingCocoa.mm */; };
+ 7A1656441F97B2B900BA3CE4 /* NSKeyedArchiverSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */; };
A10265871F56746100B4C844 /* FoundationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10265861F56746100B4C844 /* FoundationSPI.h */; };
A10265891F56747A00B4C844 /* HIToolboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10265881F56747A00B4C844 /* HIToolboxSPI.h */; };
A102658B1F56748C00B4C844 /* QuickDrawSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A102658A1F56748C00B4C844 /* QuickDrawSPI.h */; };
@@ -249,6 +250,7 @@
1C4876DF1F8D837500CCEEBD /* LoggingCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingCocoa.mm; sourceTree = "<group>"; };
1C67CEA11E32EDA800F80F2E /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
1C67CEA21E32EE2600F80F2E /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
+ 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSKeyedArchiverSPI.h; sourceTree = "<group>"; };
A10265861F56746100B4C844 /* FoundationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FoundationSPI.h; sourceTree = "<group>"; };
A10265881F56747A00B4C844 /* HIToolboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HIToolboxSPI.h; sourceTree = "<group>"; };
A102658A1F56748C00B4C844 /* QuickDrawSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickDrawSPI.h; sourceTree = "<group>"; };
@@ -362,6 +364,7 @@
0C2DA1311F3BEB4900DBC317 /* NSColorSPI.h */,
0C2DA1321F3BEB4900DBC317 /* NSExtensionSPI.h */,
0C2DA1331F3BEB4900DBC317 /* NSFileManagerSPI.h */,
+ 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */,
0C2DA1341F3BEB4900DBC317 /* NSStringSPI.h */,
0C2DA1351F3BEB4900DBC317 /* NSTouchBarSPI.h */,
0C2DA1361F3BEB4900DBC317 /* NSURLConnectionSPI.h */,
@@ -650,6 +653,7 @@
0C7785901F45130F00F4EBB6 /* NSFontSPI.h in Headers */,
A10826FE1F58A433004772AC /* NSGraphicsSPI.h in Headers */,
0C7785911F45130F00F4EBB6 /* NSImmediateActionGestureRecognizerSPI.h in Headers */,
+ 7A1656441F97B2B900BA3CE4 /* NSKeyedArchiverSPI.h in Headers */,
0C7785921F45130F00F4EBB6 /* NSMenuSPI.h in Headers */,
0C7785931F45130F00F4EBB6 /* NSPasteboardSPI.h in Headers */,
0C7785941F45130F00F4EBB6 /* NSPopoverSPI.h in Headers */,
Added: trunk/Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h (0 => 223889)
--- trunk/Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h (rev 0)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h 2017-10-24 16:21:36 UTC (rev 223889)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#define USE_NEW_ARCHIVER_API ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101302 && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110200) || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 40200) || (PLATFORM(TVOS) && __TV_OS_VERSION_MIN_REQUIRED >= 110200))
+
+#if USE(APPLE_INTERNAL_SDK) && USE(NEW_ARCHIVER_API)
+
+#import <Foundation/NSKeyedArchiver_Private.h>
+
+#else
+
+#import <Availability.h>
+#import <Foundation/NSCoder.h>
+#import <Foundation/NSKeyedArchiver.h>
+#import <wtf/Assertions.h>
+
+#if USE(NEW_ARCHIVER_API)
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface NSKeyedArchiver (NSKeyedArchiverSecureCodingInitializers)
+- (instancetype)initRequiringSecureCoding:(BOOL)requiresSecureCoding API_AVAILABLE(macos(10.13), ios(11.0));
++ (nullable NSData *)archivedDataWithRootObject:(id)object requiringSecureCoding:(BOOL)requiresSecureCoding error:(NSError **)error API_AVAILABLE(macos(10.13), ios(11.0));
+@end
+
+@interface NSKeyedUnarchiver (NSKeyedUnarchiverSecureCodingInitializer)
+- (nullable instancetype)initForReadingFromData:(NSData *)data error:(NSError **)error API_AVAILABLE(macos(10.13), ios(11.0));
++ (nullable id)unarchivedObjectOfClass:(Class)cls fromData:(NSData *)data error:(NSError **)error API_AVAILABLE(macos(10.13), ios(11.0));
++ (nullable id)unarchivedObjectOfClasses:(NSSet<Class> *)classes fromData:(NSData *)data error:(NSError **)error API_AVAILABLE(macos(10.13), ios(11.0));
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif
+
+#endif
+
+#include <wtf/RetainPtr.h>
+
+inline NSData *_Nullable securelyArchivedDataWithRootObject(id _Nonnull object)
+{
+#if USE(NEW_ARCHIVER_API)
+ NSError *error;
+ NSData *data = "" archivedDataWithRootObject:object requiringSecureCoding:YES error:&error];
+ if (!data)
+ LOG_ERROR("Unable to archive data: %@", error);
+ return data;
+#else
+ return [NSKeyedArchiver archivedDataWithRootObject:object];
+#endif
+}
+
+inline id _Nullable securelyUnarchiveObjectOfClassFromData(Class _Nonnull cls, NSData * _Nonnull data)
+{
+#if USE(NEW_ARCHIVER_API)
+ NSError *error;
+ id value = [NSKeyedUnarchiver unarchivedObjectOfClass:cls fromData:data error:&error];
+ if (!data)
+ LOG_ERROR("Unable to unarchive data: %@", error);
+ return value;
+#else
+ UNUSED_PARAM(cls);
+ return [NSKeyedUnarchiver unarchiveObjectWithData:data];
+#endif
+}
+
+inline RetainPtr<NSKeyedArchiver> secureArchiverFromMutableData(NSMutableData *_Nonnull mutableData)
+{
+ NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:mutableData];
+ [archiver setRequiresSecureCoding:YES];
+ return adoptNS(archiver);
+}
+
+inline RetainPtr<NSKeyedUnarchiver> secureUnarchiverFromData(NSData *_Nonnull data)
+{
+#if USE(NEW_ARCHIVER_API)
+ NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:data error:nil];
+ unarchiver.decodingFailurePolicy = NSDecodingFailurePolicyRaiseException;
+#else
+ NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
+ [unarchiver setRequiresSecureCoding:YES];
+#endif
+ return adoptNS(unarchiver);
+}
+
Modified: trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm (223888 => 223889)
--- trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -52,6 +52,7 @@
#import "WebCoreNSURLExtras.h"
#import "markup.h"
#import <pal/spi/cocoa/NSAttributedStringSPI.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <wtf/BlockObjCExceptions.h>
namespace WebCore {
@@ -141,7 +142,7 @@
if (!attributedString.length)
return nullptr;
- return SharedBuffer::create([NSKeyedArchiver archivedDataWithRootObject:attributedString]);
+ return SharedBuffer::create(securelyArchivedDataWithRootObject(attributedString));
}
String Editor::selectionInHTMLFormat()
Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm (223888 => 223889)
--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -26,9 +26,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#include "LegacyWebArchive.h"
+#import "config.h"
+#import "LegacyWebArchive.h"
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
+
namespace WebCore {
static NSString * const LegacyWebArchiveResourceResponseKey = @"WebResourceResponse";
@@ -42,14 +44,13 @@
return ResourceResponse();
NSURLResponse *response = nil;
- NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData];
+ auto unarchiver = secureUnarchiverFromData((NSData *)responseData);
+ @try {
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || PLATFORM(IOS)
- // Because of <rdar://problem/34063313> we can't use this for decoding in older OS's.
- [unarchiver setRequiresSecureCoding:YES];
- @try {
response = [unarchiver decodeObjectOfClass:[NSURLResponse class] forKey:LegacyWebArchiveResourceResponseKey];
#else
- @try {
+ // Because of <rdar://problem/34063313> we can't use secure coding for decoding in older OS's.
+ [unarchiver setRequiresSecureCoding:NO];
id responseObject = [unarchiver decodeObjectForKey:LegacyWebArchiveResourceResponseKey];
if ([responseObject isKindOfClass:[NSURLResponse class]])
response = responseObject;
@@ -59,8 +60,7 @@
LOG_ERROR("Failed to decode NS(HTTP)URLResponse: %@", exception);
response = nil;
}
- [unarchiver release];
-
+
return ResourceResponse(response);
}
@@ -73,7 +73,7 @@
CFMutableDataRef responseData = CFDataCreateMutable(0, 0);
- NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:(NSMutableData *)responseData];
+ auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:(NSMutableData *)responseData]);
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || PLATFORM(IOS)
// Because of <rdar://problem/34063313> we can't use this for encoding in older OS's.
[archiver setRequiresSecureCoding:YES];
@@ -80,8 +80,7 @@
#endif
[archiver encodeObject:nsResponse forKey:LegacyWebArchiveResourceResponseKey];
[archiver finishEncoding];
- [archiver release];
-
+
return adoptCF(responseData);
}
Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (223888 => 223889)
--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -36,6 +36,7 @@
#import <MobileCoreServices/MobileCoreServices.h>
#import <UIKit/UIImage.h>
#import <UIKit/UIPasteboard.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <pal/spi/ios/UIKitSPI.h>
#import <wtf/ListHashSet.h>
#import <wtf/SoftLinking.h>
@@ -264,7 +265,7 @@
[representationsToRegister addData:content.dataInWebArchiveFormat->createNSData().get() forType:WebArchivePboardType];
if (content.dataInAttributedStringFormat) {
- NSAttributedString *attributedString = [NSKeyedUnarchiver unarchiveObjectWithData:content.dataInAttributedStringFormat->createNSData().get()];
+ NSAttributedString *attributedString = securelyUnarchiveObjectOfClassFromData([NSAttributedString class], content.dataInAttributedStringFormat->createNSData().get());
if (attributedString)
[representationsToRegister addRepresentingObject:attributedString];
}
@@ -379,11 +380,11 @@
if (!provider.teamData.length)
continue;
- id teamDataObject = [NSKeyedUnarchiver unarchiveObjectWithData:provider.teamData];
- if (!teamDataObject || ![teamDataObject isKindOfClass:[NSDictionary class]])
+ NSDictionary *teamDataObject = securelyUnarchiveObjectOfClassFromData([NSDictionary class], provider.teamData);
+ if (!teamDataObject)
continue;
- id originInTeamData = [(NSDictionary *)teamDataObject objectForKey:@(originKeyForTeamData)];
+ id originInTeamData = [teamDataObject objectForKey:@(originKeyForTeamData)];
if (![originInTeamData isKindOfClass:[NSString class]])
continue;
if (String((NSString *)originInTeamData) != origin)
@@ -444,8 +445,7 @@
NSMutableArray<NSString *> *typesAsNSArray = [NSMutableArray array];
for (auto& type : data.orderedTypes)
[typesAsNSArray addObject:type];
- [representationsToRegister setTeamData:[NSKeyedArchiver archivedDataWithRootObject:@{
- @(originKeyForTeamData) : data.origin, @(customTypesKeyForTeamData) : typesAsNSArray }]];
+ [representationsToRegister setTeamData:securelyArchivedDataWithRootObject(@{ @(originKeyForTeamData) : data.origin, @(customTypesKeyForTeamData) : typesAsNSArray })];
[representationsToRegister addData:serializedSharedBuffer.get() forType:@(PasteboardCustomData::cocoaType())];
}
}
Modified: trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.mm (223888 => 223889)
--- trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -30,6 +30,7 @@
#import <CFNetwork/CFHTTPMessage.h>
#import <CFNetwork/CFNetwork.h>
#import <pal/spi/cf/CFNetworkSPI.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <wtf/NeverDestroyed.h>
#import <wtf/RetainPtr.h>
#import <wtf/Vector.h>
@@ -40,15 +41,14 @@
static CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData)
{
- RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]);
NSURLResponse *response;
+ auto unarchiver = secureUnarchiverFromData((NSData *)responseData);
+ @try {
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || PLATFORM(IOS)
- // Because of <rdar://problem/34063313> we can't use this for decoding in older OS's.
- [unarchiver setRequiresSecureCoding:YES];
- @try {
response = [unarchiver decodeObjectOfClass:[NSURLResponse class] forKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
#else
- @try {
+ // Because of <rdar://problem/34063313> we can't use secure coding for decoding in older OS's.
+ [unarchiver setRequiresSecureCoding:NO];
response = [unarchiver decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
#endif
[unarchiver finishDecoding];
Modified: trunk/Source/WebKit/ChangeLog (223888 => 223889)
--- trunk/Source/WebKit/ChangeLog 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/ChangeLog 2017-10-24 16:21:36 UTC (rev 223889)
@@ -1,3 +1,59 @@
+2017-10-24 Brent Fulgham <bfulg...@apple.com>
+
+ Adopt new secure coding APIs
+ https://bugs.webkit.org/show_bug.cgi?id=178484
+ <rdar://problem/34837193>
+
+ Reviewed by Tim Horton.
+
+ Switch to new NSKeyed[Un]Archiver methods that active and use
+ NSSecureCoding by default.
+
+ * Platform/ios/AccessibilityIOS.mm:
+ (WebKit::newAccessibilityRemoteToken): Use secure-by-default API.
+ * Shared/Cocoa/DataDetectionResult.mm:
+ (WebKit::DataDetectionResult::encode const): Ditto.
+ (WebKit::DataDetectionResult::decode): Ditto.
+ * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+ (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
+ (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
+ (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
+ (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
+ (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
+ (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
+ (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
+ (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
+ * Shared/ios/InteractionInformationAtPosition.mm:
+ (WebKit::InteractionInformationAtPosition::encode const): Ditto.
+ (WebKit::InteractionInformationAtPosition::decode): Ditto.
+ * Shared/mac/WebCoreArgumentCodersMac.mm:
+ (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
+ (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
+ (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
+ (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
+ (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
+ (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
+ (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
+ (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
+ * Shared/mac/WebHitTestResultData.mm:
+ (WebKit::WebHitTestResultData::platformEncode const): Ditto.
+ (WebKit::WebHitTestResultData::platformDecode): Ditto.
+ * UIProcess/API/Cocoa/WKProcessPool.mm:
+ (-[WKProcessPool _setObject:forBundleParameter:]): Ditto.
+ (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]): Ditto.
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _setInputDelegate:]): Ditto.
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::startAssistingNode): Ditto.
+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
+ (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Ditto.
+ * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
+ (WebKit::InjectedBundle::initialize): Ditto.
+ (WebKit::InjectedBundle::setBundleParameter): Ditto.
+ (WebKit::InjectedBundle::setBundleParameters): Ditto.
+
2017-10-24 Zan Dobersek <zdober...@igalia.com>
[GTK][WPE] generate-forwarding-headers.pl should also scan derived sources in WebKit framework
Modified: trunk/Source/WebKit/Platform/ios/AccessibilityIOS.mm (223888 => 223889)
--- trunk/Source/WebKit/Platform/ios/AccessibilityIOS.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/Platform/ios/AccessibilityIOS.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -25,6 +25,7 @@
#import "config.h"
#import "AccessibilityIOS.h"
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#if PLATFORM(IOS)
@@ -34,7 +35,7 @@
{
if (!uuid)
return nil;
- return [NSKeyedArchiver archivedDataWithRootObject:@{ @"ax-pid" : @(getpid()), @"ax-uuid" : [uuid UUIDString], @"ax-register" : @YES }];
+ return securelyArchivedDataWithRootObject(@{ @"ax-pid" : @(getpid()), @"ax-uuid" : [uuid UUIDString], @"ax-register" : @YES });
}
} // namespace WebKit
Modified: trunk/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm (223888 => 223889)
--- trunk/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,6 +29,7 @@
#import "ArgumentCodersCF.h"
#import "WebCoreArgumentCoders.h"
#import <pal/spi/cocoa/DataDetectorsCoreSPI.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <wtf/SoftLinking.h>
SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectorsCore)
@@ -41,8 +42,7 @@
void DataDetectionResult::encode(IPC::Encoder& encoder) const
{
RetainPtr<NSMutableData> data = "" alloc] init]);
- RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
- [archiver setRequiresSecureCoding:YES];
+ auto archiver = secureArchiverFromMutableData(data.get());
[archiver encodeObject:results.get() forKey:@"dataDetectorResults"];
[archiver finishEncoding];
@@ -54,9 +54,8 @@
RetainPtr<CFDataRef> data;
if (!IPC::decode(decoder, data))
return false;
-
- RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+
+ auto unarchiver = secureUnarchiverFromData((NSData *)data.get());
@try {
result.results = [unarchiver decodeObjectOfClasses:[NSSet setWithArray:@[ [NSArray class], getDDScannerResultClass()] ] forKey:@"dataDetectorResults"];
} @catch (NSException *exception) {
Modified: trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (223888 => 223889)
--- trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,6 +30,7 @@
#import "DataReference.h"
#import <WebCore/PaymentAuthorizationStatus.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <pal/spi/cocoa/PassKitSPI.h>
#import <wtf/SoftLinking.h>
@@ -51,10 +52,8 @@
void ArgumentCoder<WebCore::Payment>::encode(Encoder& encoder, const WebCore::Payment& payment)
{
auto data = "" alloc] init]);
- auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+ auto archiver = secureArchiverFromMutableData(data.get());
- [archiver setRequiresSecureCoding:YES];
-
[archiver encodeObject:payment.pkPayment() forKey:NSKeyedArchiveRootObjectKey];
[archiver finishEncoding];
@@ -68,8 +67,7 @@
return false;
auto data = "" alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]);
- auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData(data.get());
@try {
PKPayment *pkPayment = [unarchiver decodeObjectOfClass:getPKPaymentClass() forKey:NSKeyedArchiveRootObjectKey];
payment = Payment(pkPayment);
@@ -106,10 +104,8 @@
void ArgumentCoder<WebCore::PaymentContact>::encode(Encoder& encoder, const WebCore::PaymentContact& paymentContact)
{
auto data = "" alloc] init]);
- auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+ auto archiver = secureArchiverFromMutableData(data.get());
- [archiver setRequiresSecureCoding:YES];
-
[archiver encodeObject:paymentContact.pkContact() forKey:NSKeyedArchiveRootObjectKey];
[archiver finishEncoding];
@@ -123,8 +119,7 @@
return false;
auto data = "" alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]);
- auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData(data.get());
@try {
PKContact *pkContact = [unarchiver decodeObjectOfClass:getPKContactClass() forKey:NSKeyedArchiveRootObjectKey];
paymentContact = PaymentContact(pkContact);
@@ -167,10 +162,8 @@
void ArgumentCoder<WebCore::PaymentMerchantSession>::encode(Encoder& encoder, const WebCore::PaymentMerchantSession& paymentMerchantSession)
{
auto data = "" alloc] init]);
- auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+ auto archiver = secureArchiverFromMutableData(data.get());
- [archiver setRequiresSecureCoding:YES];
-
[archiver encodeObject:paymentMerchantSession.pkPaymentMerchantSession() forKey:NSKeyedArchiveRootObjectKey];
[archiver finishEncoding];
@@ -184,8 +177,7 @@
return false;
auto data = "" alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]);
- auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData(data.get());
@try {
PKPaymentMerchantSession *pkPaymentMerchantSession = [unarchiver decodeObjectOfClass:getPKPaymentMerchantSessionClass() forKey:NSKeyedArchiveRootObjectKey];
paymentMerchantSession = PaymentMerchantSession(pkPaymentMerchantSession);
@@ -195,7 +187,6 @@
}
[unarchiver finishDecoding];
-
return true;
}
@@ -202,10 +193,8 @@
void ArgumentCoder<WebCore::PaymentMethod>::encode(Encoder& encoder, const WebCore::PaymentMethod& paymentMethod)
{
auto data = "" alloc] init]);
- auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+ auto archiver = secureArchiverFromMutableData(data.get());
- [archiver setRequiresSecureCoding:YES];
-
[archiver encodeObject:paymentMethod.pkPaymentMethod() forKey:NSKeyedArchiveRootObjectKey];
[archiver finishEncoding];
@@ -219,8 +208,7 @@
return false;
auto data = "" alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]);
- auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData(data.get());
@try {
PKPaymentMethod *pkPaymentMethod = [unarchiver decodeObjectOfClass:getPKPaymentMethodClass() forKey:NSKeyedArchiveRootObjectKey];
paymentMethod = PaymentMethod(pkPaymentMethod);
Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm (223888 => 223889)
--- trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,6 +29,7 @@
#import "ArgumentCodersCF.h"
#import "WebCoreArgumentCoders.h"
#import <pal/spi/cocoa/DataDetectorsCoreSPI.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <wtf/SoftLinking.h>
SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectorsCore)
@@ -73,8 +74,7 @@
if (isDataDetectorLink) {
encoder << dataDetectorIdentifier;
RetainPtr<NSMutableData> data = "" alloc] init]);
- RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
- [archiver setRequiresSecureCoding:YES];
+ auto archiver = secureArchiverFromMutableData(data.get());
[archiver encodeObject:dataDetectorResults.get() forKey:@"dataDetectorResults"];
[archiver finishEncoding];
@@ -168,8 +168,7 @@
if (!IPC::decode(decoder, data))
return false;
- RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData((NSData *)data.get());
@try {
result.dataDetectorResults = [unarchiver decodeObjectOfClasses:[NSSet setWithArray:@[ [NSArray class], getDDScannerResultClass()] ] forKey:@"dataDetectorResults"];
} @catch (NSException *exception) {
Modified: trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm (223888 => 223889)
--- trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
* Copyright (C) 2013 Company 100 Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,7 @@
#import <WebCore/ResourceError.h>
#import <WebCore/ResourceRequest.h>
#import <pal/spi/cf/CFNetworkSPI.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#if USE(CFURLCONNECTION)
#import <CFNetwork/CFURLRequest.h>
@@ -472,9 +473,8 @@
void ArgumentCoder<ProtectionSpace>::encodePlatformData(Encoder& encoder, const ProtectionSpace& space)
{
- RetainPtr<NSMutableData> data = "" alloc] init]);
- RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
- [archiver setRequiresSecureCoding:YES];
+ auto data = "" alloc] init]);
+ auto archiver = secureArchiverFromMutableData(data.get());
[archiver encodeObject:space.nsSpace() forKey:@"protectionSpace"];
[archiver finishEncoding];
IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
@@ -486,8 +486,7 @@
if (!IPC::decode(decoder, data))
return false;
- RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData((NSData *)data.get());
@try {
if (RetainPtr<NSURLProtectionSpace> nsSpace = [unarchiver decodeObjectOfClass:[NSURLProtectionSpace class] forKey:@"protectionSpace"])
space = ProtectionSpace(nsSpace.get());
@@ -519,9 +518,8 @@
}
encoder << false;
- RetainPtr<NSMutableData> data = "" alloc] init]);
- RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
- [archiver setRequiresSecureCoding:YES];
+ auto data = "" alloc] init]);
+ auto archiver = secureArchiverFromMutableData(data.get());
[archiver encodeObject:nsCredential forKey:@"credential"];
[archiver finishEncoding];
IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
@@ -560,8 +558,7 @@
if (!IPC::decode(decoder, data))
return false;
- RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData((NSData *)data.get());
@try {
if (RetainPtr<NSURLCredential> nsCredential = [unarchiver decodeObjectOfClass:[NSURLCredential class] forKey:@"credential"])
credential = Credential(nsCredential.get());
@@ -622,9 +619,8 @@
#if ENABLE(CONTENT_FILTERING)
void ArgumentCoder<ContentFilterUnblockHandler>::encode(Encoder& encoder, const ContentFilterUnblockHandler& contentFilterUnblockHandler)
{
- RetainPtr<NSMutableData> data = "" alloc] init]);
- RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
- [archiver setRequiresSecureCoding:YES];
+ auto data = "" alloc] init]);
+ auto archiver = secureArchiverFromMutableData(data.get());
contentFilterUnblockHandler.encode(archiver.get());
[archiver finishEncoding];
IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
@@ -636,8 +632,7 @@
if (!IPC::decode(decoder, data))
return false;
- RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData((NSData *)data.get());
if (!ContentFilterUnblockHandler::decode(unarchiver.get(), contentFilterUnblockHandler))
return false;
@@ -656,9 +651,8 @@
void ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData(Encoder& encoder, const MediaPlaybackTargetContext& target)
{
- RetainPtr<NSMutableData> data = "" alloc] init]);
- RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
- [archiver setRequiresSecureCoding:YES];
+ auto data = "" alloc] init]);
+ auto archiver = secureArchiverFromMutableData(data.get());
if ([getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])
[archiver encodeObject:target.avOutputContext() forKey:deviceContextKey()];
@@ -677,8 +671,7 @@
if (!IPC::decode(decoder, data))
return false;
- RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData((NSData *)data.get());
AVOutputContext *context = nil;
@try {
Modified: trunk/Source/WebKit/Shared/mac/WebHitTestResultData.mm (223888 => 223889)
--- trunk/Source/WebKit/Shared/mac/WebHitTestResultData.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/Shared/mac/WebHitTestResultData.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,6 +33,7 @@
#import "Encoder.h"
#import "WebCoreArgumentCoders.h"
#import <WebCore/TextIndicator.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <pal/spi/mac/DataDetectorsSPI.h>
namespace WebKit {
@@ -44,9 +45,8 @@
if (!hasActionContext)
return;
- RetainPtr<NSMutableData> data = "" alloc] init]);
- RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
- [archiver setRequiresSecureCoding:YES];
+ auto data = "" alloc] init]);
+ auto archiver = secureArchiverFromMutableData(data.get());
[archiver encodeObject:detectedDataActionContext.get() forKey:@"actionContext"];
[archiver finishEncoding];
@@ -75,8 +75,7 @@
if (!IPC::decode(decoder, data))
return false;
- RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData((NSData *)data.get());
@try {
hitTestResultData.detectedDataActionContext = [unarchiver decodeObjectOfClass:getDDActionContextClass() forKey:@"actionContext"];
} @catch (NSException *exception) {
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm (223888 => 223889)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -48,6 +48,7 @@
#import <WebCore/CertificateInfo.h>
#import <WebCore/PluginData.h>
#import <pal/spi/cf/CFNetworkSPI.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <wtf/RetainPtr.h>
#if PLATFORM(IOS)
@@ -213,8 +214,7 @@
auto copy = adoptNS([(NSObject *)object copy]);
auto data = "" alloc] init]);
- auto keyedArchiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
- [keyedArchiver setRequiresSecureCoding:YES];
+ auto keyedArchiver = secureArchiverFromMutableData(data.get());
@try {
[keyedArchiver encodeObject:copy.get() forKey:@"parameter"];
@@ -236,8 +236,7 @@
auto copy = adoptNS([[NSDictionary alloc] initWithDictionary:dictionary copyItems:YES]);
auto data = "" alloc] init]);
- auto keyedArchiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
- [keyedArchiver setRequiresSecureCoding:YES];
+ auto keyedArchiver = secureArchiverFromMutableData(data.get());
@try {
[keyedArchiver encodeObject:copy.get() forKey:@"parameters"];
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (223888 => 223889)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -102,6 +102,7 @@
#import <WebCore/ValidationBubble.h>
#import <WebCore/ViewportArguments.h>
#import <WebCore/WritingMode.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <pal/spi/mac/NSTextFinderSPI.h>
#import <wtf/BlockPtr.h>
#import <wtf/HashMap.h>
@@ -4525,8 +4526,7 @@
NSObject <NSSecureCoding> *userObject = nil;
if (API::Data* data = "" {
auto nsData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(data->bytes())) length:data->size() freeWhenDone:NO]);
- auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:nsData.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData(nsData.get());
@try {
userObject = [unarchiver decodeObjectOfClass:[NSObject class] forKey:@"userObject"];
} @catch (NSException *exception) {
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (223888 => 223889)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -49,6 +49,7 @@
#import <WebCore/RuntimeApplicationChecks.h>
#import <WebCore/SharedBuffer.h>
#import <pal/spi/cf/CFNetworkSPI.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <sys/param.h>
#if PLATFORM(IOS)
@@ -215,10 +216,8 @@
if (m_bundleParameters) {
auto data = "" alloc] init]);
- auto keyedArchiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+ auto keyedArchiver = secureArchiverFromMutableData(data.get());
- [keyedArchiver setRequiresSecureCoding:YES];
-
@try {
[keyedArchiver encodeObject:m_bundleParameters.get() forKey:@"parameters"];
[keyedArchiver finishEncoding];
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (223888 => 223889)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -55,6 +55,7 @@
#import <WebCore/SharedBuffer.h>
#import <WebCore/TextIndicator.h>
#import <WebCore/ValidationBubble.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <wtf/BlockPtr.h>
#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_webView->_page->process().connection())
@@ -547,8 +548,7 @@
NSObject <NSSecureCoding> *userObject = nil;
if (API::Data* data = "" {
auto nsData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(data->bytes())) length:data->size() freeWhenDone:NO]);
- auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:nsData.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData(nsData.get());
@try {
userObject = [unarchiver decodeObjectOfClass:[NSObject class] forKey:@"userObject"];
} @catch (NSException *exception) {
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (223888 => 223889)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -65,6 +65,7 @@
#import <WebCore/HTMLFormElement.h>
#import <WebCore/HTMLInputElement.h>
#import <WebCore/MainFrame.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
using namespace WebCore;
using namespace WebKit;
@@ -484,8 +485,7 @@
return;
auto data = "" alloc] init]);
- auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
- [archiver setRequiresSecureCoding:YES];
+ auto archiver = secureArchiverFromMutableData(data.get());
@try {
[archiver encodeObject:userObject forKey:@"userObject"];
} @catch (NSException *exception) {
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm (223888 => 223889)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm 2017-10-24 14:14:15 UTC (rev 223888)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm 2017-10-24 16:21:36 UTC (rev 223889)
@@ -34,6 +34,7 @@
#import "WKWebProcessPlugInInternal.h"
#import "WebProcessCreationParameters.h"
#import <Foundation/NSBundle.h>
+#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
#import <stdio.h>
#import <wtf/RetainPtr.h>
#import <wtf/text/CString.h>
@@ -85,8 +86,7 @@
if (parameters.bundleParameterData) {
auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(parameters.bundleParameterData->bytes())) length:parameters.bundleParameterData->size() freeWhenDone:NO]);
- auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:bundleParameterData.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData(bundleParameterData.get());
NSDictionary *dictionary = nil;
@try {
@@ -160,8 +160,7 @@
#if WK_API_ENABLED
auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(value.data())) length:value.size() freeWhenDone:NO]);
- auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:bundleParameterData.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData(bundleParameterData.get());
id parameter = nil;
@try {
@@ -183,8 +182,7 @@
#if WK_API_ENABLED
auto bundleParametersData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(value.data())) length:value.size() freeWhenDone:NO]);
- auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:bundleParametersData.get()]);
- [unarchiver setRequiresSecureCoding:YES];
+ auto unarchiver = secureUnarchiverFromData(bundleParametersData.get());
NSDictionary *parameters = nil;
@try {