Closed Bug 1968870 Opened 1 year ago Closed 11 months ago

Pass referrer to HostLoadImportedModule in dynamic import

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: allstars.chh, Assigned: allstars.chh)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

This is a follow-up from https://phabricator.services.mozilla.com/D214569
According to the spec, https://tc39.es/ecma262/#sec-evaluate-import-call
We need to get the referrer information and pass it to HostLoadImportedModule.

For dynamic import we have the possibility that the referrer is a classic script. Currently the referrer is passed as a module object. There are a couple of ways we could make this work (pass either using a Value or always pass a script). Currently the module loader doesn't use referrer much, possibly because it's not always available.

The aim of all of this should be to have a single HostLoadImportedModule function in the engine that is used in all places. Currently we call the module load hook twice outside of this function.

Previously we passed the module object for modules and nullptr for other cases.
This patch makes it so we pass the script for both module and classic script
referrers, and nullptr for the realm case.

This already takes the referrer script. We can use the referrer script to keep
its private value alive in DynamicImportContextObject which is much simpler.

QA Whiteboard: [qa-triage-done-c144/b143]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: