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

Side by Side Diff: Source/core/dom/Element.h

Issue 1171223004: Sanitize SVG animation attributes which could set JavaScript URL values. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Thanks for feedback. Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved. 6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 bool isUpgradedCustomElement() { return customElementState() == Upgraded; } 347 bool isUpgradedCustomElement() { return customElementState() == Upgraded; }
348 bool isUnresolvedCustomElement() { return customElementState() == WaitingFor Upgrade; } 348 bool isUnresolvedCustomElement() { return customElementState() == WaitingFor Upgrade; }
349 349
350 AtomicString computeInheritedLanguage() const; 350 AtomicString computeInheritedLanguage() const;
351 Locale& locale() const; 351 Locale& locale() const;
352 352
353 virtual void accessKeyAction(bool /*sendToAnyEvent*/) { } 353 virtual void accessKeyAction(bool /*sendToAnyEvent*/) { }
354 354
355 virtual bool isURLAttribute(const Attribute&) const { return false; } 355 virtual bool isURLAttribute(const Attribute&) const { return false; }
356 virtual bool isHTMLContentAttribute(const Attribute&) const { return false; } 356 virtual bool isHTMLContentAttribute(const Attribute&) const { return false; }
357 bool isJavaScriptURLAttribute(const Attribute&) const;
358 virtual bool isSVGAnimationAttributeSettingJavaScriptURL(const Attribute&) c onst { return false; }
357 359
358 virtual bool isLiveLink() const { return false; } 360 virtual bool isLiveLink() const { return false; }
359 KURL hrefURL() const; 361 KURL hrefURL() const;
360 362
361 KURL getURLAttribute(const QualifiedName&) const; 363 KURL getURLAttribute(const QualifiedName&) const;
362 KURL getNonEmptyURLAttribute(const QualifiedName&) const; 364 KURL getNonEmptyURLAttribute(const QualifiedName&) const;
363 365
364 virtual const AtomicString imageSourceURL() const; 366 virtual const AtomicString imageSourceURL() const;
365 virtual Image* imageContents() { return nullptr; } 367 virtual Image* imageContents() { return nullptr; }
366 368
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 // may use the layoutObject to reason about focusability. This method cannot be 534 // may use the layoutObject to reason about focusability. This method cannot be
533 // moved to LayoutObject because some focusable nodes don't have layoutObjec ts, 535 // moved to LayoutObject because some focusable nodes don't have layoutObjec ts,
534 // e.g., HTMLOptionElement. 536 // e.g., HTMLOptionElement.
535 virtual bool layoutObjectIsFocusable() const; 537 virtual bool layoutObjectIsFocusable() const;
536 538
537 // classAttributeChanged() exists to share code between 539 // classAttributeChanged() exists to share code between
538 // parseAttribute (called via setAttribute()) and 540 // parseAttribute (called via setAttribute()) and
539 // svgAttributeChanged (called when element.className.baseValue is set) 541 // svgAttributeChanged (called when element.className.baseValue is set)
540 void classAttributeChanged(const AtomicString& newClassString); 542 void classAttributeChanged(const AtomicString& newClassString);
541 543
544 static bool attributeValueIsJavaScriptURL(const Attribute&);
545
542 PassRefPtr<ComputedStyle> originalStyleForLayoutObject(); 546 PassRefPtr<ComputedStyle> originalStyleForLayoutObject();
543 547
544 Node* insertAdjacent(const String& where, Node* newChild, ExceptionState&); 548 Node* insertAdjacent(const String& where, Node* newChild, ExceptionState&);
545 549
546 virtual void parserDidSetAttributes() { }; 550 virtual void parserDidSetAttributes() { };
547 551
548 void scrollLayoutBoxBy(const ScrollToOptions&); 552 void scrollLayoutBoxBy(const ScrollToOptions&);
549 void scrollLayoutBoxTo(const ScrollToOptions&); 553 void scrollLayoutBoxTo(const ScrollToOptions&);
550 void scrollFrameBy(const ScrollToOptions&); 554 void scrollFrameBy(const ScrollToOptions&);
551 void scrollFrameTo(const ScrollToOptions&); 555 void scrollFrameTo(const ScrollToOptions&);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 638
635 ElementRareData* elementRareData() const; 639 ElementRareData* elementRareData() const;
636 ElementRareData& ensureElementRareData(); 640 ElementRareData& ensureElementRareData();
637 641
638 AttrNodeList& ensureAttrNodeList(); 642 AttrNodeList& ensureAttrNodeList();
639 void removeAttrNodeList(); 643 void removeAttrNodeList();
640 void detachAllAttrNodesFromElement(); 644 void detachAllAttrNodesFromElement();
641 void detachAttrNodeFromElementWithValue(Attr*, const AtomicString& value); 645 void detachAttrNodeFromElementWithValue(Attr*, const AtomicString& value);
642 void detachAttrNodeAtIndex(Attr*, size_t index); 646 void detachAttrNodeAtIndex(Attr*, size_t index);
643 647
644 bool isJavaScriptURLAttribute(const Attribute&) const;
645
646 v8::Local<v8::Object> wrapCustomElement(v8::Isolate*, v8::Local<v8::Object> creationContext); 648 v8::Local<v8::Object> wrapCustomElement(v8::Isolate*, v8::Local<v8::Object> creationContext);
647 649
648 RefPtrWillBeMember<ElementData> m_elementData; 650 RefPtrWillBeMember<ElementData> m_elementData;
649 }; 651 };
650 652
651 DEFINE_NODE_TYPE_CASTS(Element, isElementNode()); 653 DEFINE_NODE_TYPE_CASTS(Element, isElementNode());
652 template <typename T> bool isElementOfType(const Node&); 654 template <typename T> bool isElementOfType(const Node&);
653 template <> inline bool isElementOfType<const Element>(const Node& node) { retur n node.isElementNode(); } 655 template <> inline bool isElementOfType<const Element>(const Node& node) { retur n node.isElementNode(); }
654 template <typename T> inline bool isElementOfType(const Element& element) { retu rn isElementOfType<T>(static_cast<const Node&>(element)); } 656 template <typename T> inline bool isElementOfType(const Element& element) { retu rn isElementOfType<T>(static_cast<const Node&>(element)); }
655 template <> inline bool isElementOfType<const Element>(const Element&) { return true; } 657 template <> inline bool isElementOfType<const Element>(const Element&) { return true; }
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) 877 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&)
876 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 878 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
877 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \ 879 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \
878 { \ 880 { \
879 return adoptRefWillBeNoop(new T(tagName, document)); \ 881 return adoptRefWillBeNoop(new T(tagName, document)); \
880 } 882 }
881 883
882 } // namespace 884 } // namespace
883 885
884 #endif // Element_h 886 #endif // Element_h
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698