Bug 1422931 - Part 2: Make webcomponents preference per-doc. r=smaug

This is to fix the case where preference is restore to false when a testcase
ends, but nsDocument::DeleteShell is called afterwards. So, we make the
preference per-doc and set it when the document is created. The value does not
change for the lifetime of the document.
This commit is contained in:
Jessica Jong
2017-12-09 11:25:14 +08:00
parent c1c231786c
commit 35cba086d7
12 changed files with 65 additions and 12 deletions

View File

@@ -16,7 +16,7 @@ NS_NewHTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
mozilla::dom::FromParser aFromParser)
{
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
if (nsContentUtils::IsWebComponentsEnabled()) {
if (nsDocument::IsWebComponentsEnabled(nodeInfo->GetDocument())) {
already_AddRefed<mozilla::dom::NodeInfo> nodeInfoArg(nodeInfo.forget());
return new mozilla::dom::HTMLSlotElement(nodeInfoArg);
}