Closed Bug 1580536 Opened 5 months ago Closed 4 months ago

Dynamic module import generates an error at parse time in contexts where it is not supported

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: jonco, Assigned: jonco)

Details

Attachments

(1 file)

Currently use of dynamic import causes a syntax error at parse time in web workers. Bug 1540913 comment 6 suggests that it would be more useful for this to fail at runtime as it would make it easier to provide a fallback for web worker scripts when run in FF.

Priority: -- → P2

This removes the parse-time check for whether dynamic import hook has been set. There's already a runtime check for this too, previously just to support enabling/disabling dynamic import via a pref. I updated web platform tests and expectations so that use of dynamic imports in wokers is now an expected failure (previously we would time out).

It would be very much appreciated to get the fix to replace the parse time with a run time check into FF.

I am creating a new web worker driven UI framework and this error is a big show stopper.
I had to replace several JS modules with copies (if possible), just to exclude unreachable code from FF.

In general: adding support for JS modules & dynamic imports inside the worker scope should get a high priority,
since this is a direction UI app development is moving towards to.

Thx & best regards
Tobi

Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/31e9cee63560
Make dynamic import a runtime error in contexts where we don't support it r=jorendorff
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/19678 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Upstream PR merged by moz-wptsync-bot
Assignee: nobody → jcoppeard
Pushed by archaeopteryx@coole-files.de:
https://hg.mozilla.org/mozilla-central/rev/8aa8bbbf0bee
Add back test annotations lost during merge conflict. a=permafail-fix,test-only
You need to log in before you can comment on or make changes to this bug.