summaryrefslogtreecommitdiffstats
path: root/parser
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-08-30 22:10:17 -0400
committerMoonchild <moonchild@palemoon.org>2020-09-05 18:45:45 +0000
commit9c515323ff6cc0dc42b9ee64397f297b7566d0a4 (patch)
treed810127ed7385efe0defd15b9da1c770663fa541 /parser
parentc2b91aaf8cbb8f263bb335d4e6b8c37de72cfc14 (diff)
downloadUXP-9c515323ff6cc0dc42b9ee64397f297b7566d0a4.tar
UXP-9c515323ff6cc0dc42b9ee64397f297b7566d0a4.tar.gz
UXP-9c515323ff6cc0dc42b9ee64397f297b7566d0a4.tar.lz
UXP-9c515323ff6cc0dc42b9ee64397f297b7566d0a4.tar.xz
UXP-9c515323ff6cc0dc42b9ee64397f297b7566d0a4.zip
Issue #618 - Don't preload nomodule scripts when modules are enabled (uplift)
Diffstat (limited to 'parser')
-rw-r--r--parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java2
-rw-r--r--parser/html/nsHtml5SpeculativeLoad.cpp16
-rw-r--r--parser/html/nsHtml5SpeculativeLoad.h17
-rw-r--r--parser/html/nsHtml5TreeBuilderCppSupplement.h8
-rw-r--r--parser/html/nsHtml5TreeOpExecutor.cpp6
-rw-r--r--parser/html/nsHtml5TreeOpExecutor.h3
6 files changed, 40 insertions, 12 deletions
diff --git a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java
index 48d82036c..21364617a 100644
--- a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java
+++ b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java
@@ -1072,6 +1072,7 @@ public final class AttributeName
public static final AttributeName ONFOCUSOUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onfocusout"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
public static final AttributeName ONMOUSEOUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmouseout"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
public static final AttributeName NUMOCTAVES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("numoctaves", "numOctaves"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName NOMODULE = new AttributeName(ALL_NO_NS, SAME_LOCAL("nomodule"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
public static final AttributeName MARKER_MID = new AttributeName(ALL_NO_NS, SAME_LOCAL("marker-mid"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
public static final AttributeName MARKER_END = new AttributeName(ALL_NO_NS, SAME_LOCAL("marker-end"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
public static final AttributeName TEXTLENGTH = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("textlength", "textLength"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
@@ -1737,6 +1738,7 @@ public final class AttributeName
ONMOUSELEAVE,
ONFORMCHANGE,
ONCELLCHANGE,
+ NOMODULE,
ONMOUSEWHEEL,
ONMOUSEENTER,
ONAFTERPRINT,
diff --git a/parser/html/nsHtml5SpeculativeLoad.cpp b/parser/html/nsHtml5SpeculativeLoad.cpp
index 7bae0699f..35c11b739 100644
--- a/parser/html/nsHtml5SpeculativeLoad.cpp
+++ b/parser/html/nsHtml5SpeculativeLoad.cpp
@@ -52,17 +52,27 @@ nsHtml5SpeculativeLoad::Perform(nsHtml5TreeOpExecutor* aExecutor)
case eSpeculativeLoadScript:
aExecutor->PreloadScript(mUrl, mCharset, mTypeOrCharsetSourceOrDocumentMode,
mCrossOrigin, mIntegrity, false,
- mIsAsync, mIsDefer);
+ mIsAsync, mIsDefer, false);
break;
case eSpeculativeLoadScriptFromHead:
aExecutor->PreloadScript(mUrl, mCharset, mTypeOrCharsetSourceOrDocumentMode,
mCrossOrigin, mIntegrity, true,
- mIsAsync, mIsDefer);
+ mIsAsync, mIsDefer, false);
+ break;
+ case eSpeculativeLoadNoModuleScript:
+ aExecutor->PreloadScript(mUrl, mCharset, mTypeOrCharsetSourceOrDocumentMode,
+ mCrossOrigin, mIntegrity, false,
+ mIsAsync, mIsDefer, true);
+ break;
+ case eSpeculativeLoadNoModuleScriptFromHead:
+ aExecutor->PreloadScript(mUrl, mCharset, mTypeOrCharsetSourceOrDocumentMode,
+ mCrossOrigin, mIntegrity, true,
+ mIsAsync, mIsDefer, true);
break;
case eSpeculativeLoadStyle:
aExecutor->PreloadStyle(mUrl, mCharset, mCrossOrigin, mIntegrity);
break;
- case eSpeculativeLoadManifest:
+ case eSpeculativeLoadManifest:
aExecutor->ProcessOfflineManifest(mUrl);
break;
case eSpeculativeLoadSetDocumentCharset: {
diff --git a/parser/html/nsHtml5SpeculativeLoad.h b/parser/html/nsHtml5SpeculativeLoad.h
index fcc84de4f..1f4a61741 100644
--- a/parser/html/nsHtml5SpeculativeLoad.h
+++ b/parser/html/nsHtml5SpeculativeLoad.h
@@ -10,7 +10,8 @@
class nsHtml5TreeOpExecutor;
-enum eHtml5SpeculativeLoad {
+enum eHtml5SpeculativeLoad
+{
#ifdef DEBUG
eSpeculativeLoadUninitialized,
#endif
@@ -23,6 +24,8 @@ enum eHtml5SpeculativeLoad {
eSpeculativeLoadPictureSource,
eSpeculativeLoadScript,
eSpeculativeLoadScriptFromHead,
+ eSpeculativeLoadNoModuleScript,
+ eSpeculativeLoadNoModuleScriptFromHead,
eSpeculativeLoadStyle,
eSpeculativeLoadManifest,
eSpeculativeLoadSetDocumentCharset,
@@ -130,12 +133,18 @@ class nsHtml5SpeculativeLoad {
nsHtml5String aIntegrity,
bool aParserInHead,
bool aAsync,
- bool aDefer)
+ bool aDefer,
+ bool aNoModule)
{
NS_PRECONDITION(mOpCode == eSpeculativeLoadUninitialized,
"Trying to reinitialize a speculative load!");
- mOpCode = aParserInHead ?
- eSpeculativeLoadScriptFromHead : eSpeculativeLoadScript;
+ if (aNoModule) {
+ mOpCode = aParserInHead ? eSpeculativeLoadNoModuleScriptFromHead
+ : eSpeculativeLoadNoModuleScript;
+ } else {
+ mOpCode = aParserInHead ? eSpeculativeLoadScriptFromHead
+ : eSpeculativeLoadScript;
+ }
aUrl.ToString(mUrl);
aCharset.ToString(mCharset);
aType.ToString(mTypeOrCharsetSourceOrDocumentMode);
diff --git a/parser/html/nsHtml5TreeBuilderCppSupplement.h b/parser/html/nsHtml5TreeBuilderCppSupplement.h
index 9709396c7..f0326a20a 100644
--- a/parser/html/nsHtml5TreeBuilderCppSupplement.h
+++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h
@@ -171,6 +171,8 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName,
aAttributes->contains(nsHtml5AttributeName::ATTR_ASYNC);
bool defer =
aAttributes->contains(nsHtml5AttributeName::ATTR_DEFER);
+ bool noModule =
+ aAttributes->contains(nsHtml5AttributeName::ATTR_NOMODULE);
mSpeculativeLoadQueue.AppendElement()->InitScript(
url,
charset,
@@ -179,7 +181,8 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName,
integrity,
mode == NS_HTML5TREE_BUILDER_IN_HEAD,
async,
- defer);
+ defer,
+ noModule);
mCurrentHtmlScriptIsAsyncOrDefer = async || defer;
}
} else if (nsHtml5Atoms::link == aName) {
@@ -285,7 +288,8 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName,
integrity,
mode == NS_HTML5TREE_BUILDER_IN_HEAD,
false /* async */,
- false /* defer */);
+ false /* defer */,
+ false /* noModule */);
}
} else if (nsHtml5Atoms::style == aName) {
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp
index 9be7f3b0d..cd5c68913 100644
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
@@ -923,14 +923,16 @@ nsHtml5TreeOpExecutor::PreloadScript(const nsAString& aURL,
const nsAString& aIntegrity,
bool aScriptFromHead,
bool aAsync,
- bool aDefer)
+ bool aDefer,
+ bool aNoModule)
{
nsCOMPtr<nsIURI> uri = ConvertIfNotPreloadedYet(aURL);
if (!uri) {
return;
}
mDocument->ScriptLoader()->PreloadURI(uri, aCharset, aType, aCrossOrigin,
- aIntegrity, aScriptFromHead, aAsync, aDefer,
+ aIntegrity, aScriptFromHead, aAsync,
+ aDefer, aNoModule,
mSpeculationReferrerPolicy);
}
diff --git a/parser/html/nsHtml5TreeOpExecutor.h b/parser/html/nsHtml5TreeOpExecutor.h
index 64a5daa96..878f359c5 100644
--- a/parser/html/nsHtml5TreeOpExecutor.h
+++ b/parser/html/nsHtml5TreeOpExecutor.h
@@ -251,7 +251,8 @@ class nsHtml5TreeOpExecutor final : public nsHtml5DocumentBuilder,
const nsAString& aIntegrity,
bool aScriptFromHead,
bool aAsync,
- bool aDefer);
+ bool aDefer,
+ bool aNoModule);
void PreloadStyle(const nsAString& aURL, const nsAString& aCharset,
const nsAString& aCrossOrigin,