summaryrefslogtreecommitdiff
path: root/parser/html/nsHtml5TreeBuilderCppSupplement.h
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-08-24 11:11:17 +0000
committerMoonchild <moonchild@palemoon.org>2020-08-24 11:13:16 +0000
commit2ca1cbe2f5e138e7b12b156296a21e47ce0aaedf (patch)
tree4a4b062e0185ea5cfd1a64d25188f9a9b4e056cd /parser/html/nsHtml5TreeBuilderCppSupplement.h
parent95e0f114e2b1eed6142ee51054f7122d520eb8fb (diff)
downloaduxp-2ca1cbe2f5e138e7b12b156296a21e47ce0aaedf.tar.gz
Issue #618 - (async, preload) Correctly pass info about async/defer to parser.
This makes sure we don't block body-referred sub-resources by head-referenced defer and async scripts. This is important for all script loads, not just modules, but is added here because it was run into while implementing modules.
Diffstat (limited to 'parser/html/nsHtml5TreeBuilderCppSupplement.h')
-rw-r--r--parser/html/nsHtml5TreeBuilderCppSupplement.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/parser/html/nsHtml5TreeBuilderCppSupplement.h b/parser/html/nsHtml5TreeBuilderCppSupplement.h
index 62df6d002c..634c5c2186 100644
--- a/parser/html/nsHtml5TreeBuilderCppSupplement.h
+++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h
@@ -185,16 +185,20 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace,
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 == nsHtml5TreeBuilder::IN_HEAD);
- mCurrentHtmlScriptIsAsyncOrDefer =
- aAttributes->contains(nsHtml5AttributeName::ATTR_ASYNC) ||
- aAttributes->contains(nsHtml5AttributeName::ATTR_DEFER);
+ mode == nsHtml5TreeBuilder::IN_HEAD,
+ async,
+ defer);
+ mCurrentHtmlScriptIsAsyncOrDefer = async || defer;
}
} else if (nsHtml5Atoms::link == aName) {
nsHtml5String rel =
@@ -297,7 +301,9 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace,
type,
crossOrigin,
integrity,
- mode == nsHtml5TreeBuilder::IN_HEAD);
+ mode == nsHtml5TreeBuilder::IN_HEAD,
+ false /* async */,
+ false /* defer */);
}
} else if (nsHtml5Atoms::style == aName) {
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();