Are common content scripts in different worlds suppose to interfere with each other?

123 views
Skip to first unread message

Particle

unread,
Feb 6, 2024, 3:51:34 PM2/6/24
to Chromium Extensions
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:

Screenshot 2024-02-06 154414.png

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:
Screenshot 2024-02-06 154819.png

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:
Screenshot 2024-02-06 155007.png

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.

wOxxOm

unread,
Feb 6, 2024, 5:10:59 PM2/6/24
to Chromium Extensions, Particle
Assuming it's not caused by you forgetting to reload the extension after editing a previously incorrect manifest.json, it is absolutely a bug, you can report it in https://crbug.com along with a minimal demo extension.

wOxxOm

unread,
Feb 6, 2024, 5:39:48 PM2/6/24
to Chromium Extensions, wOxxOm, Particle
But first make sure it's not already fixed in Chrome Canary or in Chromium trunk build.

Particle

unread,
Feb 6, 2024, 8:51:09 PM2/6/24
to Chromium Extensions, wOxxOm, Particle
Seems like it is not fixed in the Chromium trunk build either:

Screenshot 2024-02-06 204947.png

Particle

unread,
Feb 6, 2024, 9:19:16 PM2/6/24
to Chromium Extensions, Particle
In case anyone finds this down the road, I've filed an issue for this: https://issues.chromium.org/issues/324096753
Reply all
Reply to author
Forward
0 new messages