[webkit-changes] [WebKit/WebKit] 71add0: Fix TextStream dumping of Objective-C types

Simon Fraser noreply at github.com
Thu Nov 2 10:43:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 71add0ad8094e5feccf1bec54608d1889f1be051
      https://github.com/WebKit/WebKit/commit/71add0ad8094e5feccf1bec54608d1889f1be051
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2023-11-02 (Thu, 02 Nov 2023)

  Changed paths:
    M Source/WTF/WTF.xcodeproj/project.pbxproj
    M Source/WTF/wtf/text/TextStream.cpp
    M Source/WTF/wtf/text/TextStream.h
    A Source/WTF/wtf/text/TextStreamCocoa.h
    M Source/WTF/wtf/text/cocoa/TextStreamCocoa.mm
    M Tools/TestWebKitAPI/Tests/WTF/cocoa/TextStreamCocoa.mm

  Log Message:
  -----------
  Fix TextStream dumping of Objective-C types
https://bugs.webkit.org/show_bug.cgi?id=262160
rdar://116094853

Reviewed by Richard Robinson.

Having both `operator<<(id)` and `operator<<(NSArray *)` caused problems, specifically
trying to dump a Class would hit the latter for some reason.

Remove ambiguity by removing `operator<<(NSArray *)` and have all dumping of Objective-C
types go through `operator<<(id)` which internally queries the object type. Add support
for dumping `Class` and `NSDictionary`.

Move functions that dump CG types out of TextStream and into TextStreamCocoa.h as standalone
functions, so that platform-independent headers aren't polluted with CG types.

* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/text/TextStream.cpp:
* Source/WTF/wtf/text/TextStream.h:
* Source/WTF/wtf/text/TextStreamCocoa.h: Added.
* Source/WTF/wtf/text/cocoa/TextStreamCocoa.mm:
(WTF::TextStream::operator<<):
(WTF::operator<<):
* Tools/TestWebKitAPI/Tests/WTF/cocoa/TextStreamCocoa.mm:
(TEST):

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




More information about the webkit-changes mailing list