Changeset 54527 in webkit
- Timestamp:
- Feb 8, 2010 10:48:48 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r54526 r54527 1 2010-02-08 Dominic Cooney <dominicc@google.com> 2 3 Reviewed by Adam Barth. 4 5 [V8] Move Element custom methods into generic bindings 6 7 This patch moves the security checks in setAttribute, 8 setAttributeNode, setAttributeNS and setAttributeNodeNS from 9 V8ElementCustom into the generic bindings so that they can be 10 reused in other bindings. This is in a similar vein to 11 <https://bugs.webkit.org/attachment.cgi?id=45872>. 12 13 https://bugs.webkit.org/show_bug.cgi?id=34554 14 15 LayoutTests: None 16 17 * WebCore.gypi: 18 * bindings/generic/BindingElement.h: Added. 19 (WebCore::::setAttribute): 20 (WebCore::::setAttributeNode): 21 (WebCore::::setAttributeNS): 22 (WebCore::::setAttributeNodeNS): 23 * bindings/v8/V8Binding.h: 24 * bindings/v8/custom/V8ElementCustom.cpp: 25 (WebCore::V8Element::setAttributeCallback): 26 (WebCore::V8Element::setAttributeNodeCallback): 27 (WebCore::V8Element::setAttributeNSCallback): 28 (WebCore::V8Element::setAttributeNodeNSCallback): 29 1 30 2010-02-08 Hayato Ito <hayato@chromium.org> 2 31 -
trunk/WebCore/WebCore.gypi
r54349 r54527 451 451 'accessibility/wx/AccessibilityObjectWx.cpp', 452 452 'bindings/generic/BindingDOMWindow.h', 453 'bindings/generic/BindingElement.h', 453 454 'bindings/generic/BindingSecurity.h', 454 455 'bindings/generic/BindingSecurityBase.cpp', -
trunk/WebCore/bindings/v8/V8Binding.h
r54038 r54527 33 33 34 34 #include "AtomicString.h" 35 #include "BindingElement.h" 35 36 #include "BindingSecurity.h" 36 37 #include "MathExtras.h" … … 54 55 }; 55 56 typedef BindingSecurity<V8Binding> V8BindingSecurity; 57 typedef BindingElement<V8Binding> V8BindingElement; 56 58 57 59 enum ExternalMode { -
trunk/WebCore/bindings/v8/custom/V8ElementCustom.cpp
r54349 r54527 59 59 String value = toWebCoreString(args[1]); 60 60 61 if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, name, value))62 return v8::Undefined();63 64 61 ExceptionCode ec = 0; 65 element->setAttribute(name, value, ec);62 V8BindingElement::setAttribute(V8BindingState::Only(), element, name, value, ec); 66 63 if (ec) 67 64 return throwError(ec); … … 79 76 Element* element = V8Element::toNative(args.Holder()); 80 77 81 if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, newAttr->name(), newAttr->value()))82 return v8::Undefined();83 84 78 ExceptionCode ec = 0; 85 RefPtr<Attr> result = element->setAttributeNode(newAttr, ec);79 RefPtr<Attr> result = V8BindingElement::setAttributeNode(V8BindingState::Only(), element, newAttr, ec); 86 80 if (ec) 87 81 throwError(ec); … … 98 92 String value = toWebCoreString(args[2]); 99 93 100 if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, qualifiedName, value))101 return v8::Undefined();102 103 94 ExceptionCode ec = 0; 104 element->setAttributeNS(namespaceURI, qualifiedName, value, ec);95 V8BindingElement::setAttributeNS(V8BindingState::Only(), element, namespaceURI, qualifiedName, value, ec); 105 96 if (ec) 106 97 throwError(ec); … … 118 109 Element* element = V8Element::toNative(args.Holder()); 119 110 120 if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, newAttr->name(), newAttr->value()))121 return v8::Undefined();122 123 111 ExceptionCode ec = 0; 124 RefPtr<Attr> result = element->setAttributeNodeNS(newAttr, ec);112 RefPtr<Attr> result = V8BindingElement::setAttributeNodeNS(V8BindingState::Only(), element, newAttr, ec); 125 113 if (ec) 126 114 throwError(ec);
Note: See TracChangeset
for help on using the changeset viewer.