Bug 266933

Summary: browser.i18n.getMessage() 'recursively' applies substitutions, can get stuck in infinite loop
Product: WebKit Reporter: 5gmiooe8
Component: WebKit ExtensionsAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: jan, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: Mac (Intel)   
OS: macOS 14   
Attachments:
Description Flags
Test extension xcode project none

5gmiooe8
Reported 2023-12-29 10:55:21 PST
Created attachment 469240 [details] Test extension xcode project Using this _locales/en/messages.json: { "hello": { "message": "Hello $1" } } I get this output in Safari's console when inspecting background page or service worker: browser.i18n.getMessage("hello", "world") // "Hello world" browser.i18n.getMessage("hello", "world $2") // "Hello world " browser.i18n.getMessage("hello", ["world $2", "!"]) // "Hello world !" browser.i18n.getMessage("hello", "$1") // ** never returns ** Firefox gives expected results: browser.i18n.getMessage("hello", "world") // "Hello world" browser.i18n.getMessage("hello", "world $2") // "Hello world $2" browser.i18n.getMessage("hello", ["world $2", "!"]) // "Hello world $2" browser.i18n.getMessage("hello", "$1") // "Hello $1"
Attachments
Test extension xcode project (344.52 KB, application/zip)
2023-12-29 10:55 PST, 5gmiooe8
no flags
Radar WebKit Bug Importer
Comment 1 2023-12-29 10:55:29 PST
Note You need to log in before you can comment on or make changes to this bug.