OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Simon Hausmann (hausmann@kde.org) | 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2009 Ericsson AB. All rights reserved. | 7 * Copyright (C) 2009 Ericsson AB. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 191 } |
192 FrameOwnerPropertiesChanged(); | 192 FrameOwnerPropertiesChanged(); |
193 UpdateContainerPolicy(); | 193 UpdateContainerPolicy(); |
194 } else { | 194 } else { |
195 if (name == srcAttr) | 195 if (name == srcAttr) |
196 LogUpdateAttributeIfIsolatedWorldAndInDocument("iframe", params); | 196 LogUpdateAttributeIfIsolatedWorldAndInDocument("iframe", params); |
197 HTMLFrameElementBase::ParseAttribute(params); | 197 HTMLFrameElementBase::ParseAttribute(params); |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
| 201 Vector<WebParsedFeaturePolicyDeclaration> |
| 202 HTMLIFrameElement::ConstructContainerPolicy() const { |
| 203 RefPtr<SecurityOrigin> origin = GetOriginForFeaturePolicy(); |
| 204 Vector<WebParsedFeaturePolicyDeclaration> container_policy; |
| 205 |
| 206 // Populate the initial container policy from the allow attribute. |
| 207 for (const WebFeaturePolicyFeature feature : AllowedFeatures()) { |
| 208 WebParsedFeaturePolicyDeclaration whitelist; |
| 209 whitelist.feature = feature; |
| 210 whitelist.origins = Vector<WebSecurityOrigin>(1UL, {origin}); |
| 211 container_policy.push_back(whitelist); |
| 212 } |
| 213 |
| 214 // If allowfullscreen attribute is present and no fullscreen policy is set, |
| 215 // enable the feature for all origins; similarly for allowpaymentrequest. |
| 216 if (AllowFullscreen()) { |
| 217 bool can_override_fullscreen = true; |
| 218 for (const auto& declaration : container_policy) { |
| 219 if (declaration.feature == WebFeaturePolicyFeature::kFullscreen) { |
| 220 can_override_fullscreen = false; |
| 221 break; |
| 222 } |
| 223 } |
| 224 if (can_override_fullscreen) { |
| 225 WebParsedFeaturePolicyDeclaration whitelist; |
| 226 whitelist.feature = WebFeaturePolicyFeature::kFullscreen; |
| 227 whitelist.matches_all_origins = true; |
| 228 whitelist.origins = Vector<WebSecurityOrigin>(0UL); |
| 229 container_policy.push_back(whitelist); |
| 230 } |
| 231 } |
| 232 if (AllowPaymentRequest()) { |
| 233 bool can_override_payment = true; |
| 234 for (const auto& declaration : container_policy) { |
| 235 if (declaration.feature == WebFeaturePolicyFeature::kPayment) { |
| 236 can_override_payment = false; |
| 237 break; |
| 238 } |
| 239 } |
| 240 if (can_override_payment) { |
| 241 WebParsedFeaturePolicyDeclaration whitelist; |
| 242 whitelist.feature = WebFeaturePolicyFeature::kPayment; |
| 243 whitelist.matches_all_origins = true; |
| 244 whitelist.origins = Vector<WebSecurityOrigin>(0UL); |
| 245 container_policy.push_back(whitelist); |
| 246 } |
| 247 } |
| 248 |
| 249 return container_policy; |
| 250 } |
| 251 |
201 bool HTMLIFrameElement::LayoutObjectIsNeeded(const ComputedStyle& style) { | 252 bool HTMLIFrameElement::LayoutObjectIsNeeded(const ComputedStyle& style) { |
202 return ContentFrame() && !collapsed_by_client_ && | 253 return ContentFrame() && !collapsed_by_client_ && |
203 HTMLElement::LayoutObjectIsNeeded(style); | 254 HTMLElement::LayoutObjectIsNeeded(style); |
204 } | 255 } |
205 | 256 |
206 LayoutObject* HTMLIFrameElement::CreateLayoutObject(const ComputedStyle&) { | 257 LayoutObject* HTMLIFrameElement::CreateLayoutObject(const ComputedStyle&) { |
207 return new LayoutIFrame(this); | 258 return new LayoutIFrame(this); |
208 } | 259 } |
209 | 260 |
210 Node::InsertionNotificationRequest HTMLIFrameElement::InsertedInto( | 261 Node::InsertionNotificationRequest HTMLIFrameElement::InsertedInto( |
(...skipping 14 matching lines...) Expand all Loading... |
225 | 276 |
226 bool HTMLIFrameElement::IsInteractiveContent() const { | 277 bool HTMLIFrameElement::IsInteractiveContent() const { |
227 return true; | 278 return true; |
228 } | 279 } |
229 | 280 |
230 ReferrerPolicy HTMLIFrameElement::ReferrerPolicyAttribute() { | 281 ReferrerPolicy HTMLIFrameElement::ReferrerPolicyAttribute() { |
231 return referrer_policy_; | 282 return referrer_policy_; |
232 } | 283 } |
233 | 284 |
234 } // namespace blink | 285 } // namespace blink |
OLD | NEW |