Changeset 147558 in webkit
- Timestamp:
- Apr 3, 2013 8:45:10 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r147551 r147558 1 2013-04-03 Felipe Zimmerle <felipe@zimmerle.org> 2 3 CSP blocks inline style when cloning a node 4 https://bugs.webkit.org/show_bug.cgi?id=112270 5 6 Reviewed by Adam Barth. 7 8 * http/tests/security/contentSecurityPolicy/inline-style-allowed-while-cloning-objects-expected.txt: Added. 9 * http/tests/security/contentSecurityPolicy/inline-style-allowed-while-cloning-objects.html: Added. 10 1 11 2013-04-03 Ádám Kallai <kadam@inf.u-szeged.hu> 2 12 -
trunk/Source/WebCore/ChangeLog
r147556 r147558 1 2013-04-03 Felipe Zimmerle <felipe@zimmerle.org> 2 3 CSP blocks inline style when cloning a node 4 https://bugs.webkit.org/show_bug.cgi?id=112270 5 6 Reviewed by Adam Barth. 7 8 Checks if the Element is being cloned, if so, the application of the 9 style is allowed otherwise it relies on default permission mechanism. 10 11 Test: http/tests/security/contentSecurityPolicy/inline-style-allowed-while-cloning-objects.html 12 13 * dom/Element.cpp: 14 (WebCore::Element::attributeChanged): Added parameter 15 AttributeModificationReason to the method signature. 16 (WebCore::Element::cloneAttributesFromElement): It is now calling 17 attributeChanged with AttributeModificationReason parameter. In this scope 18 it is always set to ModifiedByCloning. 19 (WebCode::Element::attributeChangedFromParserOrByCloning): 20 Added parameter AttributeModificationReason. 21 * dom/Element.h: Added AttributeModificationReason enum. Used to specify 22 whenever an attribute was set by a cloned oject or directly. 23 AttributeModificationReason added to attributeChanged with the default 24 value set to ModifiedDirectly. 25 * dom/StyledElement.cpp: 26 (WebCore::StyledElement::attributeChanged): Added 27 AttributeModificationReason to the method signature. 28 (WebCore::StyledElement::styleAttributeChanged): Now it is checking the 29 reason of the update, if the reason is ModifiedDirectly check CSP 30 before set. If ModifiedByCloning set the attribute ignoring the CSP 31 policy. 32 * dom/StyledElement.h: 33 (StyledElement): Added AttributeModificationReason parameter to the methods: 34 attributeChanged and styleAttributeChanged, attributeChanged has 35 ModifiedDirectly as default value. 36 * svg/SVGElement.cpp: 37 (WebCore::SVGElement::attributeChanged): Added AttributeModificationReason 38 parameter to the method signature. 39 * svg/SVGElement.h: 40 (SVGElement): Added AttributeModificationReason parameter to the 41 attributeChanged signature with the default value set to: 42 ModifiedDirectly. 43 1 44 2013-04-03 Csaba Osztrogonác <ossy@webkit.org> 2 45 -
trunk/Source/WebCore/dom/Element.cpp
r147395 r147558 848 848 } 849 849 850 void Element::attributeChanged(const QualifiedName& name, const AtomicString& newValue )850 void Element::attributeChanged(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason) 851 851 { 852 852 if (ElementShadow* parentElementShadow = shadowOfParentForDistribution(this)) { … … 891 891 } 892 892 893 inline void Element::attributeChangedFromParserOrByCloning(const QualifiedName& name, const AtomicString& newValue )893 inline void Element::attributeChangedFromParserOrByCloning(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason reason) 894 894 { 895 895 #if ENABLE(CUSTOM_ELEMENTS) … … 899 899 } 900 900 #endif 901 attributeChanged(name, newValue );901 attributeChanged(name, newValue, reason); 902 902 } 903 903 … … 1077 1077 // Use attributeVector instead of m_elementData because attributeChanged might modify m_elementData. 1078 1078 for (unsigned i = 0; i < attributeVector.size(); ++i) 1079 attributeChangedFromParserOrByCloning(attributeVector[i].name(), attributeVector[i].value() );1079 attributeChangedFromParserOrByCloning(attributeVector[i].name(), attributeVector[i].value(), ModifiedDirectly); 1080 1080 } 1081 1081 … … 2892 2892 for (unsigned i = 0; i < m_elementData->length(); ++i) { 2893 2893 const Attribute* attribute = const_cast<const ElementData*>(m_elementData.get())->attributeItem(i); 2894 attributeChangedFromParserOrByCloning(attribute->name(), attribute->value() );2894 attributeChangedFromParserOrByCloning(attribute->name(), attribute->value(), ModifiedByCloning); 2895 2895 } 2896 2896 } -
trunk/Source/WebCore/dom/Element.h
r147281 r147558 374 374 NamedNodeMap* attributes() const; 375 375 376 enum AttributeModificationReason { 377 ModifiedDirectly, 378 ModifiedByCloning 379 }; 380 376 381 // This method is called whenever an attribute is added, changed or removed. 377 virtual void attributeChanged(const QualifiedName&, const AtomicString& );382 virtual void attributeChanged(const QualifiedName&, const AtomicString&, AttributeModificationReason = ModifiedDirectly); 378 383 virtual void parseAttribute(const QualifiedName&, const AtomicString&) { } 379 384 … … 687 692 void addAttributeInternal(const QualifiedName&, const AtomicString& value, SynchronizationOfLazyAttribute); 688 693 void removeAttributeInternal(size_t index, SynchronizationOfLazyAttribute); 689 void attributeChangedFromParserOrByCloning(const QualifiedName&, const AtomicString& );694 void attributeChangedFromParserOrByCloning(const QualifiedName&, const AtomicString&, AttributeModificationReason); 690 695 691 696 #ifndef NDEBUG -
trunk/Source/WebCore/dom/StyledElement.cpp
r143926 r147558 158 158 } 159 159 160 void StyledElement::attributeChanged(const QualifiedName& name, const AtomicString& newValue )160 void StyledElement::attributeChanged(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason reason) 161 161 { 162 162 if (name == styleAttr) 163 styleAttributeChanged(newValue );163 styleAttributeChanged(newValue, reason); 164 164 else if (isPresentationAttribute(name)) { 165 165 elementData()->m_presentationAttributeStyleIsDirty = true; … … 167 167 } 168 168 169 Element::attributeChanged(name, newValue );169 Element::attributeChanged(name, newValue, reason); 170 170 } 171 171 … … 198 198 } 199 199 200 void StyledElement::styleAttributeChanged(const AtomicString& newStyleString )200 void StyledElement::styleAttributeChanged(const AtomicString& newStyleString, AttributeModificationReason reason) 201 201 { 202 202 WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst(); … … 208 208 cssomWrapper->clearParentElement(); 209 209 ensureUniqueElementData()->m_inlineStyle.clear(); 210 } else if ( document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), startLineNumber))210 } else if (reason == ModifiedByCloning || document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), startLineNumber)) 211 211 setInlineStyleFromString(newStyleString); 212 212 -
trunk/Source/WebCore/dom/StyledElement.h
r143926 r147558 67 67 } 68 68 69 virtual void attributeChanged(const QualifiedName&, const AtomicString& ) OVERRIDE;69 virtual void attributeChanged(const QualifiedName&, const AtomicString&, AttributeModificationReason = ModifiedDirectly) OVERRIDE; 70 70 71 71 virtual bool isPresentationAttribute(const QualifiedName&) const { return false; } … … 78 78 79 79 private: 80 void styleAttributeChanged(const AtomicString& newStyleString );80 void styleAttributeChanged(const AtomicString& newStyleString, AttributeModificationReason); 81 81 82 82 void inlineStyleChanged(); -
trunk/Source/WebCore/svg/SVGElement.cpp
r145830 r147558 531 531 } 532 532 533 void SVGElement::attributeChanged(const QualifiedName& name, const AtomicString& newValue )533 void SVGElement::attributeChanged(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason) 534 534 { 535 535 StyledElement::attributeChanged(name, newValue); -
trunk/Source/WebCore/svg/SVGElement.h
r145830 r147558 127 127 128 128 virtual void finishParsingChildren(); 129 virtual void attributeChanged(const QualifiedName&, const AtomicString& ) OVERRIDE;129 virtual void attributeChanged(const QualifiedName&, const AtomicString&, AttributeModificationReason = ModifiedDirectly) OVERRIDE; 130 130 virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE; 131 131
Note: See TracChangeset
for help on using the changeset viewer.