Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: eefa5dc4c3abc58108fa03071a9948f52abbd22d
      
https://github.com/WebKit/WebKit/commit/eefa5dc4c3abc58108fa03071a9948f52abbd22d
  Author: Chris Dumez <[email protected]>
  Date:   2026-09-14 (Mon, 14 Sep 2026)

  Changed paths:
    M Source/WTF/wtf/SHA1.cpp
    M Source/WTF/wtf/URLHelpers.cpp
    M Source/WTF/wtf/URLHelpers.h
    M Source/WTF/wtf/cocoa/NSURLExtras.mm
    M Source/WTF/wtf/text/CString.h
    M Source/WTF/wtf/text/TextStream.cpp
    M Source/WTF/wtf/text/TextStream.h
    M Source/WebCore/Modules/mediastream/RTCDataChannelRemoteHandler.cpp
    M Source/WebCore/Modules/mediastream/RTCDataChannelRemoteHandler.h
    M Source/WebCore/Modules/mediastream/RTCDataChannelRemoteSource.h
    M 
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp
    M Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h
    M Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h
    M Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp
    M Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.h
    M Source/WebCore/Scripts/generate-log-declarations.py
    M Source/WebCore/fileapi/NetworkSendQueue.cpp
    M Source/WebCore/fileapi/NetworkSendQueue.h
    M Source/WebCore/platform/mediastream/RTCDataChannelHandler.h
    M Source/WebCore/platform/mock/RTCDataChannelHandlerMock.cpp
    M Source/WebCore/platform/mock/RTCDataChannelHandlerMock.h
    M Source/WebCore/testing/Internals.cpp
    M Source/WebKit/Platform/LogClient.cpp
    M Source/WebKit/Platform/LogClient.h
    M Source/WebKit/Scripts/generate-derived-log-sources.py
    M Source/WebKit/Scripts/webkit/opaque_ipc_types.tracking.in
    M Source/WebKit/Shared/Cocoa/AuxiliaryProcessCocoa.mm
    M Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm
    M Source/WebKit/Shared/LogStream.h
    M Source/WebKit/Shared/LogStream.mm
    M Source/WebKit/Shared/SandboxExtension.h
    M Source/WebKit/Shared/SandboxExtension.serialization.in
    M Source/WebKit/UIProcess/API/glib/WebKitURIUtilities.cpp
    M Source/WebKit/UIProcess/Cocoa/AuxiliaryProcessProxyCocoa.mm
    M Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm
    M Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
    M Source/WebKit/WebProcess/Network/WebSocketChannel.cpp
    M Source/WebKit/WebProcess/Network/WebSocketChannel.h
    M Source/WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp
    M Source/WebKitLegacy/WebCoreSupport/WebSocketChannel.cpp
    M Source/WebKitLegacy/WebCoreSupport/WebSocketChannel.h

  Log Message:
  -----------
  Type the WebSocket, RTCDataChannel and log text paths as UTF8CString and 
remove CString's encoding-bearing constructors
https://bugs.webkit.org/show_bug.cgi?id=324082

Reviewed by Darin Adler.

CString(std::span<const Latin1Character>) and CString(std::span<const char8_t>) 
both
byteCast into the same char buffer, so the encoding they name is discarded as 
the string is
built. Removing them is what makes the encoding-aware types compiler-enforced 
rather than a
convention: encoded bytes can no longer reach an untyped CString without an 
explicit
byteCast saying so.

Latin1Character is unsigned char, and so is uint8_t, so the Latin-1 constructor 
was also the
tree's general byte-span-to-CString conversion. That is why the fallout reaches 
well beyond
Latin-1 producers.

The paths that relied on it all carry UTF-8 and said so only in variable names:

- RTCDataChannelHandler::sendStringData() and its mock, remote and libwebrtc 
overrides.
  Data channel string messages are UTF-8 by specification. 
RTCDataChannelRemoteManager was
  labelling them byteCast<Latin1Character>, harmless only because both 
constructors funnelled
  into the same buffer.
- sendStringData() cannot be typed alone: NetworkSendQueue's WriteString handed 
it a
  const CString&, and there is no safe CString-to-typed conversion. Typing 
WriteString,
  enqueue() and Message in turn types the WebSocket text path, whose frames are 
also UTF-8 by
  specification: ThreadableWebSocketChannel::send() and its implementations. 
Both existing
  enqueue() callers already passed String::utf8(), so neither changed.
- Log forwarding now carries char8_t end to end instead of casting to uint8_t 
to cross the
  LogClient virtual and back again on receipt, leaving one cast at the os_log 
SPI boundary.
- userVisibleURL() takes std::span<const char8_t>. It only reads the span and 
its length, so
  requiring a CString forced an allocation on the two callers that had only 
bytes.

SandboxExtensionImpl::m_token is an ASCIICString: the token is null-terminated 
ASCII from
sandbox_extension_issue_*(), and ASCIICString::data() is already the const 
char* that
sandbox_extension_consume() wants. Sending it as an ASCIICString rather than an 
opaque byte
span lets the coder's validator reject non-ASCII with a decode failure instead 
of the
constructor asserting on data from a less privileged process.

* Source/WTF/wtf/SHA1.cpp:
(WTF::SHA1::addUTF8Bytes):
* Source/WTF/wtf/URLHelpers.cpp:
(WTF::URLHelpers::userVisibleURL):
* Source/WTF/wtf/URLHelpers.h:
* Source/WTF/wtf/cocoa/NSURLExtras.mm:
(WTF::userVisibleString):
* Source/WTF/wtf/text/CString.h:
* Source/WebCore/Modules/mediastream/RTCDataChannelRemoteHandler.cpp:
(WebCore::RTCDataChannelRemoteHandler::sendStringData):
* Source/WebCore/Modules/mediastream/RTCDataChannelRemoteHandler.h:
* Source/WebCore/Modules/mediastream/RTCDataChannelRemoteSource.h:
(WebCore::RTCDataChannelRemoteSource::sendStringData):
* Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
(WebCore::LibWebRTCDataChannelHandler::sendStringData):
* Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
* Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h:
* Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
(WebCore::WorkerThreadableWebSocketChannel::send):
(WebCore::WorkerThreadableWebSocketChannel::Peer::send):
(WebCore::WorkerThreadableWebSocketChannel::Bridge::send):
* Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.h:
* Source/WebCore/Scripts/generate-log-declarations.py:
* Source/WebCore/fileapi/NetworkSendQueue.cpp:
(WebCore::NetworkSendQueue::enqueue):
(WebCore::NetworkSendQueue::processMessages):
* Source/WebCore/fileapi/NetworkSendQueue.h:
* Source/WebCore/platform/mediastream/RTCDataChannelHandler.h:
* Source/WebCore/platform/mock/RTCDataChannelHandlerMock.cpp:
(WebCore::RTCDataChannelHandlerMock::sendStringData):
* Source/WebCore/platform/mock/RTCDataChannelHandlerMock.h:
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::userVisibleString):
* Source/WebKit/Platform/LogClient.cpp:
(WebKit::LogClient::log):
* Source/WebKit/Platform/LogClient.h:
* Source/WebKit/Scripts/generate-derived-log-sources.py:
(generate_messages_file):
* Source/WebKit/Scripts/webkit/opaque_ipc_types.tracking.in:
* Source/WebKit/Shared/Cocoa/AuxiliaryProcessCocoa.mm:
(WebKit::registerLogClient):
* Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm:
(WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
(WebKit::SandboxExtensionImpl::sandboxExtensionForType):
(WebKit::SandboxExtensionHandle::SandboxExtensionHandle):
(WebKit::SandboxExtensionImpl::getSerializedFormat): Deleted.
* Source/WebKit/Shared/LogStream.h:
* Source/WebKit/Shared/LogStream.mm:
(WebKit::logWithProcessNamePrefix):
(WebKit::LogStream::logOnBehalfOfWebContent):
* Source/WebKit/Shared/SandboxExtension.h:
(WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
* Source/WebKit/Shared/SandboxExtension.serialization.in:
* Source/WebKit/Shared/WTFArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/glib/WebKitURIUtilities.cpp:
(webkit_uri_for_display):
* Source/WebKit/UIProcess/Cocoa/AuxiliaryProcessProxyCocoa.mm:
(WebKit::AuxiliaryProcessProxy::LogXPCEventHandler::handleXPCEvent):
* Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm:
(WebKit::visibleDomain):
* Source/WebKit/WebProcess/Network/WebSocketChannel.cpp:
(WebKit::WebSocketChannel::createMessageQueue):
(WebKit::WebSocketChannel::send):
* Source/WebKit/WebProcess/Network/WebSocketChannel.h:
* Source/WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp:
(WebKit::RTCDataChannelRemoteManager::sendData):
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveStringData):
* Source/WebKitLegacy/WebCoreSupport/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::send):
(WebCore::WebSocketChannel::enqueueTextFrame):
(WebCore::WebSocketChannel::processOutgoingFrameQueue):
* Source/WebKitLegacy/WebCoreSupport/WebSocketChannel.h:

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



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

Reply via email to