| 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 29 matching lines...) Expand all Loading... |
| 40 : HTMLFrameElementBase(iframeTag, document), | 40 : HTMLFrameElementBase(iframeTag, document), |
| 41 m_didLoadNonEmptyDocument(false), | 41 m_didLoadNonEmptyDocument(false), |
| 42 m_sandbox(HTMLIFrameElementSandbox::create(this)), | 42 m_sandbox(HTMLIFrameElementSandbox::create(this)), |
| 43 m_allow(HTMLIFrameElementAllow::create(this)), | 43 m_allow(HTMLIFrameElementAllow::create(this)), |
| 44 m_referrerPolicy(ReferrerPolicyDefault) {} | 44 m_referrerPolicy(ReferrerPolicyDefault) {} |
| 45 | 45 |
| 46 DEFINE_NODE_FACTORY(HTMLIFrameElement) | 46 DEFINE_NODE_FACTORY(HTMLIFrameElement) |
| 47 | 47 |
| 48 DEFINE_TRACE(HTMLIFrameElement) { | 48 DEFINE_TRACE(HTMLIFrameElement) { |
| 49 visitor->trace(m_sandbox); | 49 visitor->trace(m_sandbox); |
| 50 visitor->trace(m_permissions); | |
| 51 visitor->trace(m_allow); | 50 visitor->trace(m_allow); |
| 52 HTMLFrameElementBase::trace(visitor); | 51 HTMLFrameElementBase::trace(visitor); |
| 53 Supplementable<HTMLIFrameElement>::trace(visitor); | 52 Supplementable<HTMLIFrameElement>::trace(visitor); |
| 54 } | 53 } |
| 55 | 54 |
| 56 HTMLIFrameElement::~HTMLIFrameElement() {} | 55 HTMLIFrameElement::~HTMLIFrameElement() {} |
| 57 | 56 |
| 58 DOMTokenList* HTMLIFrameElement::sandbox() const { | 57 DOMTokenList* HTMLIFrameElement::sandbox() const { |
| 59 return m_sandbox.get(); | 58 return m_sandbox.get(); |
| 60 } | 59 } |
| 61 | 60 |
| 62 DOMTokenList* HTMLIFrameElement::permissions() const { | |
| 63 if (!const_cast<HTMLIFrameElement*>(this)->initializePermissionsAttribute()) | |
| 64 return nullptr; | |
| 65 return m_permissions.get(); | |
| 66 } | |
| 67 | |
| 68 DOMTokenList* HTMLIFrameElement::allow() const { | 61 DOMTokenList* HTMLIFrameElement::allow() const { |
| 69 return m_allow.get(); | 62 return m_allow.get(); |
| 70 } | 63 } |
| 71 | 64 |
| 72 bool HTMLIFrameElement::isPresentationAttribute( | 65 bool HTMLIFrameElement::isPresentationAttribute( |
| 73 const QualifiedName& name) const { | 66 const QualifiedName& name) const { |
| 74 if (name == widthAttr || name == heightAttr || name == alignAttr || | 67 if (name == widthAttr || name == heightAttr || name == alignAttr || |
| 75 name == frameborderAttr) | 68 name == frameborderAttr) |
| 76 return true; | 69 return true; |
| 77 return HTMLFrameElementBase::isPresentationAttribute(name); | 70 return HTMLFrameElementBase::isPresentationAttribute(name); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 UseCounter:: | 133 UseCounter:: |
| 141 HTMLIFrameElementAllowfullscreenAttributeSetAfterContentLoad); | 134 HTMLIFrameElementAllowfullscreenAttributeSetAfterContentLoad); |
| 142 } | 135 } |
| 143 frameOwnerPropertiesChanged(); | 136 frameOwnerPropertiesChanged(); |
| 144 } | 137 } |
| 145 } else if (name == allowpaymentrequestAttr) { | 138 } else if (name == allowpaymentrequestAttr) { |
| 146 bool oldAllowPaymentRequest = m_allowPaymentRequest; | 139 bool oldAllowPaymentRequest = m_allowPaymentRequest; |
| 147 m_allowPaymentRequest = !value.isNull(); | 140 m_allowPaymentRequest = !value.isNull(); |
| 148 if (m_allowPaymentRequest != oldAllowPaymentRequest) | 141 if (m_allowPaymentRequest != oldAllowPaymentRequest) |
| 149 frameOwnerPropertiesChanged(); | 142 frameOwnerPropertiesChanged(); |
| 150 } else if (name == permissionsAttr) { | |
| 151 if (initializePermissionsAttribute()) | |
| 152 m_permissions->setValue(value); | |
| 153 } else if (RuntimeEnabledFeatures::embedderCSPEnforcementEnabled() && | 143 } else if (RuntimeEnabledFeatures::embedderCSPEnforcementEnabled() && |
| 154 name == cspAttr) { | 144 name == cspAttr) { |
| 155 // TODO(amalika): add more robust validation of the value | 145 // TODO(amalika): add more robust validation of the value |
| 156 if (!value.getString().containsOnlyASCII()) { | 146 if (!value.getString().containsOnlyASCII()) { |
| 157 m_csp = nullAtom; | 147 m_csp = nullAtom; |
| 158 document().addConsoleMessage(ConsoleMessage::create( | 148 document().addConsoleMessage(ConsoleMessage::create( |
| 159 OtherMessageSource, ErrorMessageLevel, | 149 OtherMessageSource, ErrorMessageLevel, |
| 160 "'csp' attribute contains non-ASCII characters: " + value)); | 150 "'csp' attribute contains non-ASCII characters: " + value)); |
| 161 return; | 151 return; |
| 162 } | 152 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 void HTMLIFrameElement::removedFrom(ContainerNode* insertionPoint) { | 185 void HTMLIFrameElement::removedFrom(ContainerNode* insertionPoint) { |
| 196 HTMLFrameElementBase::removedFrom(insertionPoint); | 186 HTMLFrameElementBase::removedFrom(insertionPoint); |
| 197 if (insertionPoint->isInDocumentTree() && document().isHTMLDocument()) | 187 if (insertionPoint->isInDocumentTree() && document().isHTMLDocument()) |
| 198 toHTMLDocument(document()).removeExtraNamedItem(m_name); | 188 toHTMLDocument(document()).removeExtraNamedItem(m_name); |
| 199 } | 189 } |
| 200 | 190 |
| 201 bool HTMLIFrameElement::isInteractiveContent() const { | 191 bool HTMLIFrameElement::isInteractiveContent() const { |
| 202 return true; | 192 return true; |
| 203 } | 193 } |
| 204 | 194 |
| 205 void HTMLIFrameElement::permissionsValueWasSet() { | |
| 206 if (!initializePermissionsAttribute()) | |
| 207 return; | |
| 208 | |
| 209 String invalidTokens; | |
| 210 m_delegatedPermissions = | |
| 211 m_permissions->parseDelegatedPermissions(invalidTokens); | |
| 212 if (!invalidTokens.isNull()) | |
| 213 document().addConsoleMessage(ConsoleMessage::create( | |
| 214 OtherMessageSource, ErrorMessageLevel, | |
| 215 "Error while parsing the 'permissions' attribute: " + invalidTokens)); | |
| 216 setSynchronizedLazyAttribute(permissionsAttr, m_permissions->value()); | |
| 217 frameOwnerPropertiesChanged(); | |
| 218 } | |
| 219 | |
| 220 void HTMLIFrameElement::sandboxValueWasSet() { | 195 void HTMLIFrameElement::sandboxValueWasSet() { |
| 221 String invalidTokens; | 196 String invalidTokens; |
| 222 setSandboxFlags(m_sandbox->value().isNull() | 197 setSandboxFlags(m_sandbox->value().isNull() |
| 223 ? SandboxNone | 198 ? SandboxNone |
| 224 : parseSandboxPolicy(m_sandbox->tokens(), invalidTokens)); | 199 : parseSandboxPolicy(m_sandbox->tokens(), invalidTokens)); |
| 225 if (!invalidTokens.isNull()) | 200 if (!invalidTokens.isNull()) |
| 226 document().addConsoleMessage(ConsoleMessage::create( | 201 document().addConsoleMessage(ConsoleMessage::create( |
| 227 OtherMessageSource, ErrorMessageLevel, | 202 OtherMessageSource, ErrorMessageLevel, |
| 228 "Error while parsing the 'sandbox' attribute: " + invalidTokens)); | 203 "Error while parsing the 'sandbox' attribute: " + invalidTokens)); |
| 229 setSynchronizedLazyAttribute(sandboxAttr, m_sandbox->value()); | 204 setSynchronizedLazyAttribute(sandboxAttr, m_sandbox->value()); |
| 230 } | 205 } |
| 231 | 206 |
| 232 void HTMLIFrameElement::allowValueWasSet() { | 207 void HTMLIFrameElement::allowValueWasSet() { |
| 233 String invalidTokens; | 208 String invalidTokens; |
| 234 m_allowedFeatures = m_allow->parseAllowedFeatureNames(invalidTokens); | 209 m_allowedFeatures = m_allow->parseAllowedFeatureNames(invalidTokens); |
| 235 if (!invalidTokens.isNull()) { | 210 if (!invalidTokens.isNull()) { |
| 236 document().addConsoleMessage(ConsoleMessage::create( | 211 document().addConsoleMessage(ConsoleMessage::create( |
| 237 OtherMessageSource, ErrorMessageLevel, | 212 OtherMessageSource, ErrorMessageLevel, |
| 238 "Error while parsing the 'allow' attribute: " + invalidTokens)); | 213 "Error while parsing the 'allow' attribute: " + invalidTokens)); |
| 239 } | 214 } |
| 240 setSynchronizedLazyAttribute(allowAttr, m_allow->value()); | 215 setSynchronizedLazyAttribute(allowAttr, m_allow->value()); |
| 241 frameOwnerPropertiesChanged(); | 216 frameOwnerPropertiesChanged(); |
| 242 } | 217 } |
| 243 | 218 |
| 244 ReferrerPolicy HTMLIFrameElement::referrerPolicyAttribute() { | 219 ReferrerPolicy HTMLIFrameElement::referrerPolicyAttribute() { |
| 245 return m_referrerPolicy; | 220 return m_referrerPolicy; |
| 246 } | 221 } |
| 247 | 222 |
| 248 bool HTMLIFrameElement::initializePermissionsAttribute() { | |
| 249 if (!RuntimeEnabledFeatures::permissionDelegationEnabled()) | |
| 250 return false; | |
| 251 | |
| 252 if (!m_permissions) | |
| 253 m_permissions = HTMLIFrameElementPermissions::create(this); | |
| 254 return true; | |
| 255 } | |
| 256 | |
| 257 } // namespace blink | 223 } // namespace blink |
| OLD | NEW |