mirror of
https://github.com/ManchildProductions/UXP-Fixed.git
synced 2026-07-21 03:48:43 +00:00
Issue #618 - Don't preload nomodule scripts when modules are enabled
Ref: BZ 1382020
This commit is contained in:
@@ -1161,6 +1161,7 @@ public final class AttributeName
|
||||
public static final AttributeName LQUOTE = new AttributeName(ALL_NO_NS, SAME_LOCAL("lquote"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
|
||||
public static final AttributeName PANOSE_1 = new AttributeName(ALL_NO_NS, SAME_LOCAL("panose-1"), 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 ONLOAD = new AttributeName(ALL_NO_NS, SAME_LOCAL("onload"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
|
||||
public static final AttributeName ONBOUNCE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbounce"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
|
||||
public static final AttributeName ONCONTROLSELECT = new AttributeName(ALL_NO_NS, SAME_LOCAL("oncontrolselect"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
|
||||
@@ -1464,6 +1465,7 @@ public final class AttributeName
|
||||
XLINK_SHOW,
|
||||
COLOR_RENDERING,
|
||||
IDEOGRAPHIC,
|
||||
NOMODULE,
|
||||
ONMOUSEWHEEL,
|
||||
ONCONTEXTMENU,
|
||||
ONMOUSEMOVE,
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -189,15 +189,18 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace,
|
||||
aAttributes->contains(nsHtml5AttributeName::ATTR_ASYNC);
|
||||
bool defer =
|
||||
aAttributes->contains(nsHtml5AttributeName::ATTR_DEFER);
|
||||
bool noModule =
|
||||
aAttributes->contains(nsHtml5AttributeName::ATTR_NOMODULE);
|
||||
mSpeculativeLoadQueue.AppendElement()->InitScript(
|
||||
url,
|
||||
charset,
|
||||
type,
|
||||
crossOrigin,
|
||||
integrity,
|
||||
mode == nsHtml5TreeBuilder::IN_HEAD,
|
||||
mode == nsHtml5TreeBuilder::IN_HEAD,
|
||||
async,
|
||||
defer);
|
||||
defer,
|
||||
noModule);
|
||||
mCurrentHtmlScriptIsAsyncOrDefer = async || defer;
|
||||
}
|
||||
} else if (nsHtml5Atoms::link == aName) {
|
||||
@@ -303,7 +306,8 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace,
|
||||
integrity,
|
||||
mode == nsHtml5TreeBuilder::IN_HEAD,
|
||||
false /* async */,
|
||||
false /* defer */);
|
||||
false /* defer */,
|
||||
false /* noModule */);
|
||||
}
|
||||
} else if (nsHtml5Atoms::style == aName) {
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user