Currently playing with injecting content scripts in the same host with different worlds (MAIN vs ISOLATION) and came across a very odd behavior that does not appear to be documented, so I assume it is a bug.
Given the following manifest.json configuration:
Where common.js contains constants and common functions, example:
const Settings = {...};
And both the main.js and isolated.js files make use of the definitions in common.js.
For some reason the isolated.js will throw an error stating ReferenceError: SettingData is not defined
Yet, when I exclude the common.js file from the main.js configuration like this:
Then the isolated.js error goes away and everything works correctly.
This is very unexpected because I thought the scripts could not be shared between different worlds, yet they appear to be interfering with each other.
However, if I try to do the following:
It will still throw the same error in isolated.js, so it seems like the same const definitions in common.js cannot be redefined between different worlds, yet they cannot be used between them either.
Is this a bug? I cannot find anything in the official docs.