Infinite loop in "browser.i18n.getMessage" API

I was tracking down an infinite loop and it's caused by calling:

browser.i18n.getMessage('faq_4a', ['$13.99'])

Where the "faq_4a" is defined as:

"faq_4a": {
  "message": "Highlight all prices like $1"
},

The problem is the parameter ['$13.99'], if I use this parameter for any message that accepts a placeholder, it will just froze the console or whatever executed it.

Can someone please try to run this code to verify?

I need to know if this is a Safari issue or if just my Safari broken. I use Safari 15.3 (17612.4.9.1.8).

Thank you!

What appears to be happening is the $1 in $13.99, is attempting to be replaced with the $13.99, which is then attempted to be replaced again.

You should be able to escape the $ somewhere.

And you can escape the $ using $$, so something like this should work:

browser.i18n.getMessage('faq_4a', ['$$13.99'])

This is documented at: https://developer.chrome.com/docs/extensions/mv3/i18n-messages/#message

Let me know if this works!

Infinite loop in "browser.i18n.getMessage" API
 
 
Q