Skip to content

Commit

Permalink
Bug 1688879 - Part 1: Add Pref for import maps. r=jonco,yulia
Browse files Browse the repository at this point in the history
Add a pref "dom.importMaps.enabled", with default false.

Differential Revision: https://phabricator.services.mozilla.com/D142069
  • Loading branch information
allstarschh committed May 4, 2022
1 parent 37af251 commit de9fd2e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dom/base/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17539,6 +17539,11 @@ bool Document::ModuleScriptsEnabled() {
StaticPrefs::dom_moduleScripts_enabled();
}

bool Document::ImportMapsEnabled() {
return nsContentUtils::IsChromeDoc(this) ||
StaticPrefs::dom_importMaps_enabled();
}

void Document::ReportShadowDOMUsage() {
nsPIDOMWindowInner* inner = GetInnerWindow();
if (NS_WARN_IF(!inner)) {
Expand Down
2 changes: 2 additions & 0 deletions dom/base/Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -3986,6 +3986,8 @@ class Document : public nsINode,

bool ModuleScriptsEnabled();

bool ImportMapsEnabled();

/**
* Find the (non-anonymous) content in this document for aFrame. It will
* be aFrame's content node if that content is in this document and not
Expand Down
6 changes: 6 additions & 0 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2797,6 +2797,12 @@
value: true
mirror: always

# Is support for import maps (<script type="importmap">) enabled for content?
- name: dom.importMaps.enabled
type: bool
value: false
mirror: always

# Whether we disable triggering mutation events for changes to style
# attribute via CSSOM.
# NOTE: This preference is used in unit tests. If it is removed or its default
Expand Down

0 comments on commit de9fd2e

Please sign in to comment.