JSValue JSNamedNodeMap::setNamedItemNS(ExecState* exec, const ArgList& args)
{
    NamedNodeMap* imp = static_cast<NamedNodeMap*>(impl());
    ExceptionCode ec = 0;
    Node* newNode = toNode(args.at(0));

    if (newNode && newNode->nodeType() == Node::ATTRIBUTE_NODE && imp->element()) {
        if (!allowSettingSrcToJavascriptURL(exec, imp->element(), newNode->nodeName(), newNode->nodeValue()))
            return jsNull();
    }

    JSValue result = toJS(exec, globalObject(), WTF::getPtr(imp->setNamedItemNS(newNode, ec)));
    setDOMException(exec, ec);
    return result;
}
示例#2
0
JSValue JSC_HOST_CALL jsNamedNodeMapPrototypeFunctionSetNamedItemNS(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.isObject(&JSNamedNodeMap::s_info))
        return throwError(exec, TypeError);
    JSNamedNodeMap* castedThisObj = static_cast<JSNamedNodeMap*>(asObject(thisValue));
    NamedNodeMap* imp = static_cast<NamedNodeMap*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    Node* node = toNode(args.at(0));


    JSC::JSValue result = toJS(exec, WTF::getPtr(imp->setNamedItemNS(node, ec)));
    setDOMException(exec, ec);
    return result;
}
示例#3
0
EncodedJSValue JSC_HOST_CALL jsNamedNodeMapPrototypeFunctionSetNamedItemNS(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSNamedNodeMap::s_info))
        return throwVMTypeError(exec);
    JSNamedNodeMap* castedThis = static_cast<JSNamedNodeMap*>(asObject(thisValue));
    NamedNodeMap* imp = static_cast<NamedNodeMap*>(castedThis->impl());
    ExceptionCode ec = 0;
    Node* node(toNode(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->setNamedItemNS(node, ec)));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}