2010-05-25 Justin Schuh <jschuh@chromium.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 May 2010 08:53:35 +0000 (08:53 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 May 2010 08:53:35 +0000 (08:53 +0000)
        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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60148 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bindings/js/JSElementCustom.cpp
WebCore/bindings/v8/custom/V8ElementCustom.cpp
WebCore/dom/Element.idl

index 44cc08f4dbb9e2227fb3f78f899dbea26dc9ef5c..406940b14cba0b5f0e8fd8e27b9ced8f14218c43 100644 (file)
@@ -1,3 +1,19 @@
+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.
index 7e294bd24ce3956e8f2d24ef8dc9958bac0f3a66..23eda7e783a898d970bdc88546b966af3e103df2 100644 (file)
@@ -64,73 +64,6 @@ void JSElement::markChildren(MarkStack& markStack)
         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)
index 8256110d57ed028a0c36c02e8cd889e4354d0a19..3f6cd6afb9250dd5b1233e4b3a89319c54501a27 100644 (file)
 
 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)
index 977d15a703dec666dc56ed6bbcecef5dc53bf0d2..6bb068772f0f8c91f831937d8c18ed687608603a 100644 (file)
@@ -31,13 +31,13 @@ module core {
         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);
@@ -47,9 +47,9 @@ module core {
 
         [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)
@@ -58,7 +58,7 @@ module core {
                                                        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,