tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 234026d9d26aa46d9f2990a6e15bd3027a3ecd74
parent b508745982b0fb3841090998bda4692d5008e2eb
Author: Fredrik Söderquist <fs@opera.com>
Date:   Thu,  6 Nov 2025 21:37:07 +0000

Bug 1997967 [wpt PR 55828] - Fix conversion from String to Blob in ClipboardItem.getType(), a=testonly

Automatic update from web-platform-tests
Fix conversion from String to Blob in ClipboardItem.getType()

String::Span8() does not return UTF-8 encoded data, but rather Latin-1
if the string has an 8-bit backing. If the string has a 16-bit backing
it returns jibberish.

Fixed: 457303645
Change-Id: Ibce8f4817b6e8571baf041867065da7eb13a9b23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7110225
Auto-Submit: Fredrik Söderquist <fs@opera.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1539397}

--

wpt-commits: a77960afe3fb4e5687215c707f061e4f307d2aea
wpt-pr: 55828

Diffstat:
Mtesting/web-platform/tests/clipboard-apis/async-navigator-clipboard-write-domstring.https.html | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/testing/web-platform/tests/clipboard-apis/async-navigator-clipboard-write-domstring.https.html b/testing/web-platform/tests/clipboard-apis/async-navigator-clipboard-write-domstring.https.html @@ -102,6 +102,21 @@ const item = new ClipboardItem({ 'text/plain': nonLatinText }); + const textBlob = await item.getType('text/plain'); + + // Read back the text and verify it matches + const readText = await textBlob.text(); + assert_equals(readText, nonLatinText, + "Text read from ClipboardItem should match the non-Latin text that was written"); + }, 'write non-Latin characters with DOMString and verify getType returns a Blob with the same string'); + + promise_test(async () => { + await getPermissions(); + // Test string with various non-Latin characters: Chinese, Arabic, Cyrillic, emoji + const nonLatinText = "你好 مرحبا Привет 👋🌍"; + const item = new ClipboardItem({ + 'text/plain': nonLatinText + }); await navigator.clipboard.write([item]); // Read back the text and verify it matches