Skip to content

Commit

Permalink
Bug 1781124 - Use static pref for dom.importMaps.enabled in module lo…
Browse files Browse the repository at this point in the history
…ader. r=allstarschh

Differential Revision: https://phabricator.services.mozilla.com/D152712
  • Loading branch information
arai-a committed Jul 26, 2022
1 parent cda2011 commit 0bb3140
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/loader/ModuleLoaderBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "mozilla/dom/ScriptLoadContext.h"
#include "mozilla/CycleCollectedJSContext.h" // nsAutoMicroTask
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs_dom.h"
#include "nsContentUtils.h"
#include "nsICacheInfoChannel.h" // nsICacheInfoChannel
#include "nsNetUtil.h" // NS_NewURI
Expand Down Expand Up @@ -599,14 +600,13 @@ nsresult ModuleLoaderBase::HandleResolveFailure(

ResolveResult ModuleLoaderBase::ResolveModuleSpecifier(
LoadedScript* aScript, const nsAString& aSpecifier) {
bool importMapsEnabled = Preferences::GetBool("dom.importMaps.enabled");
// If import map is enabled, forward to the updated 'Resolve a module
// specifier' algorithm defined in Import maps spec.
//
// Once import map is enabled by default,
// ModuleLoaderBase::ResolveModuleSpecifier should be replaced by
// ImportMap::ResolveModuleSpecifier.
if (importMapsEnabled) {
if (mozilla::StaticPrefs::dom_importMaps_enabled()) {
return ImportMap::ResolveModuleSpecifier(mImportMap.get(), mLoader, aScript,
aSpecifier);
}
Expand Down

0 comments on commit 0bb3140

Please sign in to comment.