This is working for me with 16.4.1, at least when I run it with world: "MAIN".
Here is my working (chromium/safari cross-platform) code:
const stuff = await chrome.scripting.executeScript({
target: { tabId: tab.id },
func: (lang) => {
const subs = window.mysubs[lang];
const language = window.mylanguage;
return {
subs,
language,
};
},
args: [myLang],
world: "MAIN",
});
/* safari doesn't return InjectionResults, it returns the values directly;*/
myData = stuff[0]?.result || stuff[0];