Closed Bug 1835279 Opened 2 years ago Closed 2 years ago

Add support for ES modules in PromiseWorker

Categories

(Toolkit :: Async Tooling, task, P3)

task

Tracking

()

RESOLVED FIXED
117 Branch
Tracking Status
firefox117 --- fixed

People

(Reporter: standard8, Assigned: arai)

References

Details

Attachments

(1 file)

Bug 1834360 added support for ES modules to Chrome workers.

We should probably use automatic detection of the file extension (mjs vs js) to set the module type when creating the chrome worker.

Using mjs also allows our tools to detect the files as modules, so I think it is reasonable to use that as the detection switch.

It might also be worth checking that PromiseWorker.js can correctly be loaded into a chrome module. I don't know if the require method will still work with modules.

With support for ESM imports, require support is not strictly required, at least not for new code.

There is a new consumer of PromiseWorker in bug 1831947 that uses require for the lack of anything better, but if modules were to be supported, that would have been preferable. (Hmm would dynamic imports work to reduce the migration effort down the road?)

Severity: -- → N/A
Priority: -- → P3
Blocks: 1836386
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED

In order to use the same implementation between regular script and module script,
convert PromiseWorker.js into a template, which is processed by GeneratePromiseWorkerScript.py.

Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/4429ec0ce7e1 Add support for ES modules in PromiseWorker. r=Gijs
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/05eb5d19b4fb Add support for ES modules in PromiseWorker. r=Gijs
Flags: needinfo?(arai.unmht)
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: