本文整理汇总了C++中JSTestEventTarget类的典型用法代码示例。如果您正苦于以下问题:C++ JSTestEventTarget类的具体用法?C++ JSTestEventTarget怎么用?C++ JSTestEventTarget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSTestEventTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsTestEventTargetConstructor
EncodedJSValue jsTestEventTargetConstructor(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
{
JSTestEventTarget* domObject = jsDynamicCast<JSTestEventTarget*>(JSValue::decode(slotBase));
if (!domObject)
return throwVMTypeError(exec);
return JSValue::encode(JSTestEventTarget::getConstructor(exec->vm(), domObject->globalObject()));
}
示例2: finalize
void JSTestEventTargetOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
JSTestEventTarget* jsTestEventTarget = jsCast<JSTestEventTarget*>(handle.get().asCell());
DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, jsTestEventTarget->impl(), jsTestEventTarget);
jsTestEventTarget->releaseImpl();
}
示例3: ASSERT_GC_OBJECT_INHERITS
bool JSTestEventTarget::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
{
JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(object);
ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
const HashEntry* entry = JSTestEventTargetTable.entry(exec, propertyName);
if (entry) {
PropertySlot slot(thisObject);
slot.setCustom(thisObject, entry->propertyGetter());
descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
return true;
}
unsigned index = propertyName.asIndex();
if (index != PropertyName::NotAnIndex && index < static_cast<TestEventTarget*>(thisObject->impl())->length()) {
PropertySlot slot(thisObject);
slot.setCustomIndex(thisObject, index, indexGetter);
descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
return true;
}
if (canGetItemsForName(exec, static_cast<TestEventTarget*>(thisObject->impl()), propertyName)) {
PropertySlot slot(thisObject);
slot.setCustom(thisObject, nameGetter);
descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);
return true;
}
return getStaticValueDescriptor<JSTestEventTarget, Base>(exec, &JSTestEventTargetTable, thisObject, propertyName, descriptor);
}
示例4: jsTestEventTargetConstructor
EncodedJSValue jsTestEventTargetConstructor(ExecState* state, JSObject*, EncodedJSValue thisValue, PropertyName)
{
JSTestEventTarget* domObject = jsDynamicCast<JSTestEventTarget*>(JSValue::decode(thisValue));
if (!domObject)
return throwVMTypeError(state);
return JSValue::encode(JSTestEventTarget::getConstructor(state->vm(), domObject->globalObject()));
}
示例5: visitChildren
void JSTestEventTarget::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
Base::visitChildren(thisObject, visitor);
thisObject->impl().visitJSEventListeners(visitor);
}
示例6: isReachableFromOpaqueRoots
bool JSTestEventTargetOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
JSTestEventTarget* jsTestEventTarget = jsCast<JSTestEventTarget*>(handle.get().asCell());
if (jsTestEventTarget->impl().isFiringEventListeners())
return true;
UNUSED_PARAM(visitor);
return false;
}
示例7: getOwnPropertyNames
void JSTestEventTarget::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(object);
ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
for (unsigned i = 0; i < static_cast<TestEventTarget*>(thisObject->impl())->length(); ++i)
propertyNames.add(Identifier::from(exec, i));
Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
}
示例8: visitChildren
void JSTestEventTarget::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
Base::visitChildren(thisObject, visitor);
thisObject->impl()->visitJSEventListeners(visitor);
}
示例9: jsTestEventTargetConstructor
EncodedJSValue jsTestEventTargetConstructor(ExecState* exec, JSObject* baseValue, EncodedJSValue thisValue, PropertyName)
{
UNUSED_PARAM(baseValue);
UNUSED_PARAM(thisValue);
JSTestEventTarget* domObject = jsDynamicCast<JSTestEventTarget*>(JSValue::decode(thisValue));
if (!domObject)
return throwVMTypeError(exec);
return JSValue::encode(JSTestEventTarget::getConstructor(exec->vm(), domObject->globalObject()));
}
示例10: getOwnPropertySlotByIndex
bool JSTestEventTarget::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
{
JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
if (propertyName < static_cast<TestEventTarget*>(thisObject->impl())->length()) {
slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter);
return true;
}
return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);
}
示例11: jsTestEventTargetPrototypeFunctionRemoveEventListener
EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionRemoveEventListener(ExecState* exec)
{
JSValue thisValue = exec->thisValue();
JSTestEventTarget* castedThis = jsDynamicCast<JSTestEventTarget*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*exec, "TestEventTarget", "removeEventListener");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestEventTarget::info());
auto& impl = castedThis->impl();
JSValue listener = exec->argument(1);
if (UNLIKELY(!listener.isObject()))
return JSValue::encode(jsUndefined());
impl.removeEventListener(exec->argument(0).toString(exec)->toAtomicString(exec), createJSEventListenerForRemove(*exec, *asObject(listener), *castedThis).ptr(), exec->argument(2).toBoolean(exec));
return JSValue::encode(jsUndefined());
}
示例12: jsTestEventTargetPrototypeFunctionAddEventListener
EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionAddEventListener(ExecState* state)
{
JSValue thisValue = state->thisValue();
JSTestEventTarget* castedThis = jsDynamicCast<JSTestEventTarget*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, "TestEventTarget", "addEventListener");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestEventTarget::info());
auto& impl = castedThis->wrapped();
JSValue listener = state->argument(1);
if (UNLIKELY(!listener.isObject()))
return JSValue::encode(jsUndefined());
impl.addEventListener(state->argument(0).toString(state)->toAtomicString(state), createJSEventListenerForAdd(*state, *asObject(listener), *castedThis), state->argument(2).toBoolean(state));
return JSValue::encode(jsUndefined());
}
示例13: jsTestEventTargetPrototypeFunctionRemoveEventListener
EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionRemoveEventListener(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSTestEventTarget* castedThis = jsDynamicCast<JSTestEventTarget*>(thisValue);
if (UNLIKELY(!castedThis))
return throwVMTypeError(exec, makeDOMBindingsTypeErrorString("Can only call ", "TestEventTarget", ".", "removeEventListener", " on instances of ", "TestEventTarget"));
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestEventTarget::info());
TestEventTarget& impl = castedThis->impl();
JSValue listener = exec->argument(1);
if (!listener.isObject())
return JSValue::encode(jsUndefined());
impl.removeEventListener(exec->argument(0).toString(exec)->value(exec), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec));
return JSValue::encode(jsUndefined());
}
示例14: jsTestEventTargetPrototypeFunctionAddEventListener
EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionAddEventListener(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSTestEventTarget* castedThis = jsDynamicCast<JSTestEventTarget*>(thisValue);
if (!castedThis)
return throwVMTypeError(exec);
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestEventTarget::info());
TestEventTarget& impl = castedThis->impl();
JSValue listener = exec->argument(1);
if (!listener.isObject())
return JSValue::encode(jsUndefined());
impl.addEventListener(exec->argument(0).toString(exec)->value(exec), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec));
return JSValue::encode(jsUndefined());
}
示例15: jsTestEventTargetPrototypeFunctionRemoveEventListener
EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionRemoveEventListener(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestEventTarget::s_info))
return throwVMTypeError(exec);
JSTestEventTarget* castedThis = jsCast<JSTestEventTarget*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestEventTarget::s_info);
TestEventTarget* impl = static_cast<TestEventTarget*>(castedThis->impl());
JSValue listener = exec->argument(1);
if (!listener.isObject())
return JSValue::encode(jsUndefined());
impl->removeEventListener(exec->argument(0).toString(exec)->value(exec), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec));
return JSValue::encode(jsUndefined());
}