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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return (content_frame_ && content_frame_->IsLocalFrame()) 196 return (content_frame_ && content_frame_->IsLocalFrame())
197 ? ToLocalFrame(content_frame_)->GetDocument() 197 ? ToLocalFrame(content_frame_)->GetDocument()
198 : 0; 198 : 0;
199 } 199 }
200 200
201 DOMWindow* HTMLFrameOwnerElement::contentWindow() const { 201 DOMWindow* HTMLFrameOwnerElement::contentWindow() const {
202 return content_frame_ ? content_frame_->DomWindow() : 0; 202 return content_frame_ ? content_frame_->DomWindow() : 0;
203 } 203 }
204 204
205 void HTMLFrameOwnerElement::SetSandboxFlags(SandboxFlags flags) { 205 void HTMLFrameOwnerElement::SetSandboxFlags(SandboxFlags flags) {
206 sandbox_flags_ = flags; 206 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
207 // Don't notify about updates if contentFrame() is null, for example when 207 // Don't notify about updates if ContentFrame() is null, for example when
208 // the subframe hasn't been created yet. 208 // the subframe hasn't been created yet.
209 if (ContentFrame()) 209 if (ContentFrame()) {
210 GetDocument().GetFrame()->Loader().Client()->DidChangeSandboxFlags( 210 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy(
211 ContentFrame(), flags); 211 ContentFrame(), sandbox_flags_, container_policy_);
212 }
212 } 213 }
213 214
214 bool HTMLFrameOwnerElement::IsKeyboardFocusable() const { 215 bool HTMLFrameOwnerElement::IsKeyboardFocusable() const {
215 return content_frame_ && HTMLElement::IsKeyboardFocusable(); 216 return content_frame_ && HTMLElement::IsKeyboardFocusable();
216 } 217 }
217 218
218 void HTMLFrameOwnerElement::DisposeWidgetSoon(FrameViewBase* frame_view_base) { 219 void HTMLFrameOwnerElement::DisposeWidgetSoon(FrameViewBase* frame_view_base) {
219 if (g_update_suspend_count) { 220 if (g_update_suspend_count) {
220 WidgetsPendingDispose().insert(frame_view_base); 221 WidgetsPendingDispose().insert(frame_view_base);
221 return; 222 return;
222 } 223 }
223 frame_view_base->Dispose(); 224 frame_view_base->Dispose();
224 } 225 }
225 226
227 void HTMLFrameOwnerElement::UpdateContainerPolicy() {
228 container_policy_ = GetContainerPolicyFromAllowedFeatures(
229 AllowedFeatures(), GetOriginForFeaturePolicy());
230 // Don't notify about updates if ContentFrame() is null, for example when
231 // the subframe hasn't been created yet.
232 if (ContentFrame()) {
233 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy(
234 ContentFrame(), sandbox_flags_, container_policy_);
235 }
236 }
237
226 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() { 238 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() {
227 // Don't notify about updates if contentFrame() is null, for example when 239 // Don't notify about updates if ContentFrame() is null, for example when
228 // the subframe hasn't been created yet. 240 // the subframe hasn't been created yet.
229 if (ContentFrame()) 241 if (ContentFrame()) {
230 GetDocument().GetFrame()->Loader().Client()->DidChangeFrameOwnerProperties( 242 GetDocument().GetFrame()->Loader().Client()->DidChangeFrameOwnerProperties(
231 this); 243 this);
244 }
232 } 245 }
233 246
234 void HTMLFrameOwnerElement::DispatchLoad() { 247 void HTMLFrameOwnerElement::DispatchLoad() {
235 DispatchScopedEvent(Event::Create(EventTypeNames::load)); 248 DispatchScopedEvent(Event::Create(EventTypeNames::load));
236 } 249 }
237 250
238 const WebVector<WebFeaturePolicyFeature>& 251 const WebVector<WebFeaturePolicyFeature>&
239 HTMLFrameOwnerElement::AllowedFeatures() const { 252 HTMLFrameOwnerElement::AllowedFeatures() const {
240 DEFINE_STATIC_LOCAL(WebVector<WebFeaturePolicyFeature>, features, ()); 253 DEFINE_STATIC_LOCAL(WebVector<WebFeaturePolicyFeature>, features, ());
241 return features; 254 return features;
242 } 255 }
243 256
257 const WebParsedFeaturePolicy& HTMLFrameOwnerElement::ContainerPolicy() const {
258 return container_policy_;
259 }
260
244 Document* HTMLFrameOwnerElement::getSVGDocument( 261 Document* HTMLFrameOwnerElement::getSVGDocument(
245 ExceptionState& exception_state) const { 262 ExceptionState& exception_state) const {
246 Document* doc = contentDocument(); 263 Document* doc = contentDocument();
247 if (doc && doc->IsSVGDocument()) 264 if (doc && doc->IsSVGDocument())
248 return doc; 265 return doc;
249 return nullptr; 266 return nullptr;
250 } 267 }
251 268
252 void HTMLFrameOwnerElement::SetWidget(FrameViewBase* frame_view_base) { 269 void HTMLFrameOwnerElement::SetWidget(FrameViewBase* frame_view_base) {
253 if (frame_view_base == widget_) 270 if (frame_view_base == widget_)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 319 }
303 320
304 FrameViewBase* HTMLFrameOwnerElement::OwnedWidget() const { 321 FrameViewBase* HTMLFrameOwnerElement::OwnedWidget() const {
305 return widget_.Get(); 322 return widget_.Get();
306 } 323 }
307 324
308 bool HTMLFrameOwnerElement::LoadOrRedirectSubframe( 325 bool HTMLFrameOwnerElement::LoadOrRedirectSubframe(
309 const KURL& url, 326 const KURL& url,
310 const AtomicString& frame_name, 327 const AtomicString& frame_name,
311 bool replace_current_item) { 328 bool replace_current_item) {
329 UpdateContainerPolicy();
330
312 LocalFrame* parent_frame = GetDocument().GetFrame(); 331 LocalFrame* parent_frame = GetDocument().GetFrame();
313 if (ContentFrame()) { 332 if (ContentFrame()) {
314 ContentFrame()->Navigate(GetDocument(), url, replace_current_item, 333 ContentFrame()->Navigate(GetDocument(), url, replace_current_item,
315 UserGestureStatus::kNone); 334 UserGestureStatus::kNone);
316 return true; 335 return true;
317 } 336 }
318 337
319 if (!GetDocument().GetSecurityOrigin()->CanDisplay(url)) { 338 if (!GetDocument().GetSecurityOrigin()->CanDisplay(url)) {
320 FrameLoader::ReportLocalLoadFailed(parent_frame, url.GetString()); 339 FrameLoader::ReportLocalLoadFailed(parent_frame, url.GetString());
321 return false; 340 return false;
(...skipping 20 matching lines...) Expand all
342 } 361 }
343 362
344 DEFINE_TRACE(HTMLFrameOwnerElement) { 363 DEFINE_TRACE(HTMLFrameOwnerElement) {
345 visitor->Trace(content_frame_); 364 visitor->Trace(content_frame_);
346 visitor->Trace(widget_); 365 visitor->Trace(widget_);
347 HTMLElement::Trace(visitor); 366 HTMLElement::Trace(visitor);
348 FrameOwner::Trace(visitor); 367 FrameOwner::Trace(visitor);
349 } 368 }
350 369
351 } // namespace blink 370 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698