Closed Bug 1759881 Opened 2 years ago Closed 2 years ago

Refactor the module loader to make it more generic

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
100 Branch
Tracking Status
firefox100 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

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

The aim of this bug is to make the module loader code more generic in preparation for using it in mozJSComponentLoader. We should try and move the DOM-specific code out and pull in any remaining generic module code.

This restricts access to mDynamicImportRequests and adds the appropriate accessors.

This splits the interface of ModuleLoaderBase into sections and restricts acess
for internal methods.

Depends on D141248

This can work it out if it needs it by calling GetGlobalForRequest.

Depends on D141249

I'm not sure why this was there because this can't run script.

Depends on D141250

I don't know why these are there; there's nothing in the spec to say these
operations perform a microtask checkpoint (unlike executing a module).

Depends on D141251

This layer doesn't add much above calling into the JS engine and it's DOM
specific so let's remove it.

Depends on D141252

Attachment #9268098 - Attachment description: Bug 1759881 - Part 5: Remove microtask checkpoints from a couple of places r?yulia → Bug 1759881 - Part 5: Remove microtask checkpoints from the module loader in couple of places r?smaug
Keywords: leave-open
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a8e0362d4e6d
Part 1: Make list of dynamic import requests private r=yulia
https://hg.mozilla.org/integration/autoland/rev/a3c688ed0dbf
Part 2: Restrict access to internal methods of module loader where possible r=yulia
https://hg.mozilla.org/integration/autoland/rev/fcbec93f7598
Part 3: Don't pass a global to FillCompileOptionsForRequest r=yulia
https://hg.mozilla.org/integration/autoland/rev/e9a2cd65cf4a
Part 4: Remove use of AutoEntryScript when parsing module source r=smaug
https://hg.mozilla.org/integration/autoland/rev/4036fd69dfb6
Part 5: Remove microtask checkpoints from the module loader in couple of places r=smaug
https://hg.mozilla.org/integration/autoland/rev/27af2350c258
Part 6: Remove use of nsJSUtils layer for module instantiation and evaluation r=smaug

This adds a virtual method to nsIGlobalObject and implements it for
nsGlobalWindowInner and SandboxPrivate. This means we don't have to put the
logic for dealing with all the different kinds of globals in once place.

This adds a new virtual to the module loader base, along the same lines as the
one to create a load request for a static import. This makes the
HostImportModuleDynamically hook generic.

Depends on D141733

Now we can move the JS engine integration hooks into the generic module loader.

There is still some code there to deal with web extension globals. This will be
removed in a later patch.

Depends on D141734

StartModuleLoadImpl moves to the base class and uses to new virtual methods
CanStartLoad and StartFetch which are implemented by the derived class.

Depends on D141735

Depends on: 1761432
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7a711fde3cc8
Part 7: Add a virtual method to get the module loader to use for the current global r=yulia,smaug
https://hg.mozilla.org/integration/autoland/rev/9f2bd46d25f0
Part 8: Add a virtual method to create a module load request for a dynamic import r=yulia
https://hg.mozilla.org/integration/autoland/rev/59c0f85d61e1
Part 9: Move module loading hooks into the generic module loader r=yulia
Keywords: leave-open
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e91490b311a1
Part 10: Move the generic parts of the StartLoad method to the module loader base r=yulia
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: