Title: [256562] trunk
- Revision
- 256562
- Author
- [email protected]
- Date
- 2020-02-13 15:10:46 -0800 (Thu, 13 Feb 2020)
Log Message
_WKResourceLoadInfo should conform to NSSecureCoding
https://bugs.webkit.org/show_bug.cgi?id=207667
Reviewed by Brady Eidson.
Source/WebKit:
This makes rdar://problem/57132290 nicer.
Covered by API tests.
* UIProcess/API/Cocoa/_WKResourceLoadInfo.h:
* UIProcess/API/Cocoa/_WKResourceLoadInfo.mm:
(+[_WKResourceLoadInfo supportsSecureCoding]):
(-[_WKResourceLoadInfo initWithCoder:]):
(-[_WKResourceLoadInfo encodeWithCoder:]):
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadDelegate.mm:
(TEST):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (256561 => 256562)
--- trunk/Source/WebKit/ChangeLog 2020-02-13 23:08:15 UTC (rev 256561)
+++ trunk/Source/WebKit/ChangeLog 2020-02-13 23:10:46 UTC (rev 256562)
@@ -1,5 +1,21 @@
2020-02-13 Alex Christensen <[email protected]>
+ _WKResourceLoadInfo should conform to NSSecureCoding
+ https://bugs.webkit.org/show_bug.cgi?id=207667
+
+ Reviewed by Brady Eidson.
+
+ This makes rdar://problem/57132290 nicer.
+ Covered by API tests.
+
+ * UIProcess/API/Cocoa/_WKResourceLoadInfo.h:
+ * UIProcess/API/Cocoa/_WKResourceLoadInfo.mm:
+ (+[_WKResourceLoadInfo supportsSecureCoding]):
+ (-[_WKResourceLoadInfo initWithCoder:]):
+ (-[_WKResourceLoadInfo encodeWithCoder:]):
+
+2020-02-13 Alex Christensen <[email protected]>
+
Deprecate _WKUserContentWorld replaced by WKContentWorld
https://bugs.webkit.org/show_bug.cgi?id=207514
Modified: trunk/Source/WebKit/UIProcess/API/APIResourceLoadInfo.h (256561 => 256562)
--- trunk/Source/WebKit/UIProcess/API/APIResourceLoadInfo.h 2020-02-13 23:08:15 UTC (rev 256561)
+++ trunk/Source/WebKit/UIProcess/API/APIResourceLoadInfo.h 2020-02-13 23:10:46 UTC (rev 256562)
@@ -37,16 +37,14 @@
return adoptRef(*new ResourceLoadInfo(WTFMove(info)));
}
+ explicit ResourceLoadInfo(WebKit::ResourceLoadInfo&& info)
+ : m_info(WTFMove(info)) { }
+
WebKit::NetworkResourceLoadIdentifier resourceLoadID() const { return m_info.resourceLoadID; }
Optional<WebCore::FrameIdentifier> frameID() const { return m_info.frameID; }
Optional<WebCore::FrameIdentifier> parentFrameID() const { return m_info.parentFrameID; }
private:
- explicit ResourceLoadInfo(WebKit::ResourceLoadInfo&& info)
- : m_info(WTFMove(info))
- {
- }
-
const WebKit::ResourceLoadInfo m_info;
};
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKResourceLoadInfo.h (256561 => 256562)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKResourceLoadInfo.h 2020-02-13 23:08:15 UTC (rev 256561)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKResourceLoadInfo.h 2020-02-13 23:10:46 UTC (rev 256562)
@@ -30,7 +30,7 @@
NS_ASSUME_NONNULL_BEGIN
WK_CLASS_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA))
-@interface _WKResourceLoadInfo : NSObject
+@interface _WKResourceLoadInfo : NSObject <NSSecureCoding>
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKResourceLoadInfo.mm (256561 => 256562)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKResourceLoadInfo.mm 2020-02-13 23:08:15 UTC (rev 256561)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKResourceLoadInfo.mm 2020-02-13 23:10:46 UTC (rev 256562)
@@ -28,6 +28,7 @@
#import "APIFrameHandle.h"
#import "APIResourceLoadInfo.h"
+#import "ResourceLoadInfo.h"
#import "_WKFrameHandleInternal.h"
#import "_WKResourceLoadInfoInternal.h"
@@ -63,5 +64,51 @@
return *_info;
}
++ (BOOL)supportsSecureCoding
+{
+ return YES;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)coder
+{
+ if (!(self = [super init]))
+ return nil;
+
+ NSNumber *resourceLoadID = [coder decodeObjectOfClass:[NSNumber class] forKey:@"resourceLoadID"];
+ if (!resourceLoadID) {
+ [self release];
+ return nil;
+ }
+
+ NSNumber *frame = [coder decodeObjectOfClass:[NSNumber class] forKey:@"frame"];
+ if (!frame) {
+ [self release];
+ return nil;
+ }
+
+ NSNumber *parentFrame = [coder decodeObjectOfClass:[NSNumber class] forKey:@"parentFrame"];
+ if (!parentFrame) {
+ [self release];
+ return nil;
+ }
+
+ WebKit::ResourceLoadInfo info {
+ makeObjectIdentifier<WebKit::NetworkResourceLoadIdentifierType>(resourceLoadID.unsignedLongLongValue),
+ makeObjectIdentifier<WebCore::FrameIdentifierType>(frame.unsignedLongLongValue),
+ makeObjectIdentifier<WebCore::FrameIdentifierType>(parentFrame.unsignedLongLongValue)
+ };
+
+ API::Object::constructInWrapper<API::ResourceLoadInfo>(self, WTFMove(info));
+
+ return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder
+{
+ [coder encodeObject:@(self.resourceLoadID) forKey:@"resourceLoadID"];
+ [coder encodeObject:@(self.frame.frameID) forKey:@"frame"];
+ [coder encodeObject:@(self.parentFrame.frameID) forKey:@"parentFrame"];
+}
+
@end
Modified: trunk/Tools/ChangeLog (256561 => 256562)
--- trunk/Tools/ChangeLog 2020-02-13 23:08:15 UTC (rev 256561)
+++ trunk/Tools/ChangeLog 2020-02-13 23:10:46 UTC (rev 256562)
@@ -1,3 +1,13 @@
+2020-02-13 Alex Christensen <[email protected]>
+
+ _WKResourceLoadInfo should conform to NSSecureCoding
+ https://bugs.webkit.org/show_bug.cgi?id=207667
+
+ Reviewed by Brady Eidson.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadDelegate.mm:
+ (TEST):
+
2020-02-13 Stephan Szabo <[email protected]>
[PlayStation] Add Buildbots for Debug/Release builds
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadDelegate.mm (256561 => 256562)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadDelegate.mm 2020-02-13 23:08:15 UTC (rev 256561)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadDelegate.mm 2020-02-13 23:10:46 UTC (rev 256562)
@@ -305,6 +305,17 @@
EXPECT_WK_STREQ(NSStringFromClass([otherParameters[7] class]), "NSHTTPURLResponse");
EXPECT_WK_STREQ([otherParameters[7] URL].path, "/fetchTarget");
EXPECT_EQ(otherParameters[8], nil);
+
+ _WKResourceLoadInfo *original = loadInfos[0].get();
+ NSError *error = nil;
+ NSData *archiveData = [NSKeyedArchiver archivedDataWithRootObject:original requiringSecureCoding:YES error:&error];
+ EXPECT_EQ(archiveData.length, 299ull);
+ EXPECT_FALSE(error);
+ _WKResourceLoadInfo *deserialized = [NSKeyedUnarchiver unarchivedObjectOfClass:[_WKResourceLoadInfo class] fromData:archiveData error:&error];
+ EXPECT_FALSE(error);
+ EXPECT_TRUE(deserialized.resourceLoadID == original.resourceLoadID);
+ EXPECT_TRUE(deserialized.frame.frameID == original.frame.frameID);
+ EXPECT_TRUE(deserialized.parentFrame.frameID == original.parentFrame.frameID);
}
#endif // HAVE(NETWORK_FRAMEWORK)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes