当前位置: 首页>>代码示例>>C++>>正文


C++ JSValue::isUndefinedOrNull方法代码示例

本文整理汇总了C++中jsc::JSValue::isUndefinedOrNull方法的典型用法代码示例。如果您正苦于以下问题:C++ JSValue::isUndefinedOrNull方法的具体用法?C++ JSValue::isUndefinedOrNull怎么用?C++ JSValue::isUndefinedOrNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jsc::JSValue的用法示例。


在下文中一共展示了JSValue::isUndefinedOrNull方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fillMessagePortArray

void fillMessagePortArray(JSC::ExecState* exec, JSC::JSValue value, MessagePortArray& portArray)
{
    // Convert from the passed-in JS array-like object to a MessagePortArray.
    // Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL spec and section 8.3.3 of the HTML5 spec.
    if (value.isUndefinedOrNull()) {
        portArray.resize(0);
        return;
    }

    // Validation of sequence types, per WebIDL spec 4.1.13.
    unsigned length;
    JSObject* object = toJSSequence(exec, value, length);
    if (exec->hadException())
        return;

    portArray.resize(length);
    for (unsigned i = 0 ; i < length; ++i) {
        JSValue value = object->get(exec, i);
        if (exec->hadException())
            return;
        // Validation of non-null objects, per HTML5 spec 8.3.3.
        if (value.isUndefinedOrNull()) {
            setDOMException(exec, INVALID_STATE_ERR);
            return;
        }

        // Validation of Objects implementing an interface, per WebIDL spec 4.1.15.
        RefPtr<MessagePort> port = toMessagePort(value);
        if (!port) {
            throwTypeError(exec);
            return;
        }
        portArray[i] = port.release();
    }
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:35,代码来源:JSMessagePortCustom.cpp

示例2: adoptRef

PassRefPtr<JSCustomXPathNSResolver> JSCustomXPathNSResolver::create(JSC::ExecState* exec, JSC::JSValue value)
{
    if (value.isUndefinedOrNull())
        return 0;

    JSObject* resolverObject = value.getObject();
    if (!resolverObject) {
        setDOMException(exec, TYPE_MISMATCH_ERR);
        return 0;
    }

    return adoptRef(new JSCustomXPathNSResolver(resolverObject, asJSDOMWindow(exec->dynamicGlobalObject())));
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:13,代码来源:JSCustomXPathNSResolver.cpp

示例3: selectIndexSetter

void selectIndexSetter(HTMLSelectElement* select, JSC::ExecState* exec, unsigned index, JSC::JSValue value)
{
    if (value.isUndefinedOrNull())
        select->removeByIndex(index);
    else {
        ExceptionCode ec = 0;
        HTMLOptionElement* option = toHTMLOptionElement(value);
        if (!option)
            ec = TYPE_MISMATCH_ERR;
        else
            select->setOption(index, option, ec);
        setDOMException(exec, ec);
    }
}
开发者ID:CannedFish,项目名称:webkit,代码行数:14,代码来源:JSHTMLSelectElementCustom.cpp

示例4: fillMessagePortArray

void fillMessagePortArray(JSC::ExecState* exec, JSC::JSValue value, MessagePortArray& portArray, ArrayBufferArray& arrayBuffers)
{
    // Convert from the passed-in JS array-like object to a MessagePortArray.
    // Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL spec and section 8.3.3 of the HTML5 spec.
    if (value.isUndefinedOrNull()) {
        portArray.resize(0);
        arrayBuffers.resize(0);
        return;
    }

    // Validation of sequence types, per WebIDL spec 4.1.13.
    unsigned length = 0;
    JSObject* object = toJSSequence(exec, value, length);
    if (exec->hadException())
        return;

    for (unsigned i = 0 ; i < length; ++i) {
        JSValue value = object->get(exec, i);
        if (exec->hadException())
            return;
        // Validation of non-null objects, per HTML5 spec 10.3.3.
        if (value.isUndefinedOrNull()) {
            setDOMException(exec, INVALID_STATE_ERR);
            return;
        }

        // Validation of Objects implementing an interface, per WebIDL spec 4.1.15.
        RefPtr<MessagePort> port = toMessagePort(value);
        if (port) {
            // Check for duplicate ports.
            if (portArray.contains(port)) {
#if MODIFY(ENGINE) //[2014.03.05][infraware][jungong16] : fix to issue. http://www.w3.org/TR/webmessaging/#dom-window-postmessage
                setDOMException(exec, DATA_CLONE_ERR);
#else
                setDOMException(exec, INVALID_STATE_ERR);
#endif
                return;
            }
            portArray.append(port.release());
        } else {
            RefPtr<ArrayBuffer> arrayBuffer = toArrayBuffer(value);
            if (arrayBuffer)
                arrayBuffers.append(arrayBuffer);
            else {
                throwTypeError(exec);
                return;
            }
        }
    }
}
开发者ID:highweb-project,项目名称:qplusweb,代码行数:50,代码来源:JSMessagePortCustom.cpp

示例5: fillMessagePortArray

void fillMessagePortArray(JSC::ExecState* exec, JSC::JSValue value, MessagePortArray& portArray, ArrayBufferArray& arrayBuffers)
{
    // Convert from the passed-in JS array-like object to a MessagePortArray.
    // Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL spec and section 8.3.3 of the HTML5 spec.
    if (value.isUndefinedOrNull()) {
        portArray.resize(0);
        arrayBuffers.resize(0);
        return;
    }

    // Validation of sequence types, per WebIDL spec 4.1.13.
    unsigned length = 0;
    JSObject* object = toJSSequence(exec, value, length);
    if (exec->hadException())
        return;

    for (unsigned i = 0 ; i < length; ++i) {
        JSValue value = object->get(exec, i);
        if (exec->hadException())
            return;
        // Validation of non-null objects, per HTML5 spec 10.3.3.
        if (value.isUndefinedOrNull()) {
            setDOMException(exec, INVALID_STATE_ERR);
            return;
        }

        // Validation of Objects implementing an interface, per WebIDL spec 4.1.15.
        RefPtr<MessagePort> port = JSMessagePort::toWrapped(value);
        if (port) {
            // Check for duplicate ports.
            if (portArray.contains(port)) {
                setDOMException(exec, INVALID_STATE_ERR);
                return;
            }
            portArray.append(port.release());
        } else {
            RefPtr<ArrayBuffer> arrayBuffer = toArrayBuffer(value);
            if (arrayBuffer)
                arrayBuffers.append(arrayBuffer);
            else {
                throwTypeError(exec);
                return;
            }
        }
    }
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:46,代码来源:JSMessagePortCustom.cpp


注:本文中的jsc::JSValue::isUndefinedOrNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。