Convert /remote/cdp JSM modules to ESM
Categories
(Remote Protocol :: Agent, task, P1)
Tracking
(firefox107 fixed)
Tracking | Status | |
---|---|---|
firefox107 | --- | fixed |
People
(Reporter: whimboo, Assigned: jdescottes)
References
Details
(Whiteboard: [webdriver:m5] [esmification-timeline])
Attachments
(2 files)
Once all the shared modules have been converted to ESM modules over on bug 1790468 all the files under remote/cdp
can be converted as well.
Reporter | ||
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Depends on D158297
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
Depends on D158298
Assignee | ||
Comment 3•2 years ago
|
||
Mark, Arai,
Quick question about frame scripts, as we have one in this folder: https://searchfox.org/mozilla-central/source/remote/cdp/sessions/frame-script.js
Should they be migrated to ESMs? It seems to work (or rather it doesn't seem to break) if I just manually rename them to sys.mjs (and ignore the eslint warning related to the usage of this
, but I don't know if they are actually loaded as ESMs or just as a regular js file.
Comment 4•2 years ago
|
||
(In reply to Julian Descottes [:jdescottes] from comment #3)
Should they be migrated to ESMs? It seems to work (or rather it doesn't seem to break) if I just manually rename them to sys.mjs (and ignore the eslint warning related to the usage of
this
, but I don't know if they are actually loaded as ESMs or just as a regular js file.
I think Arai would be best to answer this. I do know that we don't yet support workers as ES modules, but I don't know how frame scripts work. The fact that this
works for it currently suggests that it isn't being loaded as a module.
Comment 5•2 years ago
|
||
Frame script does not support ESM, and it's always regular script.
already_AddRefed<JS::Stencil>
nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript(
const nsAString& aURL, bool aRunInUniqueScope,
JS::Handle<JSObject*> aMessageManager) {
...
stencil = JS::CompileGlobalScriptToStencil(cx, options, srcBuf);
to my understanding, the file extension doesn't matter, but import
/ export
syntax doesn't work there.
Assignee | ||
Comment 6•2 years ago
|
||
Great! Thanks for the quick feedback :)
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/407ee0d19e23 [cdp] Convert /remote/cdp JSM modules to ESM r=webdriver-reviewers,whimboo https://hg.mozilla.org/integration/autoland/rev/256e9641f5ae [remote] Remove remote/.eslintrc.js r=webdriver-reviewers,whimboo
Comment 8•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/407ee0d19e23
https://hg.mozilla.org/mozilla-central/rev/256e9641f5ae
Reporter | ||
Updated•2 years ago
|
Description
•