[meta] Rename all .js files that use EXPORTED_SYMBOLS to .jsm
Categories
(Core :: XPConnect, task, P5)
Tracking
()
People
(Reporter: bgrins, Assigned: arai)
References
(Blocks 1 open bug)
Details
(Keywords: meta)
Attachments
(1 obsolete file)
There are ~140 files with the .js extension but they are loaded as if they are JSMs: https://searchfox.org/mozilla-central/search?q=EXPORTED_SYMBOLS&case=true®exp=false&path=.js%24.
To make things sane while trying to tackle other bugs blocking Bug 1308512, we should rename those to jsm.
Reporter | ||
Updated•4 years ago
|
Updated•4 years ago
|
Reporter | ||
Updated•4 years ago
|
Comment 1•4 years ago
|
||
https://searchfox.org/mozilla-central/source/toolkit/modules/third_party/jsesc is an unusual case btw.
Updated•4 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
NOTE: there are external reference into in-tree .js files
https://github.com/mozilla/application-services/search?q=services%2Fsync%2F
// From https://searchfox.org/mozilla-central/rev/ea63a0888d406fae720cf24f4727d87569a8cab5/services/sync/modules/constants.js#75
/// [Desktop Firefox has an abstract implementation of a Sync
/// Engine](https://searchfox.org/mozilla-central/source/services/sync/modules/engines.js)
/// https://searchfox.org/mozilla-central/rev/c3ebaf6de2d481c262c04bb9657eaf76bf47e2ac/services/sync/modules/browserid_identity.js#185
bridged_engine.rs
points the latest source, so it will become dead link after the rename.
Also, bridged_engine.rs
is vendored https://searchfox.org/mozilla-central/rev/6da1ebe13b260efabd88eb98dec5fa8ee65987b2/third_party/rust/sync15-traits/src/bridged_engine.rs
Assignee | ||
Comment 3•2 years ago
|
||
One more note .jsm.js
extension is used as a workaround for TypeScript checking system, and cannot be renamed.
https://searchfox.org/mozilla-central/search?q=&path=.jsm.js&case=false®exp=false
Comment 4•2 years ago
|
||
You may be interested in what I did for Thunderbird in bug 1529583 - script/commands in the commit message.
Assignee | ||
Comment 5•2 years ago
|
||
browser/components/distribution.js
(resource:///modules/distribution.js
) is referred from out-of-tree code
https://github.com/mkaply/cck2wizard/blob/0d8af5d71a91b1027b3ee0ee0fb05d45b7a21db2/cck2/modules/CCK2.jsm#L17
and renaming the file breaks it.
Also, current shim (bug 1766761) doesn't support *.js
file, so if the module is converted to distribution.sys.mjs
, the code will also stop working.
There are 2 options:
- Move
distribution.js
todistribution.jsm
, and adddistribution.js
as a thin wrapper fordistribution.jsm
, and ESM-ifydistribution.jsm
todistribution.sys.mjs
, leavingdistribution.js
as JSM file. so that import forresource:///modules/distribution.js
keeps working, via the wrapper and shim. - Support
.js
in the shim, and ESM-ifydistribution.js
directly todistribution.sys.mjs
, so thatresource:///modules/distribution.js
keeps working via the updates shim.
:mkaply, can I have your input here?
Is the code in cck2 still alive? if so, what would be the best option here?
Assignee | ||
Updated•2 years ago
|
Comment 6•2 years ago
|
||
Just ignore the distribution.js in CCK2.
- It's not needed anymore (it was working around an old issue).
- CCK2 is basically deprecated.
Assignee | ||
Comment 7•2 years ago
|
||
Updated•2 years ago
|
Comment 8•2 years ago
|
||
(In reply to Tooru Fujisawa [:arai] from comment #5)
browser/components/distribution.js
(resource:///modules/distribution.js
) is referred from out-of-tree code
https://github.com/mkaply/cck2wizard/blob/0d8af5d71a91b1027b3ee0ee0fb05d45b7a21db2/cck2/modules/CCK2.jsm#L17
and renaming the file breaks it.
sync and fxaccounts is also referred to in out-of-tree code, so renaming them will also break stuff and as you mention, the shims aren't handling these renames. Given these were missed when considering out-of-tree code, how confident are we that others haven't been missed? And what do we do for those?
Assignee | ||
Comment 9•2 years ago
|
||
(In reply to Mark Hammond [:markh] [:mhammond] from comment #8)
sync and fxaccounts is also referred to in out-of-tree code
where is it?
Comment 10•2 years ago
|
||
Assignee | ||
Comment 11•2 years ago
|
||
Thank you for pointing that out.
I completely overlooked about non-*.jsm
case, except for AutoConfig-related usage.
The following references are found across 3 extensions:
resource://services-sync/bookmark_validator.js
resource://services-sync/constants.js
resource://services-sync/engines/addons.js
resource://services-sync/engines/forms.js
resource://services-sync/engines/passwords.js
resource://services-sync/main.js
resource://services-sync/record.js
resource://services-sync/util.js
resource://services-settings/remote-settings.js
I'll think about skipping the rename, and adding *.js
=> *.sys.mjs
shim.
Assignee | ||
Comment 12•2 years ago
|
||
filed bug 1773603.
Description
•