[webkit-changes] [WebKit/WebKit] 2b1e91: WebKit's CNPostalAddress serialization confuses em...

Brady Eidson noreply at github.com
Wed Apr 17 11:29:08 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2b1e91d086f9cc43aa9115c91b28d4baa77faeda
      https://github.com/WebKit/WebKit/commit/2b1e91d086f9cc43aa9115c91b28d4baa77faeda
  Author: Brady Eidson <beidson at apple.com>
  Date:   2024-04-17 (Wed, 17 Apr 2024)

  Changed paths:
    M Source/WebKit/Shared/Cocoa/CoreIPCContacts.mm
    M Tools/TestWebKitAPI/Tests/IPC/IPCSerialization.mm

  Log Message:
  -----------
  WebKit's CNPostalAddress serialization confuses empty-vs-nil for formattedAddress
rdar://126270905

Reviewed by Ben Nham.

The default (NSString *) operator converts null strings to an empty @""

For CNPostalAddress, that means we were losing important fidelity in the deserialized object
that was breaking other frameworks in subtle ways.

This was further confused by the fact that CNPostalAddresses `isEqual:` method treats nil
and empty string as equivalent on these properties.

`nsStringNilIfNull` to the rescue - along with a regression test that manually makes sure we
got the nil-vs-empty part correct.

* Source/WebKit/Shared/Cocoa/CoreIPCContacts.mm:
(WebKit::CoreIPCCNPostalAddress::toID const):

* Tools/TestWebKitAPI/Tests/IPC/IPCSerialization.mm:
(CNPostalAddressTesting_isEqual):
(operator==):
(TEST(IPCSerialization, Basic)):

Canonical link: https://commits.webkit.org/277627@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list