Bug 1688879 - Part 6: Acquiring import maps. r=jonco,yulia

Implement https://wicg.github.io/import-maps/#document-acquiring-import-maps

Differential Revision: https://phabricator.services.mozilla.com/D142074
This commit is contained in:
Yoshi Cheng-Hao Huang
2022-05-05 16:03:17 +00:00
parent ec955eda01
commit bf610156cd
3 changed files with 50 additions and 0 deletions

View File

@@ -113,6 +113,17 @@ nsresult ModuleLoader::StartFetch(ModuleLoadRequest* aRequest) {
nsresult rv = GetScriptLoader()->StartLoadInternal(aRequest, securityFlags);
NS_ENSURE_SUCCESS(rv, rv);
// https://wicg.github.io/import-maps/#document-acquiring-import-maps
//
// An import map is accepted if and only if it is added (i.e., its
// corresponding script element is added) before the first module load is
// started, even if the loading of the import map file doesnt finish before
// the first module load is started.
if (!aRequest->GetScriptLoadContext()->IsPreload()) {
LOG(("ScriptLoadRequest (%p): SetAcquiringImportMaps false", aRequest));
SetAcquiringImportMaps(false);
}
LOG(("ScriptLoadRequest (%p): Start fetching module", aRequest));
return NS_OK;