Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 431c31819b794afe09f7584e0530cf8cd0dd6983
https://github.com/WebKit/WebKit/commit/431c31819b794afe09f7584e0530cf8cd0dd6983
Author: Elijah Sawyers <[email protected]>
Date: 2026-09-11 (Fri, 11 Sep 2026)
Changed paths:
M
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPILocalizationCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPILocalization.h
M
Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPILocalization.idl
M
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPILocalization.mm
Log Message:
-----------
i18n.getMessage() drops non-string substitution arguments instead of coercing
them to strings
https://bugs.webkit.org/show_bug.cgi?id=291956
rdar://149855718
Reviewed by Kiara Rose and Timothy Hatcher.
This patch makes browser.i18n.getMessage() coerce every substitution argument
to a
string with
JavaScript String() semantics, matching Chrome and Firefox. The argument
was previously bridged to an Objective-C object and filtered down to NSString
values,
so a number like getMessage(key, [5]) was dropped; because the filter compacted
the
array, it also shifted the remaining positional arguments, turning
getMessage(key, [5, "x"]) into $1 = "x" with $2 empty.
The substitutions are now received as a JSValue and each element is converted
with the
engine's own toString, which reproduces String() for numbers, booleans, null,
undefined,
bigints, objects, and arrays without dropping elements or shifting positions.
The
conversion has to happen at the JavaScript boundary because the bridged object
cannot
reproduce those results (a boolean and a number both bridge to NSNumber, and so
on).
Test:
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPILocalization.mm
*
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPILocalizationCocoa.mm:
(WebKit::WebExtensionAPILocalization::getMessage):
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPILocalization.h:
*
Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPILocalization.idl:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPILocalization.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPILocalization, Placeholders)):
Canonical link:
https://flagged.apple.com:443/proxy?t2=DP6t0a6Pe0&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzIwOTMxQG1haW4=&emid=ba068b86-d04c-4889-bc19-c3353fc4fa85&c=11
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications