Bug 1778289 - Part 5: Update spec in RegisterImportMap. r=jonco,yulia

Differential Revision: https://phabricator.services.mozilla.com/D152872
This commit is contained in:
Yoshi Cheng-Hao Huang
2022-10-07 13:56:24 +00:00
parent 7277165281
commit d6d4b77bda
2 changed files with 15 additions and 3 deletions

View File

@@ -1297,8 +1297,19 @@ void ModuleLoaderBase::RegisterImportMap(UniquePtr<ImportMap> aImportMap) {
// Check for aImportMap is done in ScriptLoader.
MOZ_ASSERT(aImportMap);
// Step 8. Set elements node document's import map to import map parse
// results import map.
// https://whatpr.org/html/8075/webappapis.html#register-an-import-map
// The step 1(report the exception if there's an error) is done in
// ParseImportMap.
//
// Step 2. Assert: global's import map is an empty import map.
// Impl note: The default import map from the spec is an empty import map, but
// from the implementation it defaults to nullptr, so we check if the global's
// import map is null here.
//
// Also see https://whatpr.org/html/8075/webappapis.html#empty-import-map
MOZ_ASSERT(!mImportMap);
// Step 3. Set global's import map to result's import map.
mImportMap = std::move(aImportMap);
}