Investigate static list for JSM-to-ESM redirect
Categories
(Core :: XPConnect, task, P3)
Tracking
()
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(1 file)
(deleted),
text/plain
|
Details |
The shim introduced by bug 1766761 redirects a load for .jsm
to .sys.mjs
if the .jsm
file is not found.
This requires extra load, and also suppressing the error handling in network code (bug 1777641).
Given most of the migrations are going to be handled by ./mach esmify
command (bug 1776870), we could have a static list of migrated JSMs.
Assignee | ||
Comment 1•2 years ago
|
||
In ./mach esmify
command, what the command receives is the path to the file, and what needs to be in the static list is the URLs.
The command uses a map from URI to file path, that can be used to reverse-map from path to URI, and add the corresponding URI to the static list when migrating JSM files.
The problems are the following:
- the map is incomplete
- the list contains 1271 files, and 133 files aren't covered. either the URL is unknown, or not used with URI (testcase etc).
- the map can be outdated
- the map is hand-generated
Assignee | ||
Comment 2•2 years ago
|
||
This patch implements a static list for known-to-be-ESMified files, and use it for redirecting.
(still uses retry-after-failure way for fallback)
It uses a plain text file for listing known URLs.
not yet integrated with ./mach esmify
to update it automatically.
Assignee | ||
Comment 3•2 years ago
|
||
the other option is to generate the URL from EXTRA_JS_MODULES
in moz.build
and jar.mn
files in the script, that is also useful in other purposes as well (linting, searchfox link, etc),
but I think it's overkill for this purpose, because of the complexity.
Assignee | ||
Comment 4•2 years ago
|
||
Now checking if I can generate the list of URIs from moz.build
and jar.mn
.
the issue here is that the set of URIs depends on configuration and also the prefix in resource
URI (either gre
or not) seems to depend on the application, and it's hard to check which URI is correct one.
Assignee | ||
Comment 5•2 years ago
|
||
Given bug 1777641 lands, this is no longer requirement.
We can revisit this if any performance issue arises.
Assignee | ||
Comment 6•2 years ago
|
||
There is an issue with alias with chrome registration for jar file:
toolkit.jar:
% resource autofill %res/autofill/
toolkit.jar:
...
% resource gre-resources %res/
The following URLs return the same file, and the latter is actually used, but there's no information which is expected.
resource://gre-resources/autofill/phonenumberutils/PhoneNumber.jsm
resource://autofill/phonenumberutils/PhoneNumber.jsm
So, having a list of URLs is almost impossible without extra data source.
Assignee | ||
Comment 7•2 years ago
|
||
prototype patch in bug 1776870 has a code that maps URI to file, that works for all JSMs.
https://bug1776870.bmoattachments.org/attachment.cgi?id=9284165
but it's only "URI => file path" direction.
"file path => URI" cannot be automated. we could choose shortest one, but there's no guarantee that shortest one is always used.
Assignee | ||
Comment 8•2 years ago
|
||
given above, closing for now.
Description
•