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

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

Issue 2797813002: Replicate feature policy container policies. (Closed)
Patch Set: Fix rebase 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 90d7742c2a7a0d82a13e9e5e742135dd53aa0b32..2cfc5dfd836357cf62361671fb490107be566475 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
@@ -204,11 +204,12 @@ DOMWindow* HTMLFrameOwnerElement::contentWindow() const {
void HTMLFrameOwnerElement::SetSandboxFlags(SandboxFlags flags) {
sandbox_flags_ = flags;
dcheng 2017/04/18 16:26:37 How come this doesn't need to refresh container_po
iclelland 2017/04/18 19:19:44 That's a really good point, it should update that
- // 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())
- GetDocument().GetFrame()->Loader().Client()->DidChangeSandboxFlags(
- ContentFrame(), flags);
+ if (ContentFrame()) {
+ GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy(
+ ContentFrame(), sandbox_flags_, container_policy_);
+ }
}
bool HTMLFrameOwnerElement::IsKeyboardFocusable() const {
@@ -223,12 +224,24 @@ void HTMLFrameOwnerElement::DisposeWidgetSoon(FrameViewBase* frame_view_base) {
frame_view_base->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() {
@@ -241,6 +254,10 @@ HTMLFrameOwnerElement::AllowedFeatures() const {
return features;
}
+const WebParsedFeaturePolicy& HTMLFrameOwnerElement::ContainerPolicy() const {
+ return container_policy_;
+}
+
Document* HTMLFrameOwnerElement::getSVGDocument(
ExceptionState& exception_state) const {
Document* doc = contentDocument();
@@ -309,6 +326,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,

Powered by Google App Engine
This is Rietveld 408576698