Example #1
0
JSValue* jsDOMParserPrototypeFunctionParseFromString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSDOMParser::s_info))
        return throwError(exec, TypeError);
    JSDOMParser* castedThisObj = static_cast<JSDOMParser*>(thisValue);
    DOMParser* imp = static_cast<DOMParser*>(castedThisObj->impl());
    const UString& str = args[0]->toString(exec);
    const UString& contentType = args[1]->toString(exec);


    KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->parseFromString(str, contentType)));
    return result;
}
Example #2
0
EncodedJSValue JSC_HOST_CALL jsDOMParserPrototypeFunctionParseFromString(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSDOMParser::s_info))
        return throwVMTypeError(exec);
    JSDOMParser* castedThis = static_cast<JSDOMParser*>(asObject(thisValue));
    DOMParser* imp = static_cast<DOMParser*>(castedThis->impl());
    const String& str(ustringToString(exec->argument(0).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    const String& contentType(ustringToString(exec->argument(1).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parseFromString(str, contentType)));
    return JSValue::encode(result);
}
Example #3
0
JSValue jsDOMParserConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSDOMParser* domObject = static_cast<JSDOMParser*>(asObject(slotBase));
    return JSDOMParser::getConstructor(exec, domObject->globalObject());
}