void JSTestActiveDOMObjectOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { JSTestActiveDOMObject* jsTestActiveDOMObject = jsCast<JSTestActiveDOMObject*>(handle.slot()->asCell()); DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, &jsTestActiveDOMObject->impl(), jsTestActiveDOMObject); jsTestActiveDOMObject->releaseImpl(); }
JSValue jsTestActiveDOMObjectConstructor(ExecState* exec, JSValue slotBase, PropertyName) { JSTestActiveDOMObject* domObject = jsCast<JSTestActiveDOMObject*>(asObject(slotBase)); if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, domObject->impl())) return jsUndefined(); return JSTestActiveDOMObject::getConstructor(exec, domObject->globalObject()); }
bool JSTestActiveDOMObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSTestActiveDOMObject* thisObject = jsCast<JSTestActiveDOMObject*>(object); ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); if (!shouldAllowAccessToFrame(exec, thisObject->impl()->frame())) return false; return getStaticValueDescriptor<JSTestActiveDOMObject, Base>(exec, &JSTestActiveDOMObjectTable, thisObject, propertyName, descriptor); }
EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionExcitingFunction(ExecState* state) { JSValue thisValue = state->thisValue(); JSTestActiveDOMObject* castedThis = jsDynamicCast<JSTestActiveDOMObject*>(thisValue); if (UNLIKELY(!castedThis)) return throwThisTypeError(*state, "TestActiveDOMObject", "excitingFunction"); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestActiveDOMObject::info()); if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, castedThis->impl())) return JSValue::encode(jsUndefined()); auto& impl = castedThis->impl(); if (UNLIKELY(state->argumentCount() < 1)) return throwVMError(state, createNotEnoughArgumentsError(state)); Node* nextChild = JSNode::toWrapped(state->argument(0)); if (UNLIKELY(state->hadException())) return JSValue::encode(jsUndefined()); impl.excitingFunction(nextChild); return JSValue::encode(jsUndefined()); }
EncodedJSValue jsTestActiveDOMObjectConstructor(ExecState* state, JSObject*, EncodedJSValue thisValue, PropertyName) { JSTestActiveDOMObject* domObject = jsDynamicCast<JSTestActiveDOMObject*>(JSValue::decode(thisValue)); if (!domObject) return throwVMTypeError(state); if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, domObject->impl())) return JSValue::encode(jsUndefined()); return JSValue::encode(JSTestActiveDOMObject::getConstructor(state->vm(), domObject->globalObject())); }
EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionExcitingFunction(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestActiveDOMObject::s_info)) return throwVMTypeError(exec); JSTestActiveDOMObject* castedThis = jsCast<JSTestActiveDOMObject*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestActiveDOMObject::s_info); if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, castedThis->impl())) return JSValue::encode(jsUndefined()); TestActiveDOMObject* impl = static_cast<TestActiveDOMObject*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); Node* nextChild(toNode(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl->excitingFunction(nextChild); return JSValue::encode(jsUndefined()); }
EncodedJSValue jsTestActiveDOMObjectExcitingAttr(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName) { JSTestActiveDOMObject* castedThis = jsDynamicCast<JSTestActiveDOMObject*>(JSValue::decode(thisValue)); UNUSED_PARAM(slotBase); if (UNLIKELY(!castedThis)) { if (jsDynamicCast<JSTestActiveDOMObjectPrototype*>(slotBase)) { ScriptExecutionContext* scriptExecutionContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); scriptExecutionContext->addConsoleMessage(MessageSource::JS, MessageLevel::Error, String("Deprecated attempt to access property 'excitingAttr' on a non-TestActiveDOMObject object.")); return JSValue::encode(jsUndefined()); } return throwVMTypeError(exec); } if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, castedThis->impl())) return JSValue::encode(jsUndefined()); UNUSED_PARAM(exec); TestActiveDOMObject& impl = castedThis->impl(); JSValue result = jsNumber(impl.excitingAttr()); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionPostMessage(ExecState* state) { JSValue thisValue = state->thisValue(); JSTestActiveDOMObject* castedThis = jsDynamicCast<JSTestActiveDOMObject*>(thisValue); if (UNLIKELY(!castedThis)) return throwThisTypeError(*state, "TestActiveDOMObject", "postMessage"); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestActiveDOMObject::info()); auto& impl = castedThis->impl(); if (UNLIKELY(state->argumentCount() < 1)) return throwVMError(state, createNotEnoughArgumentsError(state)); String message = state->argument(0).toString(state)->value(state); if (UNLIKELY(state->hadException())) return JSValue::encode(jsUndefined()); impl.postMessage(message); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionPostMessage(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestActiveDOMObject::s_info)) return throwVMTypeError(exec); JSTestActiveDOMObject* castedThis = jsCast<JSTestActiveDOMObject*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestActiveDOMObject::s_info); TestActiveDOMObject* impl = static_cast<TestActiveDOMObject*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); const String& message(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl->postMessage(message); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionPostMessage(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSTestActiveDOMObject* castedThis = jsDynamicCast<JSTestActiveDOMObject*>(thisValue); if (UNLIKELY(!castedThis)) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestActiveDOMObject::info()); TestActiveDOMObject& impl = castedThis->impl(); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); const String& message(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec)); if (UNLIKELY(exec->hadException())) return JSValue::encode(jsUndefined()); impl.postMessage(message); return JSValue::encode(jsUndefined()); }