Closed Bug 1609269 Opened 4 years ago Closed 2 years ago

[meta] Rename all .js files that use EXPORTED_SYMBOLS to .jsm

Categories

(Core :: XPConnect, task, P5)

task

Tracking

()

RESOLVED WONTFIX

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&regexp=false&path=.js%24.

To make things sane while trying to tackle other bugs blocking Bug 1308512, we should rename those to jsm.

Priority: -- → P5
Assignee: nobody → dtownsend
Status: NEW → ASSIGNED
Assignee: dtownsend → nobody
Status: ASSIGNED → NEW
Depends on: 1765913
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED

NOTE: there are external reference into in-tree .js files

https://github.com/mozilla/application-services/search?q=services%2Fsync%2F

https://github.com/mozilla/application-services/blob/62bef6a0d49f8ab17b969e8ce482ac12c53f0987/components/tabs/src/storage.rs#L5

// From https://searchfox.org/mozilla-central/rev/ea63a0888d406fae720cf24f4727d87569a8cab5/services/sync/modules/constants.js#75

https://github.com/mozilla/application-services/blob/72b827c3e0f883163762857fd766df1aeb060725/components/support/sync15-traits/src/bridged_engine.rs#L15

/// [Desktop Firefox has an abstract implementation of a Sync
/// Engine](https://searchfox.org/mozilla-central/source/services/sync/modules/engines.js)

https://github.com/mozilla/application-services/blob/72b827c3e0f883163762857fd766df1aeb060725/components/support/sync15-traits/src/telemetry.rs#L700

/// 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

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&regexp=false

You may be interested in what I did for Thunderbird in bug 1529583 - script/commands in the commit message.

See Also: → 1529583

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 to distribution.jsm, and add distribution.js as a thin wrapper for distribution.jsm, and ESM-ify distribution.jsm to distribution.sys.mjs, leaving distribution.js as JSM file. so that import for resource:///modules/distribution.js keeps working, via the wrapper and shim.
  • Support .js in the shim, and ESM-ify distribution.js directly to distribution.sys.mjs, so that resource:///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?

Flags: needinfo?(mozilla)
Depends on: 1773169
Depends on: 1773171
Depends on: 1773172
Depends on: 1773173
Depends on: 1773174
Depends on: 1773178
Summary: Rename all .js files that use EXPORTED_SYMBOLS to .jsm → [meta] Rename all .js files that use EXPORTED_SYMBOLS to .jsm

Just ignore the distribution.js in CCK2.

  1. It's not needed anymore (it was working around an old issue).
  2. CCK2 is basically deprecated.
Flags: needinfo?(mozilla)
Depends on: 1607331
Depends on: 1773526
Attachment #9280507 - Attachment is obsolete: true

(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?

Flags: needinfo?(arai.unmht)

(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?

Flags: needinfo?(arai.unmht) → needinfo?(markh)

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.

filed bug 1773603.

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: