summaryrefslogtreecommitdiff
path: root/dom/script
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-08-26 11:19:42 -0400
committerGaming4JC <g4jc@hyperbola.info>2020-08-26 11:19:42 -0400
commit38d13e2779f9bfbf8620ead68a9bf0ffbed5762a (patch)
treec5aa35810edee4cd678441df73ff8fbfd4ed3e5f /dom/script
parentb78f53ffb09a6aae6dbdc069c7cdd42d11b5eed2 (diff)
downloaduxp-38d13e2779f9bfbf8620ead68a9bf0ffbed5762a.tar.gz
Issue #618 - Don't preload nomodule scripts when modules are enabled
Ref: BZ 1382020
Diffstat (limited to 'dom/script')
-rw-r--r--dom/script/ScriptLoader.cpp17
-rw-r--r--dom/script/ScriptLoader.h4
2 files changed, 16 insertions, 5 deletions
diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp
index 989301b919..0052c72fe4 100644
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -2576,13 +2576,15 @@ ScriptLoader::ParsingComplete(bool aTerminated)
}
void
-ScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset,
+ScriptLoader::PreloadURI(nsIURI *aURI,
+ const nsAString &aCharset,
const nsAString &aType,
const nsAString &aCrossOrigin,
const nsAString& aIntegrity,
bool aScriptFromHead,
bool aAsync,
bool aDefer,
+ bool aNoModule,
const mozilla::net::ReferrerPolicy aReferrerPolicy)
{
NS_ENSURE_TRUE_VOID(mDocument);
@@ -2591,9 +2593,16 @@ ScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset,
return;
}
- // TODO: Preload module scripts.
- if (mDocument->ModuleScriptsEnabled() && aType.LowerCaseEqualsASCII("module")) {
- return;
+ if (mDocument->ModuleScriptsEnabled()) {
+ // Don't load nomodule scripts.
+ if (aNoModule) {
+ return;
+ }
+
+ // TODO: Preload module scripts.
+ if (aType.LowerCaseEqualsASCII("module")) {
+ return;
+ }
}
SRIMetadata sriMetadata;
diff --git a/dom/script/ScriptLoader.h b/dom/script/ScriptLoader.h
index ed1e6acbc4..20e76970f4 100644
--- a/dom/script/ScriptLoader.h
+++ b/dom/script/ScriptLoader.h
@@ -479,13 +479,15 @@ public:
* @param aIntegrity The expect hash url, if avail, of the request
* @param aScriptFromHead Whether or not the script was a child of head
*/
- virtual void PreloadURI(nsIURI *aURI, const nsAString &aCharset,
+ virtual void PreloadURI(nsIURI *aURI,
+ const nsAString &aCharset,
const nsAString &aType,
const nsAString &aCrossOrigin,
const nsAString& aIntegrity,
bool aScriptFromHead,
bool aAsync,
bool aDefer,
+ bool aNoModule,
const mozilla::net::ReferrerPolicy aReferrerPolicy);
/**