Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Unified Diff: third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp

Issue 2797813002: Replicate feature policy container policies. (Closed)
Patch Set: Addressing review comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
index f7eb047b5dddea3c08d5961dc60e344592e1a4c7..b6a248f8d69f4ce63f2a6801e8531daca800eb7e 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
@@ -206,11 +206,17 @@ DOMWindow* HTMLFrameOwnerElement::contentWindow() const {
void HTMLFrameOwnerElement::SetSandboxFlags(SandboxFlags flags) {
sandbox_flags_ = flags;
- // Don't notify about updates if contentFrame() is null, for example when
+ // Recalculate the container policy in case the allow-same-origin flag has
+ // changed.
+ container_policy_ = GetContainerPolicyFromAllowedFeatures(
+ AllowedFeatures(), GetOriginForFeaturePolicy());
+
+ // Don't notify about updates if ContentFrame() is null, for example when
// the subframe hasn't been created yet.
- if (ContentFrame())
- GetDocument().GetFrame()->Loader().Client()->DidChangeSandboxFlags(
- ContentFrame(), flags);
+ if (ContentFrame()) {
+ GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy(
+ ContentFrame(), sandbox_flags_, container_policy_);
+ }
}
bool HTMLFrameOwnerElement::IsKeyboardFocusable() const {
@@ -226,12 +232,24 @@ void HTMLFrameOwnerElement::DisposeFrameOrPluginSoon(
frame_or_plugin->Dispose();
}
+void HTMLFrameOwnerElement::UpdateContainerPolicy() {
+ container_policy_ = GetContainerPolicyFromAllowedFeatures(
+ AllowedFeatures(), GetOriginForFeaturePolicy());
+ // Don't notify about updates if ContentFrame() is null, for example when
+ // the subframe hasn't been created yet.
+ if (ContentFrame()) {
+ GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy(
+ ContentFrame(), sandbox_flags_, container_policy_);
+ }
+}
+
void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() {
- // Don't notify about updates if contentFrame() is null, for example when
+ // Don't notify about updates if ContentFrame() is null, for example when
// the subframe hasn't been created yet.
- if (ContentFrame())
+ if (ContentFrame()) {
GetDocument().GetFrame()->Loader().Client()->DidChangeFrameOwnerProperties(
this);
+ }
}
void HTMLFrameOwnerElement::DispatchLoad() {
@@ -244,6 +262,10 @@ HTMLFrameOwnerElement::AllowedFeatures() const {
return features;
}
+const WebParsedFeaturePolicy& HTMLFrameOwnerElement::ContainerPolicy() const {
+ return container_policy_;
+}
+
Document* HTMLFrameOwnerElement::getSVGDocument(
ExceptionState& exception_state) const {
Document* doc = contentDocument();
@@ -312,6 +334,8 @@ bool HTMLFrameOwnerElement::LoadOrRedirectSubframe(
const KURL& url,
const AtomicString& frame_name,
bool replace_current_item) {
+ UpdateContainerPolicy();
+
LocalFrame* parent_frame = GetDocument().GetFrame();
if (ContentFrame()) {
ContentFrame()->Navigate(GetDocument(), url, replace_current_item,
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h ('k') | third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698