Esempio n. 1
0
JSValue* jsXMLSerializerPrototypeFunctionSerializeToString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSXMLSerializer::s_info))
        return throwError(exec, TypeError);
    JSXMLSerializer* castedThisObj = static_cast<JSXMLSerializer*>(thisValue);
    XMLSerializer* imp = static_cast<XMLSerializer*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    Node* node = toNode(args[0]);


    KJS::JSValue* result = jsString(exec, imp->serializeToString(node, ec));
    setDOMException(exec, ec);
    return result;
}
EncodedJSValue JSC_HOST_CALL jsXMLSerializerPrototypeFunctionSerializeToString(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXMLSerializer::s_info))
        return throwVMTypeError(exec);
    JSXMLSerializer* castedThis = static_cast<JSXMLSerializer*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSXMLSerializer::s_info);
    XMLSerializer* imp = static_cast<XMLSerializer*>(castedThis->impl());
    ExceptionCode ec = 0;
    Node* node(toNode(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = jsString(exec, imp->serializeToString(node, ec));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}