Open Bug 2034016 Opened 6 months ago Updated 6 months ago

importmaps break if extension inserts module script at document_start timing

Categories

(Core :: JavaScript Engine, defect, P3)

Firefox 152
defect

Tracking

()

UNCONFIRMED

People

(Reporter: mariano, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0

Steps to reproduce:

visited a website that uses importmaps like https://marianoguerra.github.io/tutuca/ with the immutablejs extension [1]

[1] https://immutable-js.com/browser-extension/

https://github.com/immutable-js/immutable-devtools/blob/3bd80e851f51a1b78a860c1e6e47c69e400b268f/packages/extension/extension/content-script.js#L13

Actual results:

The interactive content failed to load with error:

"Import maps are not allowed after a module load or preload has started."

Expected results:

the page should have loaded, the page itself doesn't include any script before the import map, the extension does, here: https://github.com/immutable-js/immutable-devtools/blob/3bd80e851f51a1b78a860c1e6e47c69e400b268f/packages/extension/extension/content-script.js#L13

The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Product: Firefox → WebExtensions

The extension inserts a script element with type="module" at document_start timing, which is before the content's importmap is processed.
It breaks the requirement before the https://github.com/whatwg/html/pull/10528 change.

Bug 1916277 implemented the new behavior behind the dom.multiple_import_maps.enabled pref.
The pref is going to be flipped in bug 2021012.

Component: Untriaged → JavaScript Engine
Depends on: 2021012
Product: WebExtensions → Core
Summary: importmaps break if extension active → importmaps break if extension inserts module script at document_start timing
Blocks: sm-dom
Severity: -- → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.