Title: [284217] trunk/Source/WebKit
Revision
284217
Author
[email protected]
Date
2021-10-14 17:18:33 -0700 (Thu, 14 Oct 2021)

Log Message

Update deleteLocalAuthenticatorCredentialWithID and setUsernameForLocalCredentialWithID according to internal needs
https://bugs.webkit.org/show_bug.cgi?id=231777
rdar://84276065

Patch by John Pascoe <[email protected]> on 2021-10-14
Reviewed by Brent Fulgham.

Covered by manual tests.

* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(+[_WKWebAuthenticationPanel deleteLocalAuthenticatorCredentialWithID:]):
(+[_WKWebAuthenticationPanel setUsernameForLocalCredentialWithID:username:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (284216 => 284217)


--- trunk/Source/WebKit/ChangeLog	2021-10-14 23:55:58 UTC (rev 284216)
+++ trunk/Source/WebKit/ChangeLog	2021-10-15 00:18:33 UTC (rev 284217)
@@ -1,3 +1,17 @@
+2021-10-14  John Pascoe  <[email protected]>
+
+        Update deleteLocalAuthenticatorCredentialWithID and setUsernameForLocalCredentialWithID according to internal needs
+        https://bugs.webkit.org/show_bug.cgi?id=231777
+        rdar://84276065
+
+        Reviewed by Brent Fulgham.
+
+        Covered by manual tests.
+
+        * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
+        (+[_WKWebAuthenticationPanel deleteLocalAuthenticatorCredentialWithID:]):
+        (+[_WKWebAuthenticationPanel setUsernameForLocalCredentialWithID:username:]):
+
 2021-10-14  Alex Christensen  <[email protected]>
 
         Reduce memory use of AdAttributionDaemon

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm (284216 => 284217)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm	2021-10-14 23:55:58 UTC (rev 284216)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm	2021-10-15 00:18:33 UTC (rev 284217)
@@ -277,12 +277,15 @@
 + (void)deleteLocalAuthenticatorCredentialWithID:(NSData *)credentialID
 {
 #if ENABLE(WEB_AUTHN)
-    NSDictionary* deleteQuery = @{
+    auto deleteQuery = adoptNS([[NSMutableDictionary alloc] init]);
+    [deleteQuery setDictionary:@{
         (__bridge id)kSecClass: (__bridge id)kSecClassKey,
         (__bridge id)kSecAttrApplicationLabel: credentialID,
         (__bridge id)kSecUseDataProtectionKeychain: @YES
-    };
-    SecItemDelete((__bridge CFDictionaryRef)deleteQuery);
+    }];
+    updateQueryIfNecessary(deleteQuery.get());
+
+    SecItemDelete((__bridge CFDictionaryRef)deleteQuery.get());
 #endif
 }
 
@@ -296,15 +299,18 @@
 + (void)setUsernameForLocalCredentialWithID:(NSData *)credentialID username: (NSString *)username
 {
 #if ENABLE(WEB_AUTHN)
-    NSDictionary* query = @{
+    auto query = adoptNS([[NSMutableDictionary alloc] init]);
+    [query setDictionary:@{
         (__bridge id)kSecClass: (__bridge id)kSecClassKey,
         (__bridge id)kSecReturnAttributes: @YES,
         (__bridge id)kSecAttrApplicationLabel: credentialID,
         (__bridge id)kSecReturnPersistentRef : (__bridge id)kCFBooleanTrue,
         (__bridge id)kSecUseDataProtectionKeychain: @YES
-    };
+    }];
+    updateQueryIfNecessary(query.get());
+
     CFTypeRef attributesArrayRef = nullptr;
-    OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &attributesArrayRef);
+    OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query.get(), &attributesArrayRef);
     if (status && status != errSecItemNotFound) {
         ASSERT_NOT_REACHED();
         return;
@@ -336,11 +342,14 @@
     NSDictionary *updateParams = @{
         (__bridge id)kSecAttrApplicationTag: secAttrApplicationTag,
     };
-    query = @{
+
+    [query setDictionary:@{
         (__bridge id)kSecValuePersistentRef: [attributes objectForKey:(__bridge id)kSecValuePersistentRef],
         (__bridge id)kSecClass: (__bridge id)kSecClassKey,
-    };
-    status = SecItemUpdate((__bridge CFDictionaryRef)query, (__bridge CFDictionaryRef)updateParams);
+    }];
+    updateQueryIfNecessary(query.get());
+
+    status = SecItemUpdate((__bridge CFDictionaryRef)query.get(), (__bridge CFDictionaryRef)updateParams);
     if (status && status != errSecItemNotFound) {
         ASSERT_NOT_REACHED();
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to