+2010-05-25 Justin Schuh <jschuh@chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ Remove custom bindings for Element.SetAttribute*
+ https://bugs.webkit.org/show_bug.cgi?id=39604
+
+ Custom bindings are no longer needed because origin checks were moved
+ out of the bindings by: http://trac.webkit.org/changeset/59866
+
+ Behavior isn't changed and is covered by existing tests.
+
+ * bindings/js/JSElementCustom.cpp:
+ * bindings/v8/custom/V8ElementCustom.cpp:
+ * dom/Element.idl:
+
2010-05-25 Yury Semikhatsky <yurys@chromium.org>
Reviewed by Pavel Feldman.
markDOMObjectWrapper(markStack, globalData, static_cast<StyledElement*>(element)->inlineStyleDecl());
}
-JSValue JSElement::setAttribute(ExecState* exec, const ArgList& args)
-{
- ExceptionCode ec = 0;
- AtomicString name = ustringToAtomicString(args.at(0).toString(exec));
- AtomicString value = ustringToAtomicString(args.at(1).toString(exec));
-
- Element* imp = impl();
- if (!allowSettingSrcToJavascriptURL(exec, imp, name, value))
- return jsUndefined();
-
- imp->setAttribute(name, value, ec);
- setDOMException(exec, ec);
- return jsUndefined();
-}
-
-JSValue JSElement::setAttributeNode(ExecState* exec, const ArgList& args)
-{
- ExceptionCode ec = 0;
- Attr* newAttr = toAttr(args.at(0));
- if (!newAttr) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- Element* imp = impl();
- if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value()))
- return jsUndefined();
-
- JSValue result = toJS(exec, globalObject(), WTF::getPtr(imp->setAttributeNode(newAttr, ec)));
- setDOMException(exec, ec);
- return result;
-}
-
-JSValue JSElement::setAttributeNS(ExecState* exec, const ArgList& args)
-{
- ExceptionCode ec = 0;
- AtomicString namespaceURI = valueToStringWithNullCheck(exec, args.at(0));
- AtomicString qualifiedName = ustringToAtomicString(args.at(1).toString(exec));
- AtomicString value = ustringToAtomicString(args.at(2).toString(exec));
-
- Element* imp = impl();
- if (!allowSettingSrcToJavascriptURL(exec, imp, qualifiedName, value))
- return jsUndefined();
-
- imp->setAttributeNS(namespaceURI, qualifiedName, value, ec);
- setDOMException(exec, ec);
- return jsUndefined();
-}
-
-JSValue JSElement::setAttributeNodeNS(ExecState* exec, const ArgList& args)
-{
- ExceptionCode ec = 0;
- Attr* newAttr = toAttr(args.at(0));
- if (!newAttr) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- Element* imp = impl();
- if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value()))
- return jsUndefined();
-
- JSValue result = toJS(exec, globalObject(), WTF::getPtr(imp->setAttributeNodeNS(newAttr, ec)));
- setDOMException(exec, ec);
- return result;
-}
-
JSValue toJSNewlyCreated(ExecState* exec, JSDOMGlobalObject* globalObject, Element* element)
{
if (!element)
namespace WebCore {
-v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Element.setAttribute()");
- Element* element = V8Element::toNative(args.Holder());
- String name = toWebCoreString(args[0]);
- String value = toWebCoreString(args[1]);
-
- ExceptionCode ec = 0;
- V8BindingElement::setAttribute(V8BindingState::Only(), element, name, value, ec);
- if (ec)
- return throwError(ec);
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Element.setAttributeNode()");
- if (!V8Attr::HasInstance(args[0]))
- return throwError(TYPE_MISMATCH_ERR);
-
- Attr* newAttr = V8Attr::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- Element* element = V8Element::toNative(args.Holder());
-
- ExceptionCode ec = 0;
- RefPtr<Attr> result = V8BindingElement::setAttributeNode(V8BindingState::Only(), element, newAttr, ec);
- if (ec)
- throwError(ec);
-
- return toV8(result.release());
-}
-
-v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Element.setAttributeNS()");
- Element* element = V8Element::toNative(args.Holder());
- String namespaceURI = toWebCoreStringWithNullCheck(args[0]);
- String qualifiedName = toWebCoreString(args[1]);
- String value = toWebCoreString(args[2]);
-
- ExceptionCode ec = 0;
- V8BindingElement::setAttributeNS(V8BindingState::Only(), element, namespaceURI, qualifiedName, value, ec);
- if (ec)
- throwError(ec);
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Element.setAttributeNodeNS()");
- if (!V8Attr::HasInstance(args[0]))
- return throwError(TYPE_MISMATCH_ERR);
-
- Attr* newAttr = V8Attr::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- Element* element = V8Element::toNative(args.Holder());
-
- ExceptionCode ec = 0;
- RefPtr<Attr> result = V8BindingElement::setAttributeNodeNS(V8BindingState::Only(), element, newAttr, ec);
- if (ec)
- throwError(ec);
-
- return toV8(result.release());
-}
-
v8::Handle<v8::Value> toV8(Element* impl, bool forceNewObject)
{
if (!impl)
readonly attribute [ConvertNullStringTo=Null] DOMString tagName;
[ConvertNullStringTo=Null] DOMString getAttribute(in DOMString name);
- [OldStyleObjC, Custom] void setAttribute(in DOMString name,
- in DOMString value)
+ [OldStyleObjC] void setAttribute(in DOMString name,
+ in DOMString value)
raises(DOMException);
void removeAttribute(in DOMString name)
raises(DOMException);
Attr getAttributeNode(in DOMString name);
- [Custom] Attr setAttributeNode(in Attr newAttr)
+ Attr setAttributeNode(in Attr newAttr)
raises(DOMException);
Attr removeAttributeNode(in Attr oldAttr)
raises(DOMException);
[OldStyleObjC] DOMString getAttributeNS(in [ConvertNullToNullString] DOMString namespaceURI,
in DOMString localName);
- [OldStyleObjC, Custom] void setAttributeNS(in [ConvertNullToNullString] DOMString namespaceURI,
- in DOMString qualifiedName,
- in DOMString value)
+ [OldStyleObjC] void setAttributeNS(in [ConvertNullToNullString] DOMString namespaceURI,
+ in DOMString qualifiedName,
+ in DOMString value)
raises(DOMException);
[OldStyleObjC] void removeAttributeNS(in [ConvertNullToNullString] DOMString namespaceURI,
in DOMString localName)
in DOMString localName);
[OldStyleObjC] Attr getAttributeNodeNS(in [ConvertNullToNullString] DOMString namespaceURI,
in DOMString localName);
- [Custom] Attr setAttributeNodeNS(in Attr newAttr)
+ Attr setAttributeNodeNS(in Attr newAttr)
raises(DOMException);
boolean hasAttribute(in DOMString name);
[OldStyleObjC] boolean hasAttributeNS(in [ConvertNullToNullString] DOMString namespaceURI,