[tbb-commits] [tor-browser] 01/09: Bug 1782211 - Init feature policy; r=ckerschb, a=RyanVM
gitolite role
git at cupani.torproject.org
Thu Sep 22 19:17:07 UTC 2022
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.13.0esr-11.5-1
in repository tor-browser.
commit 4c2181c10c70fd1337d24588d67bb009604ddafe
Author: Edgar Chen <echen at mozilla.com>
AuthorDate: Wed Aug 24 20:56:16 2022 +0000
Bug 1782211 - Init feature policy; r=ckerschb, a=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D154161
---
docshell/base/nsDocShell.cpp | 2 ++
dom/base/Document.cpp | 8 ++++++--
dom/base/Document.h | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index 2d0e65131382..8f1cf78208db 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -6655,6 +6655,8 @@ nsresult nsDocShell::CreateAboutBlankContentViewer(
// 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",
diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp
index 7bce87a3cbdb..0bf1bbdc7281 100644
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -3744,8 +3744,8 @@ already_AddRefed<dom::FeaturePolicy> Document::GetParentFeaturePolicy() {
return do_AddRef(child->GetContainerFeaturePolicy());
}
-nsresult Document::InitFeaturePolicy(nsIChannel* aChannel) {
- MOZ_ASSERT(mFeaturePolicy, "we should only call init once");
+void Document::InitFeaturePolicy() {
+ MOZ_ASSERT(mFeaturePolicy, "we should have FeaturePolicy created");
mFeaturePolicy->ResetDeclaredPolicy();
@@ -3757,6 +3757,10 @@ nsresult Document::InitFeaturePolicy(nsIChannel* aChannel) {
mFeaturePolicy->InheritPolicy(parentPolicy);
mFeaturePolicy->SetSrcOrigin(parentPolicy->GetSrcOrigin());
}
+}
+
+nsresult Document::InitFeaturePolicy(nsIChannel* aChannel) {
+ InitFeaturePolicy();
// We don't want to parse the http Feature-Policy header if this pref is off.
if (!StaticPrefs::dom_security_featurePolicy_header_enabled()) {
diff --git a/dom/base/Document.h b/dom/base/Document.h
index 18caa8aaabef..8754803b1377 100644
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -1517,6 +1517,7 @@ class Document : public nsINode,
void DoNotifyPossibleTitleChange();
+ void InitFeaturePolicy();
nsresult InitFeaturePolicy(nsIChannel* aChannel);
protected:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the tbb-commits
mailing list