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-05-24 14:28:47 +00:00
parent 29dd61e5fa
commit bcf940af03
27 changed files with 220 additions and 165 deletions

View File

@@ -6572,8 +6572,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",
@@ -6591,6 +6589,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{}));
}
}
}