Changeset 141516 in webkit
- Timestamp:
- Jan 31, 2013, 5:39:31 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r141514 r141516 1 2013-01-31 Abhishek Arya <inferno@chromium.org> 2 3 Use ASSERT_WITH_SECURITY_IMPLICATION to catch bad casts in DOM 4 https://bugs.webkit.org/show_bug.cgi?id=108490 5 6 Reviewed by Eric Seidel. 7 8 * dom/ContainerNode.h: 9 (WebCore::toContainerNode): 10 * dom/Element.h: 11 (WebCore::toElement): 12 * dom/ShadowRoot.h: 13 (WebCore::toShadowRoot): 14 * dom/Text.h: 15 (WebCore::toText): 16 * html/HTMLElement.h: 17 (HTMLElement): 18 (WebCore::toHTMLElement): 19 * html/HTMLFrameOwnerElement.h: 20 (WebCore::toFrameOwnerElement): 21 * html/HTMLMediaElement.cpp: 22 (WebCore::HTMLMediaElement::hasMediaControls): 23 * html/HTMLTemplateElement.cpp: 24 (WebCore::toHTMLTemplateElement): 25 * html/HTMLUnknownElement.h: 26 (WebCore::toHTMLUnknownElement): 27 * html/shadow/InsertionPoint.h: 28 (WebCore::toInsertionPoint): 29 * html/shadow/MediaControlElementTypes.cpp: 30 (WebCore::mediaControlElementType): 31 * html/shadow/MediaControls.h: 32 (WebCore::toMediaControls): 33 * html/shadow/SliderThumbElement.h: 34 (WebCore::toSliderThumbElement): 35 * html/shadow/TextControlInnerElements.h: 36 (WebCore::toInputFieldSpeechButtonElement): 37 * html/shadow/TextFieldDecorationElement.h: 38 (WebCore::toTextFieldDecorationElement): 39 * html/track/WebVTTElement.h: 40 (WebCore::toWebVTTElement): 41 * mathml/MathMLElement.h: 42 (WebCore::toMathMLElement): 43 * page/scrolling/ScrollingStateFixedNode.h: 44 (WebCore::toScrollingStateFixedNode): 45 * page/scrolling/ScrollingStateScrollingNode.h: 46 (WebCore::toScrollingStateScrollingNode): 47 * page/scrolling/ScrollingStateStickyNode.h: 48 (WebCore::toScrollingStateStickyNode): 49 * rendering/RenderLayer.cpp: 50 (WebCore::RenderLayer::resize): 51 * rendering/svg/SVGResources.cpp: 52 (WebCore::registerPendingResource): 53 (WebCore::SVGResources::buildCachedResources): 54 * svg/SVGElement.h: 55 (WebCore::toSVGElement): 56 * svg/SVGStyledElement.h: 57 (WebCore::toSVGStyledElement): 58 1 59 2013-01-31 Christopher Cameron <ccameron@chromium.org> 2 60 -
trunk/Source/WebCore/dom/ContainerNode.h
r140784 r141516 176 176 inline ContainerNode* toContainerNode(Node* node) 177 177 { 178 ASSERT (!node || node->isContainerNode());178 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isContainerNode()); 179 179 return static_cast<ContainerNode*>(node); 180 180 } … … 182 182 inline const ContainerNode* toContainerNode(const Node* node) 183 183 { 184 ASSERT (!node || node->isContainerNode());184 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isContainerNode()); 185 185 return static_cast<const ContainerNode*>(node); 186 186 } -
trunk/Source/WebCore/dom/Element.h
r141292 r141516 618 618 inline Element* toElement(Node* node) 619 619 { 620 ASSERT (!node || node->isElementNode());620 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isElementNode()); 621 621 return static_cast<Element*>(node); 622 622 } … … 624 624 inline const Element* toElement(const Node* node) 625 625 { 626 ASSERT (!node || node->isElementNode());626 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isElementNode()); 627 627 return static_cast<const Element*>(node); 628 628 } -
trunk/Source/WebCore/dom/ShadowRoot.h
r141313 r141516 129 129 inline const ShadowRoot* toShadowRoot(const Node* node) 130 130 { 131 ASSERT (!node || node->isShadowRoot());131 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isShadowRoot()); 132 132 return static_cast<const ShadowRoot*>(node); 133 133 } -
trunk/Source/WebCore/dom/Text.h
r135668 r141516 76 76 inline Text* toText(Node* node) 77 77 { 78 ASSERT (!node || node->isTextNode());78 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isTextNode()); 79 79 return static_cast<Text*>(node); 80 80 } -
trunk/Source/WebCore/html/HTMLElement.h
r141395 r141516 103 103 #endif 104 104 105 #ifndef NDEBUG106 105 virtual bool isHTMLUnknownElement() const { return false; } 107 #endif108 106 109 107 virtual bool isLabelable() const { return false; } … … 154 152 inline HTMLElement* toHTMLElement(Node* node) 155 153 { 156 ASSERT (!node || node->isHTMLElement());154 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isHTMLElement()); 157 155 return static_cast<HTMLElement*>(node); 158 156 } … … 160 158 inline const HTMLElement* toHTMLElement(const Node* node) 161 159 { 162 ASSERT (!node || node->isHTMLElement());160 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isHTMLElement()); 163 161 return static_cast<const HTMLElement*>(node); 164 162 } -
trunk/Source/WebCore/html/HTMLFrameOwnerElement.h
r140807 r141516 75 75 inline HTMLFrameOwnerElement* toFrameOwnerElement(Node* node) 76 76 { 77 ASSERT (!node || node->isFrameOwnerElement());77 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isFrameOwnerElement()); 78 78 return static_cast<HTMLFrameOwnerElement*>(node); 79 79 } -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r141292 r141516 4275 4275 if (ShadowRoot* userAgent = userAgentShadowRoot()) { 4276 4276 Node* node = userAgent->firstChild(); 4277 ASSERT (!node || node->isMediaControls());4277 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls()); 4278 4278 return node; 4279 4279 } -
trunk/Source/WebCore/html/HTMLTemplateElement.cpp
r139132 r141516 89 89 const HTMLTemplateElement* toHTMLTemplateElement(const Node* node) 90 90 { 91 ASSERT (!node || (node->isHTMLElement() && node->hasTagName(templateTag)));91 ASSERT_WITH_SECURITY_IMPLICATION(!node || (node->isHTMLElement() && node->hasTagName(templateTag))); 92 92 return static_cast<const HTMLTemplateElement*>(node); 93 93 } -
trunk/Source/WebCore/html/HTMLUnknownElement.h
r109702 r141516 42 42 } 43 43 44 #ifndef NDEBUG45 44 virtual bool isHTMLUnknownElement() const OVERRIDE { return true; } 46 #endif47 45 48 46 private: … … 55 53 inline HTMLUnknownElement* toHTMLUnknownElement(HTMLElement* element) 56 54 { 57 ASSERT (!element || element->isHTMLUnknownElement());55 ASSERT_WITH_SECURITY_IMPLICATION(!element || element->isHTMLUnknownElement()); 58 56 return static_cast<HTMLUnknownElement*>(element); 59 57 } -
trunk/Source/WebCore/html/shadow/InsertionPoint.h
r139400 r141516 106 106 inline InsertionPoint* toInsertionPoint(Node* node) 107 107 { 108 ASSERT (!node || node->isInsertionPoint());108 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isInsertionPoint()); 109 109 return static_cast<InsertionPoint*>(node); 110 110 } … … 112 112 inline const InsertionPoint* toInsertionPoint(const Node* node) 113 113 { 114 ASSERT (!node || node->isInsertionPoint());114 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isInsertionPoint()); 115 115 return static_cast<const InsertionPoint*>(node); 116 116 } -
trunk/Source/WebCore/html/shadow/MediaControlElementTypes.cpp
r136613 r141516 67 67 MediaControlElementType mediaControlElementType(Node* node) 68 68 { 69 ASSERT (node->isMediaControlElement());69 ASSERT_WITH_SECURITY_IMPLICATION(node->isMediaControlElement()); 70 70 HTMLElement* element = toHTMLElement(node); 71 71 if (element->hasTagName(inputTag)) -
trunk/Source/WebCore/html/shadow/MediaControls.h
r139547 r141516 146 146 inline MediaControls* toMediaControls(Node* node) 147 147 { 148 ASSERT (!node || node->isMediaControls());148 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls()); 149 149 return static_cast<MediaControls*>(node); 150 150 } -
trunk/Source/WebCore/html/shadow/SliderThumbElement.h
r139920 r141516 94 94 inline SliderThumbElement* toSliderThumbElement(Node* node) 95 95 { 96 ASSERT (!node || node->isHTMLElement());96 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isHTMLElement()); 97 97 return static_cast<SliderThumbElement*>(node); 98 98 } -
trunk/Source/WebCore/html/shadow/TextControlInnerElements.h
r125866 r141516 134 134 inline InputFieldSpeechButtonElement* toInputFieldSpeechButtonElement(Element* element) 135 135 { 136 ASSERT (!element || element->isInputFieldSpeechButtonElement());136 ASSERT_WITH_SECURITY_IMPLICATION(!element || element->isInputFieldSpeechButtonElement()); 137 137 return static_cast<InputFieldSpeechButtonElement*>(element); 138 138 } -
trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.h
r130756 r141516 96 96 { 97 97 ASSERT(node); 98 ASSERT (node->isElementNode());99 ASSERT (static_cast<Element*>(node)->isTextFieldDecoration());98 ASSERT_WITH_SECURITY_IMPLICATION(node->isElementNode()); 99 ASSERT_WITH_SECURITY_IMPLICATION(static_cast<Element*>(node)->isTextFieldDecoration()); 100 100 return static_cast<TextFieldDecorationElement*>(node); 101 101 } -
trunk/Source/WebCore/html/track/WebVTTElement.h
r140231 r141516 52 52 inline WebVTTElement* toWebVTTElement(Node* node) 53 53 { 54 ASSERT (!node || node->isWebVTTElement());54 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isWebVTTElement()); 55 55 return static_cast<WebVTTElement*>(node); 56 56 } -
trunk/Source/WebCore/mathml/MathMLElement.h
r135069 r141516 55 55 inline MathMLElement* toMathMLElement(Node* node) 56 56 { 57 ASSERT (!node || (node->isElementNode() && static_cast<Element*>(node)->isMathMLElement()));57 ASSERT_WITH_SECURITY_IMPLICATION(!node || (node->isElementNode() && static_cast<Element*>(node)->isMathMLElement())); 58 58 return static_cast<MathMLElement*>(node); 59 59 } -
trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.h
r138076 r141516 73 73 inline ScrollingStateFixedNode* toScrollingStateFixedNode(ScrollingStateNode* node) 74 74 { 75 ASSERT (!node || node->isFixedNode());75 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isFixedNode()); 76 76 return static_cast<ScrollingStateFixedNode*>(node); 77 77 } -
trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h
r140223 r141516 162 162 inline ScrollingStateScrollingNode* toScrollingStateScrollingNode(ScrollingStateNode* node) 163 163 { 164 ASSERT (!node || node->isScrollingNode());164 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isScrollingNode()); 165 165 return static_cast<ScrollingStateScrollingNode*>(node); 166 166 } -
trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.h
r138076 r141516 73 73 inline ScrollingStateStickyNode* toScrollingStateStickyNode(ScrollingStateNode* node) 74 74 { 75 ASSERT (!node || node->isStickyNode());75 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isStickyNode()); 76 76 return static_cast<ScrollingStateStickyNode*>(node); 77 77 } -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r141278 r141516 2387 2387 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize; 2388 2388 2389 ASSERT (element->isStyledElement());2389 ASSERT_WITH_SECURITY_IMPLICATION(element->isStyledElement()); 2390 2390 StyledElement* styledElement = static_cast<StyledElement*>(element); 2391 2391 bool isBoxSizingBorder = renderer->style()->boxSizing() == BORDER_BOX; -
trunk/Source/WebCore/rendering/svg/SVGResources.cpp
r137463 r141516 180 180 { 181 181 ASSERT(element); 182 ASSERT (element->isStyled());182 ASSERT_WITH_SECURITY_IMPLICATION(element->isStyled()); 183 183 extensions->addPendingResource(id, static_cast<SVGStyledElement*>(element)); 184 184 } … … 191 191 Node* node = object->node(); 192 192 ASSERT(node); 193 ASSERT (node->isSVGElement());193 ASSERT_WITH_SECURITY_IMPLICATION(node->isSVGElement()); 194 194 195 195 SVGElement* element = static_cast<SVGElement*>(node); -
trunk/Source/WebCore/svg/SVGElement.h
r141277 r141516 171 171 inline SVGElement* toSVGElement(Element* element) 172 172 { 173 ASSERT (!element || element->isSVGElement());173 ASSERT_WITH_SECURITY_IMPLICATION(!element || element->isSVGElement()); 174 174 return static_cast<SVGElement*>(element); 175 175 } -
trunk/Source/WebCore/svg/SVGStyledElement.h
r140265 r141516 96 96 inline SVGStyledElement* toSVGStyledElement(Node* node) 97 97 { 98 ASSERT (!node || (node->isStyledElement() && node->isSVGElement()));98 ASSERT_WITH_SECURITY_IMPLICATION(!node || (node->isStyledElement() && node->isSVGElement())); 99 99 return static_cast<SVGStyledElement*>(node); 100 100 }
Note:
See TracChangeset
for help on using the changeset viewer.