Refactor about:addons into smaller per-component ES modules
Categories
(Toolkit :: Add-ons Manager, task, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox152 | --- | fixed |
People
(Reporter: rpl, Assigned: rpl)
References
Details
(Whiteboard: [addons-jira])
Attachments
(16 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
Currently aboutaddons.js is a huge script where most of the about:addons specfic custom elements are being defined along with the implementation logic wiring them together, and all the their related HTML templates are all part of the aboutaddons.html.
This bugzilla issue is tracking breaking down aboutaddons.js and aboutaddons.html into smaller per-component ES modules, aiming to make it easier to swap UI components implementation, reducing the implicit dependencies reached as globals and make inter-dependencies more immediately visible in the ES module itself.
Each ES module will be meant to include:
- the custom element definition (with as minimal changes as possible compared with the same component as currently defined in aboutaddons.js)
- the HTML template(s) related to the custom element defined in that same ES modules
- static and lazy imports for other sys.mjs and .mjs ES modules the custom element definition depends on
- consts that are only used in the custom element definition
This is intended to be an internal refactoring with no changes in behavior or look and feel, and so it is also meant to possibly not requiring any changes on the test coverage side (or to keep the impact on the test coverage as small and minimal as possible).
| Assignee | ||
Updated•5 months ago
|
| Assignee | ||
Comment 1•5 months ago
|
||
Extract ColorwayRemovalNotice, ForcedColorsNotice, SmartWindowThemesNotice,
and TaarMessageBar from aboutaddons.js into dedicated ES modules under
components/, and move their HTML templates from aboutaddons.html into each
module using the markup/fragment lazy-initialization pattern.
| Assignee | ||
Updated•5 months ago
|
| Assignee | ||
Comment 2•5 months ago
|
||
Extract SearchAddons, AddonUpdatesMessage, ProxyContextMenu, and
UpdateReleaseNotes from aboutaddons.js into dedicated ES modules under
components/.
These webcomponents do not have any HTML templates to be moved out of
aboutaddons.html and so their classes are being moved as is without any
actual change (besides search-addons, where AddonRepository is being
accessed through a lazy module getter defined in the ES module itself).
Depends on D294406
| Assignee | ||
Comment 3•5 months ago
|
||
Extract MessageBarStackElement and GlobalWarnings from aboutaddons.js into
dedicated ES modules under components/.
GlobalWarnings imports MessageBarStackElement from message-bar-stack.mjs.
| Assignee | ||
Comment 4•5 months ago
|
||
Extract CategoryButton, DiscoverButton, and SidebarFooter from
aboutaddons.js into dedicated ES modules under components/.
DiscoverButton imports CategoryButton from category-button.mjs.
| Assignee | ||
Comment 5•5 months ago
|
||
Extract CategoriesBox from aboutaddons.js into categories-box.mjs under
components/. The component extends the dynamically-resolved button-group
custom element (as it was already being done in aboutaddons.js before this
refactoring).
Depends on D294626
| Assignee | ||
Comment 6•5 months ago
|
||
Extract RecommendedFooter, RecommendedThemesFooter, RecommendedSection,
RecommendedExtensionsSection, RecommendedThemesSection, and DiscoveryPane
from aboutaddons.js into dedicated ES modules under components/.
The section subclasses import RecommendedSection from recommended-section.mjs
and each defines its own static markup/fragment for the template.
Depends on D294640
| Assignee | ||
Comment 7•5 months ago
|
||
Extract AddonPermissionsList and AddonSitePermissionsList from aboutaddons.js
into dedicated ES modules under components/.
Depends on D294712
Updated•5 months ago
|
| Assignee | ||
Comment 8•5 months ago
|
||
Extract AddonOptions and PluginOptions from aboutaddons.js into dedicated ES
modules under components/. PluginOptions imports AddonOptions from
addon-options.mjs.
Depends on D295032
| Assignee | ||
Comment 9•5 months ago
|
||
Extract InlineOptionsBrowser from aboutaddons.js into inline-options-browser.mjs
under components/.
Depends on D295039
| Assignee | ||
Comment 10•5 months ago
|
||
Extract AddonPageHeader and AddonPageOptions from aboutaddons.js into
dedicated ES modules under components/.
Depends on D295046
| Assignee | ||
Comment 11•5 months ago
|
||
Extract AddonDetails from aboutaddons.js into addon-details.mjs under
components/.
Depends on D295056
| Assignee | ||
Comment 12•5 months ago
|
||
Extract AddonCard from aboutaddons.js into addon-card.mjs under components/.
Depends on D295064
| Assignee | ||
Comment 13•5 months ago
|
||
Extract RecommendedAddonCard from aboutaddons.js into recommended-addon-card.mjs
under components/. Import AddonCard from addon-card.mjs and use
AddonCard.fragment.firstElementChild instead of importTemplate("card").
Move the addon-name-container-in-disco-card and addon-description-in-disco-card
templates into markup getters for two new separated RecommendedAddonName and
RecommendedAddonDescription custom elements.
RecommendedAddonCard setDiscoAAjddon method uses the AddonCard.fragment as its base
template and replaces the div.addon-name-container and div.addon-description elements
from the addon-card template markup with the specialized RecommendedAddonName and
RecommendedAddonDescription custom elements.
Depends on D295073
| Assignee | ||
Comment 14•5 months ago
|
||
Extract AddonList and RecommendedAddonList from aboutaddons.js into
dedicated ES modules under components/.
Depends on D295263
| Assignee | ||
Comment 15•5 months ago
|
||
Replace drag-drop-addon-installer.js and shortcuts.js with dedicated ES
modules under components/. The block-scoped helpers in shortcuts.js become
module-level private helpers. The six shortcut HTML templates move from
aboutaddons.html into addon-shortcuts.mjs using DOMParser-based lazy
initialization. The old unused .js files are removed along with their
jar.mn entries.
Depends on D295266
| Assignee | ||
Comment 16•5 months ago
|
||
Replace aboutaddons.js, aboutaddonsCommon.js, view-controller.js, and
abuse-reports.js with ES modules.
This patch is also moving into aboutaddons-utils.mjs all shared helpers and
constants from both aboutaddons.js and aboutaddonsCommon.js.
The ES modules view-controller.mjs, abuse-reports.mjs are providing the
same set of helpers they are already providing, but instead of setting
them as window globals they are now ES module export.
The ES module aboutaddons.mjs is the subset of the original aboutaddons.js
script and it is now providing only the main entry point, in particular:
view definitions, initialize, and window globals accessed externally (either
by other Gecko internals or by the existing tests).
All webcomponents ES modules are updated to use explicit imports instead of
window globals.
Depends on D295275
Comment 17•5 months ago
|
||
Comment 18•5 months ago
|
||
| Assignee | ||
Comment 20•5 months ago
|
||
(In reply to agoloman from comment #19)
Backed out for causing bc failures.
The failure hit was originated by browser_all_files_referenced.js, I've updated the patch part 6 to add explicit script tags for the two ES modules that have triggered that failure (recommended-footer.mjs and recommended-themes-footer.mjs) and confirmed locally that the browser_all_files_referenced.js failure was not hit anymore as expected.
The last push to try looks good too:
- try auto: https://treeherder.mozilla.org/jobs?repo=try&revision=208eeafda5cbd9ad6b8db6c611f88ceaae1c8b42
- try webextensions preset: https://treeherder.mozilla.org/jobs?repo=try&revision=8028042cd074e4f4598404bf860acb731283bbca&selectedTaskRun=W2AE5s8oTV6nEu7Mk1Es5w.0
I'll be pushing the updated (and rebased) patch stack to autoland in a minute.
Comment 21•5 months ago
|
||
Comment 22•5 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/6f8c8f717a23
https://hg.mozilla.org/mozilla-central/rev/7418e7246f03
https://hg.mozilla.org/mozilla-central/rev/fe5c848e1d9b
https://hg.mozilla.org/mozilla-central/rev/c4fe6e05dc82
https://hg.mozilla.org/mozilla-central/rev/e5be00890972
https://hg.mozilla.org/mozilla-central/rev/f39a75924693
https://hg.mozilla.org/mozilla-central/rev/75aa96011230
https://hg.mozilla.org/mozilla-central/rev/b709d6041841
https://hg.mozilla.org/mozilla-central/rev/464421e077d6
https://hg.mozilla.org/mozilla-central/rev/bbb991f5f6b2
https://hg.mozilla.org/mozilla-central/rev/0247bd762985
https://hg.mozilla.org/mozilla-central/rev/466b159a48cf
https://hg.mozilla.org/mozilla-central/rev/b0237fb2ea4c
https://hg.mozilla.org/mozilla-central/rev/ae2f1561670a
https://hg.mozilla.org/mozilla-central/rev/360238fe69e7
https://hg.mozilla.org/mozilla-central/rev/0008c856dbc8
Updated•5 months ago
|
Updated•4 months ago
|
Description
•