Пример #1
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);
}
Пример #2
0
JSValue jsDOMParserConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSDOMParser* domObject = static_cast<JSDOMParser*>(asObject(slotBase));
    return JSDOMParser::getConstructor(exec, domObject->globalObject());
}