Bug 1890748 - Move responsibility of FeaturePolicy initialization to nsILoadInfo. r=freddyb,necko-reviewers,jesup,dom-core,sefeng

Differential Revision: https://phabricator.services.mozilla.com/D207140
This commit is contained in:
Andreas Farre
2024-06-20 13:22:41 +00:00
parent 030d3afa61
commit 0a1a357b83
27 changed files with 220 additions and 165 deletions

View File

@@ -6596,8 +6596,6 @@ nsresult nsDocShell::CreateAboutBlankDocumentViewer(
// after being set here.
blankDoc->SetSandboxFlags(sandboxFlags);
blankDoc->InitFeaturePolicy();
// create a content viewer for us and the new document
docFactory->CreateInstanceForDocument(
NS_ISUPPORTS_CAST(nsIDocShell*, this), blankDoc, "view",
@@ -6615,6 +6613,12 @@ nsresult nsDocShell::CreateAboutBlankDocumentViewer(
/* aLocationFlags */ 0);
rv = mIsBeingDestroyed ? NS_ERROR_NOT_AVAILABLE : NS_OK;
}
if (Element* embedderElement = blankDoc->GetEmbedderElement()) {
blankDoc->InitFeaturePolicy(AsVariant(embedderElement));
} else {
blankDoc->InitFeaturePolicy(AsVariant(Nothing{}));
}
}
}