Пример #1
0
JSValue* JSNodeIteratorPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
    if (!thisObj->inherits(&JSNodeIterator::info))
      return throwError(exec, TypeError);

    NodeIterator* imp = static_cast<NodeIterator*>(static_cast<JSNodeIterator*>(thisObj)->impl());

    switch (id) {
    case JSNodeIterator::NextNodeFuncNum: {
        ExceptionCode ec = 0;


        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->nextNode(ec)));
        setDOMException(exec, ec);
        return result;
    }
    case JSNodeIterator::PreviousNodeFuncNum: {
        ExceptionCode ec = 0;


        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->previousNode(ec)));
        setDOMException(exec, ec);
        return result;
    }
    case JSNodeIterator::DetachFuncNum: {

        imp->detach();
        return jsUndefined();
    }
    }
    return 0;
}
Пример #2
0
JSValue* jsNodeIteratorPrototypeFunctionDetach(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSNodeIterator::s_info))
        return throwError(exec, TypeError);
    JSNodeIterator* castedThisObj = static_cast<JSNodeIterator*>(thisValue);
    NodeIterator* imp = static_cast<NodeIterator*>(castedThisObj->impl());

    imp->detach();
    return jsUndefined();
}
Пример #3
0
JSValue JSC_HOST_CALL jsNodeIteratorPrototypeFunctionDetach(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.isObject(&JSNodeIterator::s_info))
        return throwError(exec, TypeError);
    JSNodeIterator* castedThisObj = static_cast<JSNodeIterator*>(asObject(thisValue));
    NodeIterator* imp = static_cast<NodeIterator*>(castedThisObj->impl());

    imp->detach();
    return jsUndefined();
}
Пример #4
0
EncodedJSValue JSC_HOST_CALL jsNodeIteratorPrototypeFunctionDetach(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSNodeIterator::s_info))
        return throwVMTypeError(exec);
    JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNodeIterator::s_info);
    NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl());

    imp->detach();
    return JSValue::encode(jsUndefined());
}