Skip to content

Commit f841ae5

Browse files
[macOS, iOS] Adopt new secure coding APIs in WebKit
https://bugs.webkit.org/show_bug.cgi?id=181085 <rdar://problem/34837397> Reviewed by Tim Horton. Source/WebCore/PAL: Add a new helper function to allow WebKit code to use NSSecureCoding in more places when the underlying operating system supports it. * pal/spi/cocoa/NSKeyedArchiverSPI.h: (decodeObjectOfClassForKeyFromCoder): New wrapper method. Source/WebKit: Update WebKit code to use NSSecureCoding when the underlying operating system supports it. Use new wrapper functions so the same code can be built on all supported OS releases, while enabling seure coding when possible. Note that NSView-based classes cannot be migrated at present due to AppKit not supporting NSSecureCoding in its class hierarchy. Tested by exising TestWebKitAPI tests for Coding and data transfer. * Platform/ios/AccessibilityIOS.mm: (WebKit::newAccessibilityRemoteToken): Encode using NSSecureCoding. * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferences.mm: (+[WKPreferences supportsSecureCoding]): Added to enable NSSecureCoding. * UIProcess/API/Cocoa/WKProcessPool.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (+[WKProcessPool supportsSecureCoding]): Ditto. * UIProcess/API/Cocoa/WKUserContentController.h: * UIProcess/API/Cocoa/WKUserContentController.mm: (+[WKUserContentController supportsSecureCoding]): Ditto. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView initWithCoder:]): Use coding initialization that supports secure coding if it is available in the supplied class. * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (+[WKWebViewConfiguration supportsSecureCoding]): Added to enable NSSecureCoding. (-[WKWebViewConfiguration initWithCoder:]): Use secure coding when possible. * UIProcess/API/Cocoa/WKWebsiteDataStore.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (+[WKWebsiteDataStore supportsSecureCoding]): Added to enable NSSecureCoding. * UIProcess/API/Cocoa/_WKApplicationManifest.h: * UIProcess/API/Cocoa/_WKApplicationManifest.mm: (+[_WKApplicationManifest supportsSecureCoding]): Added to enable NSSecureCoding. (-[_WKApplicationManifest initWithCoder:]): Use secure coding when possible. Tools: Update API tests to use secure coding wherever possible. Currently, NSView/UIView-based classes are not capable of supporting NSSecureCoding, so pass through the current coding routines. * TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm: Updated for NSSecureCoding. * TestWebKitAPI/Tests/WebKitCocoa/Coding.mm: (encodeAndDecode): Check if class supports the NSSecureCoding protocol and use non-secure coding routines if necessary. (TEST): Updated for NSSecureCoding. * TestWebKitAPI/Tests/mac/EarlyKVOCrash.mm: (TestWebKitAPI::TEST): Updated for NSSecureCoding. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@226353 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 25b3f12 commit f841ae5

21 files changed

+165
-37
lines changed

Source/WebCore/PAL/ChangeLog

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
2018-01-02 Brent Fulgham <[email protected]>
2+
3+
[macOS, iOS] Adopt new secure coding APIs in WebKit
4+
https://bugs.webkit.org/show_bug.cgi?id=181085
5+
<rdar://problem/34837397>
6+
7+
Reviewed by Tim Horton.
8+
9+
Add a new helper function to allow WebKit code to use NSSecureCoding in more
10+
places when the underlying operating system supports it.
11+
12+
* pal/spi/cocoa/NSKeyedArchiverSPI.h:
13+
(decodeObjectOfClassForKeyFromCoder): New wrapper method.
14+
115
2017-12-21 Brent Fulgham <[email protected]>
216

317
Unreviewed test fix after r226224.

Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,12 @@ inline RetainPtr<NSKeyedUnarchiver> secureUnarchiverFromData(NSData *_Nonnull da
134134
return adoptNS(unarchiver);
135135
}
136136

137+
inline id _Nullable decodeObjectOfClassForKeyFromCoder(Class _Nonnull cls, NSString * _Nonnull key, NSCoder * _Nonnull coder)
138+
{
139+
#if USE(SECURE_ARCHIVER_API)
140+
return [coder decodeObjectOfClass:cls forKey:key];
141+
#else
142+
UNUSED_PARAM(cls);
143+
return [coder decodeObjectForKey:key];
144+
#endif
145+
}

Source/WebKit/ChangeLog

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
1+
2018-01-02 Brent Fulgham <[email protected]>
2+
3+
[macOS, iOS] Adopt new secure coding APIs in WebKit
4+
https://bugs.webkit.org/show_bug.cgi?id=181085
5+
<rdar://problem/34837397>
6+
7+
Reviewed by Tim Horton.
8+
9+
Update WebKit code to use NSSecureCoding when the underlying operating system supports it. Use new
10+
wrapper functions so the same code can be built on all supported OS releases, while enabling
11+
seure coding when possible.
12+
13+
Note that NSView-based classes cannot be migrated at present due to AppKit not supporting NSSecureCoding
14+
in its class hierarchy.
15+
16+
Tested by exising TestWebKitAPI tests for Coding and data transfer.
17+
18+
* Platform/ios/AccessibilityIOS.mm:
19+
(WebKit::newAccessibilityRemoteToken): Encode using NSSecureCoding.
20+
* UIProcess/API/Cocoa/WKPreferences.h:
21+
* UIProcess/API/Cocoa/WKPreferences.mm:
22+
(+[WKPreferences supportsSecureCoding]): Added to enable NSSecureCoding.
23+
* UIProcess/API/Cocoa/WKProcessPool.h:
24+
* UIProcess/API/Cocoa/WKProcessPool.mm:
25+
(+[WKProcessPool supportsSecureCoding]): Ditto.
26+
* UIProcess/API/Cocoa/WKUserContentController.h:
27+
* UIProcess/API/Cocoa/WKUserContentController.mm:
28+
(+[WKUserContentController supportsSecureCoding]): Ditto.
29+
* UIProcess/API/Cocoa/WKWebView.mm:
30+
(-[WKWebView initWithCoder:]): Use coding initialization that supports secure coding if
31+
it is available in the supplied class.
32+
* UIProcess/API/Cocoa/WKWebViewConfiguration.h:
33+
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
34+
(+[WKWebViewConfiguration supportsSecureCoding]): Added to enable NSSecureCoding.
35+
(-[WKWebViewConfiguration initWithCoder:]): Use secure coding when possible.
36+
* UIProcess/API/Cocoa/WKWebsiteDataStore.h:
37+
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
38+
(+[WKWebsiteDataStore supportsSecureCoding]): Added to enable NSSecureCoding.
39+
* UIProcess/API/Cocoa/_WKApplicationManifest.h:
40+
* UIProcess/API/Cocoa/_WKApplicationManifest.mm:
41+
(+[_WKApplicationManifest supportsSecureCoding]): Added to enable NSSecureCoding.
42+
(-[_WKApplicationManifest initWithCoder:]): Use secure coding when possible.
43+
144
2017-12-28 Yusuke Suzuki <[email protected]>
245

346
Remove std::chrono completely

Source/WebKit/Platform/ios/AccessibilityIOS.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2015 Apple Inc. All rights reserved.
2+
* Copyright (C) 2015-2017 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -35,7 +35,7 @@
3535
{
3636
if (!uuid)
3737
return nil;
38-
return insecurelyArchivedDataWithRootObject(@{ @"ax-pid" : @(getpid()), @"ax-uuid" : [uuid UUIDString], @"ax-register" : @YES });
38+
return securelyArchivedDataWithRootObject(@{ @"ax-pid" : @(getpid()), @"ax-uuid" : [uuid UUIDString], @"ax-register" : @YES });
3939
}
4040

4141
} // namespace WebKit

Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2014 Apple Inc. All rights reserved.
2+
* Copyright (C) 2014-2017 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -35,7 +35,7 @@
3535
its web view configuration.
3636
*/
3737
WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0))
38-
@interface WKPreferences : NSObject <NSCoding>
38+
@interface WKPreferences : NSObject <NSSecureCoding>
3939

4040
/*! @abstract The minimum font size in points.
4141
@discussion The default value is 0.

Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2014-2016 Apple Inc. All rights reserved.
2+
* Copyright (C) 2014-2017 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -55,6 +55,11 @@ - (void)dealloc
5555
[super dealloc];
5656
}
5757

58+
+ (BOOL)supportsSecureCoding
59+
{
60+
return YES;
61+
}
62+
5863
// FIXME: We currently only encode/decode API preferences. We should consider whether we should
5964
// encode/decode SPI preferences as well.
6065

Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2014 Apple Inc. All rights reserved.
2+
* Copyright (C) 2014-2017 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -36,7 +36,7 @@
3636
with the same process pool end up sharing web content processes.
3737
*/
3838
WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0))
39-
@interface WKProcessPool : NSObject <NSCoding>
39+
@interface WKProcessPool : NSObject <NSSecureCoding>
4040
@end
4141

4242
#endif

Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ - (void)dealloc
9696
[super dealloc];
9797
}
9898

99+
+ (BOOL)supportsSecureCoding
100+
{
101+
return YES;
102+
}
103+
99104
- (void)encodeWithCoder:(NSCoder *)coder
100105
{
101106
if (self == sharedProcessPool) {

Source/WebKit/UIProcess/API/Cocoa/WKUserContentController.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2014 Apple Inc. All rights reserved.
2+
* Copyright (C) 2014-2017 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -41,7 +41,7 @@ NS_ASSUME_NONNULL_BEGIN
4141
web view configuration.
4242
*/
4343
WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0))
44-
@interface WKUserContentController : NSObject <NSCoding>
44+
@interface WKUserContentController : NSObject <NSSecureCoding>
4545

4646
/*! @abstract The user scripts associated with this user content
4747
controller.

Source/WebKit/UIProcess/API/Cocoa/WKUserContentController.mm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2014 Apple Inc. All rights reserved.
2+
* Copyright (C) 2014-2017 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -65,6 +65,11 @@ - (void)dealloc
6565
[super dealloc];
6666
}
6767

68+
+ (BOOL)supportsSecureCoding
69+
{
70+
return YES;
71+
}
72+
6873
- (void)encodeWithCoder:(NSCoder *)coder
6974
{
7075
}

Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,11 +723,11 @@ - (instancetype)initWithCoder:(NSCoder *)coder
723723
if (!(self = [super initWithCoder:coder]))
724724
return nil;
725725

726-
WKWebViewConfiguration *configuration = [coder decodeObjectForKey:@"configuration"];
726+
WKWebViewConfiguration *configuration = decodeObjectOfClassForKeyFromCoder([WKWebViewConfiguration class], @"configuration", coder);
727727
[self _initializeWithConfiguration:configuration];
728728

729729
self.allowsBackForwardNavigationGestures = [coder decodeBoolForKey:@"allowsBackForwardNavigationGestures"];
730-
self.customUserAgent = [coder decodeObjectForKey:@"customUserAgent"];
730+
self.customUserAgent = decodeObjectOfClassForKeyFromCoder([NSString class], @"customUserAgent", coder);
731731
self.allowsLinkPreview = [coder decodeBoolForKey:@"allowsLinkPreview"];
732732

733733
#if PLATFORM(MAC)

Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2014 Apple Inc. All rights reserved.
2+
* Copyright (C) 2014-2017 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -92,7 +92,7 @@ typedef NS_OPTIONS(NSUInteger, WKAudiovisualMediaTypes) {
9292
@helps Contains properties used to configure a @link WKWebView @/link.
9393
*/
9494
WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0))
95-
@interface WKWebViewConfiguration : NSObject <NSCoding, NSCopying>
95+
@interface WKWebViewConfiguration : NSObject <NSSecureCoding, NSCopying>
9696

9797
/*! @abstract The process pool from which to obtain the view's web content
9898
process.

Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2014-2016 Apple Inc. All rights reserved.
2+
* Copyright (C) 2014-2017 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -25,6 +25,7 @@
2525

2626
#import "config.h"
2727
#import "WKWebViewConfigurationInternal.h"
28+
#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
2829

2930
#if WK_API_ENABLED
3031

@@ -237,6 +238,11 @@ - (NSString *)description
237238
return [NSString stringWithFormat:@"<%@: %p; processPool = %@; preferences = %@>", NSStringFromClass(self.class), self, self.processPool, self.preferences];
238239
}
239240

241+
+ (BOOL)supportsSecureCoding
242+
{
243+
return YES;
244+
}
245+
240246
// FIXME: Encode the process pool, user content controller and website data store.
241247

242248
- (void)encodeWithCoder:(NSCoder *)coder
@@ -269,13 +275,13 @@ - (instancetype)initWithCoder:(NSCoder *)coder
269275
if (!(self = [self init]))
270276
return nil;
271277

272-
self.processPool = [coder decodeObjectForKey:@"processPool"];
273-
self.preferences = [coder decodeObjectForKey:@"preferences"];
274-
self.userContentController = [coder decodeObjectForKey:@"userContentController"];
275-
self.websiteDataStore = [coder decodeObjectForKey:@"websiteDataStore"];
278+
self.processPool = decodeObjectOfClassForKeyFromCoder([WKProcessPool class], @"processPool", coder);
279+
self.preferences = decodeObjectOfClassForKeyFromCoder([WKPreferences class], @"preferences", coder);
280+
self.userContentController = decodeObjectOfClassForKeyFromCoder([WKUserContentController class], @"userContentController", coder);
281+
self.websiteDataStore = decodeObjectOfClassForKeyFromCoder([WKWebsiteDataStore class], @"websiteDataStore", coder);
276282

277283
self.suppressesIncrementalRendering = [coder decodeBoolForKey:@"suppressesIncrementalRendering"];
278-
self.applicationNameForUserAgent = [coder decodeObjectForKey:@"applicationNameForUserAgent"];
284+
self.applicationNameForUserAgent = decodeObjectOfClassForKeyFromCoder([NSString class], @"applicationNameForUserAgent", coder);
279285
self.allowsAirPlayForMediaPlayback = [coder decodeBoolForKey:@"allowsAirPlayForMediaPlayback"];
280286

281287
#if PLATFORM(IOS)

Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2014 Apple Inc. All rights reserved.
2+
* Copyright (C) 2014-2017 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -38,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN
3838
IndexedDB databases, and local storage.
3939
*/
4040
WK_CLASS_AVAILABLE(macosx(10.11), ios(9.0))
41-
@interface WKWebsiteDataStore : NSObject <NSCoding>
41+
@interface WKWebsiteDataStore : NSObject <NSSecureCoding>
4242

4343
/* @abstract Returns the default data store. */
4444
+ (WKWebsiteDataStore *)defaultDataStore;

Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ - (void)dealloc
5959
[super dealloc];
6060
}
6161

62+
+ (BOOL)supportsSecureCoding
63+
{
64+
return YES;
65+
}
66+
6267
- (instancetype)initWithCoder:(NSCoder *)coder
6368
{
6469
if (!(self = [super init]))

Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ typedef NS_ENUM(NSInteger, _WKApplicationManifestDisplayMode) {
4141
} WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
4242

4343
WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
44-
@interface _WKApplicationManifest : NSObject <NSCoding>
44+
@interface _WKApplicationManifest : NSObject <NSSecureCoding>
4545

4646
@property (nonatomic, readonly, nullable, copy) NSString *name;
4747
@property (nonatomic, readonly, nullable, copy) NSString *shortName;

Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,25 @@
3030

3131
#import <WebCore/ApplicationManifest.h>
3232
#import <WebCore/ApplicationManifestParser.h>
33+
#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
3334

3435
@implementation _WKApplicationManifest
3536

3637
#if ENABLE(APPLICATION_MANIFEST)
3738

39+
+ (BOOL)supportsSecureCoding
40+
{
41+
return YES;
42+
}
43+
3844
- (instancetype)initWithCoder:(NSCoder *)aDecoder
3945
{
40-
NSString *name = [aDecoder decodeObjectForKey:@"name"];
41-
NSString *shortName = [aDecoder decodeObjectForKey:@"short_name"];
42-
NSString *description = [aDecoder decodeObjectForKey:@"description"];
43-
NSURL *scopeURL = [aDecoder decodeObjectForKey:@"scope"];
46+
NSString *name = decodeObjectOfClassForKeyFromCoder([NSString class], @"name", aDecoder);
47+
NSString *shortName = decodeObjectOfClassForKeyFromCoder([NSString class], @"short_name", aDecoder);
48+
NSString *description = decodeObjectOfClassForKeyFromCoder([NSString class], @"description", aDecoder);
49+
NSURL *scopeURL = decodeObjectOfClassForKeyFromCoder([NSURL class], @"scope", aDecoder);
4450
NSInteger display = [aDecoder decodeIntegerForKey:@"display"];
45-
NSURL *startURL = [aDecoder decodeObjectForKey:@"start_url"];
51+
NSURL *startURL = decodeObjectOfClassForKeyFromCoder([NSURL class], @"start_url", aDecoder);
4652

4753
WebCore::ApplicationManifest coreApplicationManifest {
4854
WTF::String(name),

Tools/ChangeLog

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
2018-01-02 Brent Fulgham <[email protected]>
2+
3+
[macOS, iOS] Adopt new secure coding APIs in WebKit
4+
https://bugs.webkit.org/show_bug.cgi?id=181085
5+
<rdar://problem/34837397>
6+
7+
Reviewed by Tim Horton.
8+
9+
Update API tests to use secure coding wherever possible. Currently, NSView/UIView-based classes are not
10+
capable of supporting NSSecureCoding, so pass through the current coding routines.
11+
12+
* TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm: Updated for NSSecureCoding.
13+
* TestWebKitAPI/Tests/WebKitCocoa/Coding.mm:
14+
(encodeAndDecode): Check if class supports the NSSecureCoding protocol and use non-secure coding
15+
routines if necessary.
16+
(TEST): Updated for NSSecureCoding.
17+
* TestWebKitAPI/Tests/mac/EarlyKVOCrash.mm:
18+
(TestWebKitAPI::TEST): Updated for NSSecureCoding.
19+
120
2017-12-28 Yusuke Suzuki <[email protected]>
221

322
Remove std::chrono completely

Tools/TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#import <WebKit/WKWebViewConfigurationPrivate.h>
3535
#import <WebKit/WKWebViewPrivate.h>
3636
#import <WebKit/_WKApplicationManifest.h>
37+
#import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
3738

3839
namespace TestWebKitAPI {
3940

@@ -42,7 +43,7 @@
4243
auto jsonString = @"{ \"name\": \"TestName\", \"short_name\": \"TestShortName\", \"description\": \"TestDescription\", \"scope\": \"https://test.com/app\", \"start_url\": \"https://test.com/app/index.html\", \"display\": \"minimal-ui\" }";
4344
RetainPtr<_WKApplicationManifest> manifest { [_WKApplicationManifest applicationManifestFromJSON:jsonString manifestURL:[NSURL URLWithString:@"https://test.com/manifest.json"] documentURL:[NSURL URLWithString:@"https://test.com/"]] };
4445

45-
manifest = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:manifest.get()]];
46+
manifest = unarchivedObjectOfClassesFromData([NSSet setWithObject:[_WKApplicationManifest class]], securelyArchivedDataWithRootObject(manifest.get()));
4647

4748
EXPECT_TRUE([manifest isKindOfClass:[_WKApplicationManifest class]]);
4849
EXPECT_STREQ("TestName", manifest.get().name.UTF8String);

0 commit comments

Comments
 (0)