diff options
author | Moonchild <moonchild@palemoon.org> | 2020-08-31 05:54:39 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-08-31 05:54:39 +0000 |
commit | a6f632714fcb1be3dd00b0fc76fbf6bfc693155b (patch) | |
tree | b04c82f9af4a0d288a6d4350d774ad8fe6dac903 /parser/html | |
parent | 2ed0607c747b21cadaf7401d4ba706097578e74d (diff) | |
parent | b28effe2ea93e43e362f7ce263d23b55adcb6da7 (diff) | |
download | UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar.gz UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar.lz UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar.xz UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.zip |
Merge branch 'redwood' into releaseRELBASE_20200831
Diffstat (limited to 'parser/html')
-rw-r--r-- | parser/html/nsHtml5SpeculativeLoad.cpp | 11 | ||||
-rw-r--r-- | parser/html/nsHtml5SpeculativeLoad.h | 13 | ||||
-rw-r--r-- | parser/html/nsHtml5TreeBuilderCppSupplement.h | 16 | ||||
-rw-r--r-- | parser/html/nsHtml5TreeOpExecutor.cpp | 6 | ||||
-rw-r--r-- | parser/html/nsHtml5TreeOpExecutor.h | 4 | ||||
-rw-r--r-- | parser/html/nsHtml5TreeOperation.cpp | 2 |
6 files changed, 39 insertions, 13 deletions
diff --git a/parser/html/nsHtml5SpeculativeLoad.cpp b/parser/html/nsHtml5SpeculativeLoad.cpp index 8ffc4d063..7bae0699f 100644 --- a/parser/html/nsHtml5SpeculativeLoad.cpp +++ b/parser/html/nsHtml5SpeculativeLoad.cpp @@ -6,9 +6,12 @@ #include "nsHtml5TreeOpExecutor.h" nsHtml5SpeculativeLoad::nsHtml5SpeculativeLoad() + : #ifdef DEBUG - : mOpCode(eSpeculativeLoadUninitialized) + mOpCode(eSpeculativeLoadUninitialized), #endif + mIsAsync(false), + mIsDefer(false) { MOZ_COUNT_CTOR(nsHtml5SpeculativeLoad); } @@ -48,11 +51,13 @@ nsHtml5SpeculativeLoad::Perform(nsHtml5TreeOpExecutor* aExecutor) break; case eSpeculativeLoadScript: aExecutor->PreloadScript(mUrl, mCharset, mTypeOrCharsetSourceOrDocumentMode, - mCrossOrigin, mIntegrity, false); + mCrossOrigin, mIntegrity, false, + mIsAsync, mIsDefer); break; case eSpeculativeLoadScriptFromHead: aExecutor->PreloadScript(mUrl, mCharset, mTypeOrCharsetSourceOrDocumentMode, - mCrossOrigin, mIntegrity, true); + mCrossOrigin, mIntegrity, true, + mIsAsync, mIsDefer); break; case eSpeculativeLoadStyle: aExecutor->PreloadStyle(mUrl, mCharset, mCrossOrigin, mIntegrity); diff --git a/parser/html/nsHtml5SpeculativeLoad.h b/parser/html/nsHtml5SpeculativeLoad.h index 6f1365bcf..fcc84de4f 100644 --- a/parser/html/nsHtml5SpeculativeLoad.h +++ b/parser/html/nsHtml5SpeculativeLoad.h @@ -128,7 +128,9 @@ class nsHtml5SpeculativeLoad { nsHtml5String aType, nsHtml5String aCrossOrigin, nsHtml5String aIntegrity, - bool aParserInHead) + bool aParserInHead, + bool aAsync, + bool aDefer) { NS_PRECONDITION(mOpCode == eSpeculativeLoadUninitialized, "Trying to reinitialize a speculative load!"); @@ -139,6 +141,8 @@ class nsHtml5SpeculativeLoad { aType.ToString(mTypeOrCharsetSourceOrDocumentMode); aCrossOrigin.ToString(mCrossOrigin); aIntegrity.ToString(mIntegrity); + mIsAsync = aAsync; + mIsDefer = aDefer; } inline void InitStyle(nsHtml5String aUrl, @@ -221,6 +225,13 @@ class nsHtml5SpeculativeLoad { private: eHtml5SpeculativeLoad mOpCode; + + /** + * Whether the refering element has async and/or defer attributes. + */ + bool mIsAsync; + bool mIsDefer; + nsString mUrl; nsString mReferrerPolicy; nsString mMetaCSP; diff --git a/parser/html/nsHtml5TreeBuilderCppSupplement.h b/parser/html/nsHtml5TreeBuilderCppSupplement.h index aacc5a3e0..9709396c7 100644 --- a/parser/html/nsHtml5TreeBuilderCppSupplement.h +++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h @@ -167,16 +167,20 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName, aAttributes->getValue(nsHtml5AttributeName::ATTR_CROSSORIGIN); nsHtml5String integrity = aAttributes->getValue(nsHtml5AttributeName::ATTR_INTEGRITY); + bool async = + aAttributes->contains(nsHtml5AttributeName::ATTR_ASYNC); + bool defer = + aAttributes->contains(nsHtml5AttributeName::ATTR_DEFER); mSpeculativeLoadQueue.AppendElement()->InitScript( url, charset, type, crossOrigin, integrity, - mode == NS_HTML5TREE_BUILDER_IN_HEAD); - mCurrentHtmlScriptIsAsyncOrDefer = - aAttributes->contains(nsHtml5AttributeName::ATTR_ASYNC) || - aAttributes->contains(nsHtml5AttributeName::ATTR_DEFER); + mode == NS_HTML5TREE_BUILDER_IN_HEAD, + async, + defer); + mCurrentHtmlScriptIsAsyncOrDefer = async || defer; } } else if (nsHtml5Atoms::link == aName) { nsHtml5String rel = @@ -279,7 +283,9 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName, type, crossOrigin, integrity, - mode == NS_HTML5TREE_BUILDER_IN_HEAD); + mode == NS_HTML5TREE_BUILDER_IN_HEAD, + false /* async */, + false /* defer */); } } else if (nsHtml5Atoms::style == aName) { nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement(); diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp index 3ed634d0c..9be7f3b0d 100644 --- a/parser/html/nsHtml5TreeOpExecutor.cpp +++ b/parser/html/nsHtml5TreeOpExecutor.cpp @@ -921,14 +921,16 @@ nsHtml5TreeOpExecutor::PreloadScript(const nsAString& aURL, const nsAString& aType, const nsAString& aCrossOrigin, const nsAString& aIntegrity, - bool aScriptFromHead) + bool aScriptFromHead, + bool aAsync, + bool aDefer) { nsCOMPtr<nsIURI> uri = ConvertIfNotPreloadedYet(aURL); if (!uri) { return; } mDocument->ScriptLoader()->PreloadURI(uri, aCharset, aType, aCrossOrigin, - aIntegrity, aScriptFromHead, + aIntegrity, aScriptFromHead, aAsync, aDefer, mSpeculationReferrerPolicy); } diff --git a/parser/html/nsHtml5TreeOpExecutor.h b/parser/html/nsHtml5TreeOpExecutor.h index c4b6a4594..64a5daa96 100644 --- a/parser/html/nsHtml5TreeOpExecutor.h +++ b/parser/html/nsHtml5TreeOpExecutor.h @@ -249,7 +249,9 @@ class nsHtml5TreeOpExecutor final : public nsHtml5DocumentBuilder, const nsAString& aType, const nsAString& aCrossOrigin, const nsAString& aIntegrity, - bool aScriptFromHead); + bool aScriptFromHead, + bool aAsync, + bool aDefer); void PreloadStyle(const nsAString& aURL, const nsAString& aCharset, const nsAString& aCrossOrigin, diff --git a/parser/html/nsHtml5TreeOperation.cpp b/parser/html/nsHtml5TreeOperation.cpp index 3877e01b8..02cb3caac 100644 --- a/parser/html/nsHtml5TreeOperation.cpp +++ b/parser/html/nsHtml5TreeOperation.cpp @@ -833,7 +833,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(node); NS_ASSERTION(sele, "Node didn't QI to script."); sele->SetScriptLineNumber(mFour.integer); - sele->FreezeUriAsyncDefer(); + sele->FreezeExecutionAttrs(node->OwnerDoc()); return NS_OK; } case eTreeOpSvgLoad: { |