Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: dc774f0cde658499d412683a1f9e69e061b0ff97
https://github.com/WebKit/WebKit/commit/dc774f0cde658499d412683a1f9e69e061b0ff97
Author: Ahmad Saleem <[email protected]>
Date: 2026-09-03 (Thu, 03 Sep 2026)
Changed paths:
M Source/WebCore/Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp
Log Message:
-----------
Use WTF::switchOn for the BufferOrString variant in
ClipboardItemBindingsDataSource
https://bugs.webkit.org/show_bug.cgi?id=323363
rdar://186603909
Reviewed by Chris Dumez.
ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::m_data is a
Variant<String, Ref<SharedBuffer>>, but it was hand-decoded with
std::holds_alternative + std::get pairs in three places. Besides being
verbose, the form in invokeCompletionHandler() only rejected an
unexpected alternative via a catch-all else, so an added variant
alternative could silently fall through elsewhere.
Replace the manual decoding with WTF::switchOn, which is exhaustive over
the variant's alternatives and lets the compiler enforce that every
alternative is handled. No change in behavior: invokeCompletionHandler()
still rejects on a null String, and both dataAsString() and the image/png
sanitization path resolve to the same values as before.
* Source/WebCore/Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
(WebCore::ClipboardItemBindingsDataSource::invokeCompletionHandler):
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::dataAsString
const):
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::sanitizeDataIfNeeded):
Canonical link: https://commits.webkit.org/320480@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications