Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 #include "core/CSSPropertyNames.h" | 27 #include "core/CSSPropertyNames.h" |
| 28 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
| 29 #include "core/frame/UseCounter.h" | 29 #include "core/frame/UseCounter.h" |
| 30 #include "core/html/HTMLDocument.h" | 30 #include "core/html/HTMLDocument.h" |
| 31 #include "core/inspector/ConsoleMessage.h" | 31 #include "core/inspector/ConsoleMessage.h" |
| 32 #include "core/layout/LayoutIFrame.h" | 32 #include "core/layout/LayoutIFrame.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 namespace { | |
| 37 | |
| 38 class SandboxObserver : public GarbageCollected<SandboxObserver>, public DOMToke nListObserver { | |
| 39 USING_GARBAGE_COLLECTED_MIXIN(SandboxObserver); | |
| 40 public: | |
| 41 SandboxObserver(HTMLIFrameElement* element) : m_element(element) {} | |
| 42 | |
| 43 void valueWasSet() override | |
| 44 { | |
| 45 m_element->sandboxValueWasSet(); | |
| 46 } | |
| 47 | |
| 48 DEFINE_INLINE_VIRTUAL_TRACE() | |
| 49 { | |
| 50 visitor->trace(m_element); | |
| 51 DOMTokenListObserver::trace(visitor); | |
| 52 } | |
| 53 | |
| 54 private: | |
| 55 Member<HTMLIFrameElement> m_element; | |
| 56 }; | |
| 57 | |
| 58 class PermissionsObserver : public GarbageCollected<PermissionsObserver>, public DOMTokenListObserver { | |
| 59 USING_GARBAGE_COLLECTED_MIXIN(PermissionsObserver); | |
| 60 public: | |
| 61 PermissionsObserver(HTMLIFrameElement* element) : m_element(element) | |
| 62 { | |
| 63 } | |
| 64 | |
| 65 void valueWasSet() override | |
| 66 { | |
| 67 m_element->permissionsValueWasSet(); | |
| 68 } | |
| 69 | |
| 70 DEFINE_INLINE_VIRTUAL_TRACE() | |
| 71 { | |
| 72 visitor->trace(m_element); | |
| 73 DOMTokenListObserver::trace(visitor); | |
| 74 } | |
| 75 | |
| 76 private: | |
| 77 Member<HTMLIFrameElement> m_element; | |
| 78 }; | |
| 79 | |
| 80 } // namespace | |
| 81 | |
| 36 using namespace HTMLNames; | 82 using namespace HTMLNames; |
| 37 | 83 |
| 38 inline HTMLIFrameElement::HTMLIFrameElement(Document& document) | 84 inline HTMLIFrameElement::HTMLIFrameElement(Document& document) |
| 39 : HTMLFrameElementBase(iframeTag, document) | 85 : HTMLFrameElementBase(iframeTag, document) |
| 40 , m_didLoadNonEmptyDocument(false) | 86 , m_didLoadNonEmptyDocument(false) |
| 41 , m_sandbox(HTMLIFrameElementSandbox::create(this)) | 87 , m_sandbox(HTMLIFrameElementSandbox::create(new SandboxObserver(this))) |
| 88 , m_permissions(HTMLIFrameElementPermissions::create(new PermissionsObserver (this))) | |
| 42 , m_referrerPolicy(ReferrerPolicyDefault) | 89 , m_referrerPolicy(ReferrerPolicyDefault) |
| 43 { | 90 { |
| 44 } | 91 } |
| 45 | 92 |
| 46 DEFINE_NODE_FACTORY(HTMLIFrameElement) | 93 DEFINE_NODE_FACTORY(HTMLIFrameElement) |
| 47 | 94 |
| 48 DEFINE_TRACE(HTMLIFrameElement) | 95 DEFINE_TRACE(HTMLIFrameElement) |
| 49 { | 96 { |
| 50 visitor->trace(m_sandbox); | 97 visitor->trace(m_sandbox); |
| 98 visitor->trace(m_permissions); | |
| 51 HTMLFrameElementBase::trace(visitor); | 99 HTMLFrameElementBase::trace(visitor); |
| 52 DOMTokenListObserver::trace(visitor); | |
| 53 } | 100 } |
| 54 | 101 |
| 55 HTMLIFrameElement::~HTMLIFrameElement() | 102 HTMLIFrameElement::~HTMLIFrameElement() |
| 56 { | 103 { |
| 57 } | 104 } |
| 58 | 105 |
| 59 DOMTokenList* HTMLIFrameElement::sandbox() const | 106 DOMTokenList* HTMLIFrameElement::sandbox() const |
| 60 { | 107 { |
| 61 return m_sandbox.get(); | 108 return m_sandbox.get(); |
| 62 } | 109 } |
| 63 | 110 |
| 111 DOMTokenList* HTMLIFrameElement::permissions() const | |
| 112 { | |
| 113 return m_permissions.get(); | |
| 114 } | |
| 115 | |
| 64 bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const | 116 bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const |
| 65 { | 117 { |
| 66 if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr) | 118 if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr) |
| 67 return true; | 119 return true; |
| 68 return HTMLFrameElementBase::isPresentationAttribute(name); | 120 return HTMLFrameElementBase::isPresentationAttribute(name); |
| 69 } | 121 } |
| 70 | 122 |
| 71 void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName & name, const AtomicString& value, MutableStylePropertySet* style) | 123 void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName & name, const AtomicString& value, MutableStylePropertySet* style) |
| 72 { | 124 { |
| 73 if (name == widthAttr) { | 125 if (name == widthAttr) { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 102 UseCounter::count(document(), UseCounter::SandboxViaIFrame); | 154 UseCounter::count(document(), UseCounter::SandboxViaIFrame); |
| 103 } else if (name == referrerpolicyAttr) { | 155 } else if (name == referrerpolicyAttr) { |
| 104 m_referrerPolicy = ReferrerPolicyDefault; | 156 m_referrerPolicy = ReferrerPolicyDefault; |
| 105 if (!value.isNull()) | 157 if (!value.isNull()) |
| 106 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy); | 158 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy); |
| 107 } else if (name == allowfullscreenAttr) { | 159 } else if (name == allowfullscreenAttr) { |
| 108 bool oldAllowFullscreen = m_allowFullscreen; | 160 bool oldAllowFullscreen = m_allowFullscreen; |
| 109 m_allowFullscreen = !value.isNull(); | 161 m_allowFullscreen = !value.isNull(); |
| 110 if (m_allowFullscreen != oldAllowFullscreen) | 162 if (m_allowFullscreen != oldAllowFullscreen) |
| 111 frameOwnerPropertiesChanged(); | 163 frameOwnerPropertiesChanged(); |
| 164 } else if (name == permissionsAttr) { | |
| 165 m_permissions->setValue(value); | |
| 112 } else { | 166 } else { |
| 113 if (name == srcAttr) | 167 if (name == srcAttr) |
| 114 logUpdateAttributeIfIsolatedWorldAndInDocument("iframe", srcAttr, ol dValue, value); | 168 logUpdateAttributeIfIsolatedWorldAndInDocument("iframe", srcAttr, ol dValue, value); |
| 115 HTMLFrameElementBase::parseAttribute(name, oldValue, value); | 169 HTMLFrameElementBase::parseAttribute(name, oldValue, value); |
| 116 } | 170 } |
| 117 } | 171 } |
| 118 | 172 |
| 119 bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) | 173 bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) |
| 120 { | 174 { |
| 121 return isURLAllowed() && HTMLElement::layoutObjectIsNeeded(style); | 175 return isURLAllowed() && HTMLElement::layoutObjectIsNeeded(style); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 140 HTMLFrameElementBase::removedFrom(insertionPoint); | 194 HTMLFrameElementBase::removedFrom(insertionPoint); |
| 141 if (insertionPoint->inShadowIncludingDocument() && document().isHTMLDocument () && !insertionPoint->isInShadowTree()) | 195 if (insertionPoint->inShadowIncludingDocument() && document().isHTMLDocument () && !insertionPoint->isInShadowTree()) |
| 142 toHTMLDocument(document()).removeExtraNamedItem(m_name); | 196 toHTMLDocument(document()).removeExtraNamedItem(m_name); |
| 143 } | 197 } |
| 144 | 198 |
| 145 bool HTMLIFrameElement::isInteractiveContent() const | 199 bool HTMLIFrameElement::isInteractiveContent() const |
| 146 { | 200 { |
| 147 return true; | 201 return true; |
| 148 } | 202 } |
| 149 | 203 |
| 150 void HTMLIFrameElement::valueWasSet() | 204 void HTMLIFrameElement::permissionsValueWasSet() |
|
dominicc (has gone to gerrit)
2016/06/17 04:55:06
Um, I might have missed something but it looks lik
raymes
2016/06/22 06:43:32
Thanks for catching this - I had assumed that some
| |
| 205 { | |
| 206 String invalidTokens; | |
| 207 m_delegatedPermissions = m_permissions->parseDelegatedPermissions(invalidTok ens); | |
| 208 if (!invalidTokens.isNull()) | |
| 209 document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'permissions' attribute: " + invalid Tokens)); | |
| 210 setSynchronizedLazyAttribute(permissionsAttr, m_permissions->value()); | |
| 211 frameOwnerPropertiesChanged(); | |
| 212 } | |
| 213 | |
| 214 void HTMLIFrameElement::sandboxValueWasSet() | |
| 151 { | 215 { |
| 152 String invalidTokens; | 216 String invalidTokens; |
| 153 setSandboxFlags(m_sandbox->value().isNull() ? SandboxNone : parseSandboxPoli cy(m_sandbox->tokens(), invalidTokens)); | 217 setSandboxFlags(m_sandbox->value().isNull() ? SandboxNone : parseSandboxPoli cy(m_sandbox->tokens(), invalidTokens)); |
| 154 if (!invalidTokens.isNull()) | 218 if (!invalidTokens.isNull()) |
| 155 document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidToke ns)); | 219 document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidToke ns)); |
| 156 setSynchronizedLazyAttribute(sandboxAttr, m_sandbox->value()); | 220 setSynchronizedLazyAttribute(sandboxAttr, m_sandbox->value()); |
| 157 } | 221 } |
| 158 | 222 |
| 159 ReferrerPolicy HTMLIFrameElement::referrerPolicyAttribute() | 223 ReferrerPolicy HTMLIFrameElement::referrerPolicyAttribute() |
| 160 { | 224 { |
| 161 return m_referrerPolicy; | 225 return m_referrerPolicy; |
| 162 } | 226 } |
| 163 } // namespace blink | 227 } // namespace blink |
| OLD | NEW |