diff options
author | Moonchild <moonchild@palemoon.org> | 2020-08-25 07:06:43 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-08-25 07:06:43 +0000 |
commit | a21453c94f692f82a8cfcc3b6b267667e6e647f2 (patch) | |
tree | e4c6248559f4fe559cfe32df5ccf81a3bdcb47ab /dom/base/nsDocument.cpp | |
parent | 11623119c22e50d818146a8f8320a240d50a3c6e (diff) | |
download | aura-central-a21453c94f692f82a8cfcc3b6b267667e6e647f2.tar.gz |
Issue mcp-graveyard/UXP%618 - (async) Implement async attribute for inline module scripts.
This commit does several things:
- Moves the pref check from ScriptLoader to ns[I]Document so it can be called on
the document.
- Changes the atrribute freezing function to a better name that takes the
document as a parameter.
- Sets the proper async/defer attributes on HTML script elements based on
keywords and whether they are module scripts or not.
Diffstat (limited to 'dom/base/nsDocument.cpp')
-rw-r--r-- | dom/base/nsDocument.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index dc4b23f2c..76490e6b4 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -12446,3 +12446,16 @@ nsIDocument::GetSelection(ErrorResult& aRv) return nsGlobalWindow::Cast(window)->GetSelection(aRv); } + +bool +nsIDocument::ModuleScriptsEnabled() +{ + static bool sEnabledForContent = false; + static bool sCachedPref = false; + if (!sCachedPref) { + sCachedPref = true; + Preferences::AddBoolVarCache(&sEnabledForContent, "dom.moduleScripts.enabled", false); + } + + return nsContentUtils::IsChromeDoc(this) || sEnabledForContent; +}
\ No newline at end of file |