本文整理汇总了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();
}
}
示例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())));
}
示例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);
}
}
示例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;
}
}
}
}
示例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;
}
}
}
}