| // Copyright 2017 Google Inc. All Rights Reserved. |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| // clang-format off |
| |
| // This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY! |
| // Auto-generated from template: bindings/mozjs/templates/interface.cc.template |
| |
| #include "cobalt/bindings/testing/mozjs_numeric_types_test_interface.h" |
| |
| #include "base/debug/trace_event.h" |
| #include "cobalt/base/polymorphic_downcast.h" |
| #include "cobalt/script/global_environment.h" |
| #include "cobalt/script/opaque_handle.h" |
| #include "cobalt/script/script_value.h" |
| |
| #include "mozjs_gen_type_conversion.h" |
| |
| #include "base/lazy_instance.h" |
| #include "cobalt/script/exception_state.h" |
| #include "cobalt/script/mozjs/callback_function_conversion.h" |
| #include "cobalt/script/mozjs/conversion_helpers.h" |
| #include "cobalt/script/mozjs/mozjs_callback_function.h" |
| #include "cobalt/script/mozjs/mozjs_exception_state.h" |
| #include "cobalt/script/mozjs/mozjs_global_environment.h" |
| #include "cobalt/script/mozjs/mozjs_object_handle.h" |
| #include "cobalt/script/mozjs/mozjs_property_enumerator.h" |
| #include "cobalt/script/mozjs/mozjs_user_object_holder.h" |
| #include "cobalt/script/mozjs/mozjs_value_handle.h" |
| #include "cobalt/script/mozjs/native_promise.h" |
| #include "cobalt/script/mozjs/proxy_handler.h" |
| #include "cobalt/script/mozjs/type_traits.h" |
| #include "cobalt/script/mozjs/wrapper_factory.h" |
| #include "cobalt/script/mozjs/wrapper_private.h" |
| #include "cobalt/script/property_enumerator.h" |
| #include "cobalt/script/sequence.h" |
| #include "third_party/mozjs/js/src/jsapi.h" |
| #include "third_party/mozjs/js/src/jsfriendapi.h" |
| |
| namespace { |
| using cobalt::bindings::testing::NumericTypesTestInterface; |
| using cobalt::bindings::testing::MozjsNumericTypesTestInterface; |
| using cobalt::script::CallbackInterfaceTraits; |
| using cobalt::script::GlobalEnvironment; |
| using cobalt::script::OpaqueHandle; |
| using cobalt::script::OpaqueHandleHolder; |
| using cobalt::script::ScriptValue; |
| using cobalt::script::ValueHandle; |
| using cobalt::script::Wrappable; |
| |
| using cobalt::script::CallbackFunction; |
| using cobalt::script::CallbackInterfaceTraits; |
| using cobalt::script::ExceptionState; |
| using cobalt::script::Wrappable; |
| using cobalt::script::mozjs::FromJSValue; |
| using cobalt::script::mozjs::InterfaceData; |
| using cobalt::script::mozjs::MozjsCallbackFunction; |
| using cobalt::script::mozjs::MozjsExceptionState; |
| using cobalt::script::mozjs::MozjsGlobalEnvironment; |
| using cobalt::script::mozjs::MozjsPropertyEnumerator; |
| using cobalt::script::mozjs::MozjsUserObjectHolder; |
| using cobalt::script::mozjs::ProxyHandler; |
| using cobalt::script::mozjs::ToJSValue; |
| using cobalt::script::mozjs::TypeTraits; |
| using cobalt::script::mozjs::WrapperFactory; |
| using cobalt::script::mozjs::WrapperPrivate; |
| using cobalt::script::mozjs::kConversionFlagClamped; |
| using cobalt::script::mozjs::kConversionFlagNullable; |
| using cobalt::script::mozjs::kConversionFlagRestricted; |
| using cobalt::script::mozjs::kConversionFlagTreatNullAsEmptyString; |
| using cobalt::script::mozjs::kConversionFlagTreatUndefinedAsEmptyString; |
| using cobalt::script::mozjs::kNoConversionFlags; |
| } // namespace |
| |
| namespace cobalt { |
| namespace bindings { |
| namespace testing { |
| |
| namespace { |
| |
| class MozjsNumericTypesTestInterfaceHandler : public ProxyHandler { |
| public: |
| MozjsNumericTypesTestInterfaceHandler() |
| : ProxyHandler(indexed_property_hooks, named_property_hooks) {} |
| |
| private: |
| static NamedPropertyHooks named_property_hooks; |
| static IndexedPropertyHooks indexed_property_hooks; |
| }; |
| |
| ProxyHandler::NamedPropertyHooks |
| MozjsNumericTypesTestInterfaceHandler::named_property_hooks = { |
| NULL, |
| NULL, |
| NULL, |
| NULL, |
| NULL, |
| }; |
| ProxyHandler::IndexedPropertyHooks |
| MozjsNumericTypesTestInterfaceHandler::indexed_property_hooks = { |
| NULL, |
| NULL, |
| NULL, |
| NULL, |
| NULL, |
| }; |
| |
| static base::LazyInstance<MozjsNumericTypesTestInterfaceHandler> |
| proxy_handler; |
| |
| JSBool HasInstance(JSContext *context, JS::HandleObject type, |
| JS::MutableHandleValue vp, JSBool *success) { |
| JS::RootedObject global_object( |
| context, JS_GetGlobalForObject(context, type)); |
| DCHECK(global_object); |
| |
| JS::RootedObject prototype( |
| context, MozjsNumericTypesTestInterface::GetPrototype(context, global_object)); |
| |
| // |IsDelegate| walks the prototype chain of an object returning true if |
| // .prototype is found. |
| bool is_delegate; |
| if (!IsDelegate(context, prototype, vp, &is_delegate)) { |
| *success = false; |
| return false; |
| } |
| |
| *success = is_delegate; |
| return true; |
| } |
| |
| InterfaceData* CreateCachedInterfaceData() { |
| InterfaceData* interface_data = new InterfaceData(); |
| memset(&interface_data->instance_class_definition, 0, |
| sizeof(interface_data->instance_class_definition)); |
| memset(&interface_data->prototype_class_definition, 0, |
| sizeof(interface_data->prototype_class_definition)); |
| memset(&interface_data->interface_object_class_definition, 0, |
| sizeof(interface_data->interface_object_class_definition)); |
| |
| JSClass* instance_class = &interface_data->instance_class_definition; |
| const int kGlobalFlags = 0; |
| instance_class->name = "NumericTypesTestInterface"; |
| instance_class->flags = kGlobalFlags | JSCLASS_HAS_PRIVATE; |
| instance_class->addProperty = JS_PropertyStub; |
| instance_class->delProperty = JS_DeletePropertyStub; |
| instance_class->getProperty = JS_PropertyStub; |
| instance_class->setProperty = JS_StrictPropertyStub; |
| instance_class->enumerate = JS_EnumerateStub; |
| instance_class->resolve = JS_ResolveStub; |
| instance_class->convert = JS_ConvertStub; |
| // Function to be called before on object of this class is garbage collected. |
| instance_class->finalize = &WrapperPrivate::Finalizer; |
| // Called to trace objects that can be referenced from this object. |
| instance_class->trace = &WrapperPrivate::Trace; |
| |
| JSClass* prototype_class = &interface_data->prototype_class_definition; |
| prototype_class->name = "NumericTypesTestInterfacePrototype"; |
| prototype_class->flags = 0; |
| prototype_class->addProperty = JS_PropertyStub; |
| prototype_class->delProperty = JS_DeletePropertyStub; |
| prototype_class->getProperty = JS_PropertyStub; |
| prototype_class->setProperty = JS_StrictPropertyStub; |
| prototype_class->enumerate = JS_EnumerateStub; |
| prototype_class->resolve = JS_ResolveStub; |
| prototype_class->convert = JS_ConvertStub; |
| |
| JSClass* interface_object_class = |
| &interface_data->interface_object_class_definition; |
| interface_object_class->name = "NumericTypesTestInterfaceConstructor"; |
| interface_object_class->flags = 0; |
| interface_object_class->addProperty = JS_PropertyStub; |
| interface_object_class->delProperty = JS_DeletePropertyStub; |
| interface_object_class->getProperty = JS_PropertyStub; |
| interface_object_class->setProperty = JS_StrictPropertyStub; |
| interface_object_class->enumerate = JS_EnumerateStub; |
| interface_object_class->resolve = JS_ResolveStub; |
| interface_object_class->convert = JS_ConvertStub; |
| interface_object_class->hasInstance = &HasInstance; |
| return interface_data; |
| } |
| |
| JSBool get_byteProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->byte_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_byteProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<int8_t >::ConversionType value; |
| FromJSValue(context, vp, kNoConversionFlags, &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_byte_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_byteClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->byte_clamp_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_byteClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<int8_t >::ConversionType value; |
| FromJSValue(context, vp, (kConversionFlagClamped), &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_byte_clamp_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_octetProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->octet_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_octetProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<uint8_t >::ConversionType value; |
| FromJSValue(context, vp, kNoConversionFlags, &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_octet_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_octetClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->octet_clamp_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_octetClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<uint8_t >::ConversionType value; |
| FromJSValue(context, vp, (kConversionFlagClamped), &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_octet_clamp_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_shortProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->short_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_shortProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<int16_t >::ConversionType value; |
| FromJSValue(context, vp, kNoConversionFlags, &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_short_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_shortClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->short_clamp_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_shortClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<int16_t >::ConversionType value; |
| FromJSValue(context, vp, (kConversionFlagClamped), &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_short_clamp_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_unsignedShortProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->unsigned_short_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_unsignedShortProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<uint16_t >::ConversionType value; |
| FromJSValue(context, vp, kNoConversionFlags, &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_unsigned_short_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_unsignedShortClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->unsigned_short_clamp_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_unsignedShortClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<uint16_t >::ConversionType value; |
| FromJSValue(context, vp, (kConversionFlagClamped), &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_unsigned_short_clamp_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_longProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->long_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_longProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<int32_t >::ConversionType value; |
| FromJSValue(context, vp, kNoConversionFlags, &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_long_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_longClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->long_clamp_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_longClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<int32_t >::ConversionType value; |
| FromJSValue(context, vp, (kConversionFlagClamped), &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_long_clamp_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_unsignedLongProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->unsigned_long_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_unsignedLongProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<uint32_t >::ConversionType value; |
| FromJSValue(context, vp, kNoConversionFlags, &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_unsigned_long_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_unsignedLongClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->unsigned_long_clamp_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_unsignedLongClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<uint32_t >::ConversionType value; |
| FromJSValue(context, vp, (kConversionFlagClamped), &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_unsigned_long_clamp_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_longLongProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->long_long_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_longLongProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<int64_t >::ConversionType value; |
| FromJSValue(context, vp, kNoConversionFlags, &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_long_long_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_longLongClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->long_long_clamp_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_longLongClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<int64_t >::ConversionType value; |
| FromJSValue(context, vp, (kConversionFlagClamped), &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_long_long_clamp_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_unsignedLongLongProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->unsigned_long_long_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_unsignedLongLongProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<uint64_t >::ConversionType value; |
| FromJSValue(context, vp, kNoConversionFlags, &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_unsigned_long_long_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_unsignedLongLongClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->unsigned_long_long_clamp_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_unsignedLongLongClampProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<uint64_t >::ConversionType value; |
| FromJSValue(context, vp, (kConversionFlagClamped), &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_unsigned_long_long_clamp_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_doubleProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->double_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_doubleProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<double >::ConversionType value; |
| FromJSValue(context, vp, (kConversionFlagRestricted), &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_double_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool get_unrestrictedDoubleProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->unrestricted_double_property(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| vp.set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool set_unrestrictedDoubleProperty( |
| JSContext* context, JS::HandleObject object, JS::HandleId id, |
| JSBool strict, JS::MutableHandleValue vp) { |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| TypeTraits<double >::ConversionType value; |
| FromJSValue(context, vp, kNoConversionFlags, &exception_state, |
| &value); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->set_unrestricted_double_property(value); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_byteArgumentOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| const size_t kMinArguments = 1; |
| if (args.length() < kMinArguments) { |
| exception_state.SetSimpleException(script::kInvalidNumberOfArguments); |
| return false; |
| } |
| // Non-optional arguments |
| TypeTraits<int8_t >::ConversionType arg1; |
| |
| DCHECK_LT(0, args.length()); |
| JS::RootedValue non_optional_value0( |
| context, args[0]); |
| FromJSValue(context, |
| non_optional_value0, |
| kNoConversionFlags, |
| &exception_state, &arg1); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->ByteArgumentOperation(arg1); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_byteReturnOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->ByteReturnOperation(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| args.rval().set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_doubleArgumentOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| const size_t kMinArguments = 1; |
| if (args.length() < kMinArguments) { |
| exception_state.SetSimpleException(script::kInvalidNumberOfArguments); |
| return false; |
| } |
| // Non-optional arguments |
| TypeTraits<double >::ConversionType arg1; |
| |
| DCHECK_LT(0, args.length()); |
| JS::RootedValue non_optional_value0( |
| context, args[0]); |
| FromJSValue(context, |
| non_optional_value0, |
| (kConversionFlagRestricted), |
| &exception_state, &arg1); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->DoubleArgumentOperation(arg1); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_doubleReturnOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->DoubleReturnOperation(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| args.rval().set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_longArgumentOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| const size_t kMinArguments = 1; |
| if (args.length() < kMinArguments) { |
| exception_state.SetSimpleException(script::kInvalidNumberOfArguments); |
| return false; |
| } |
| // Non-optional arguments |
| TypeTraits<int32_t >::ConversionType arg1; |
| |
| DCHECK_LT(0, args.length()); |
| JS::RootedValue non_optional_value0( |
| context, args[0]); |
| FromJSValue(context, |
| non_optional_value0, |
| kNoConversionFlags, |
| &exception_state, &arg1); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->LongArgumentOperation(arg1); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_longLongArgumentOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| const size_t kMinArguments = 1; |
| if (args.length() < kMinArguments) { |
| exception_state.SetSimpleException(script::kInvalidNumberOfArguments); |
| return false; |
| } |
| // Non-optional arguments |
| TypeTraits<int64_t >::ConversionType arg1; |
| |
| DCHECK_LT(0, args.length()); |
| JS::RootedValue non_optional_value0( |
| context, args[0]); |
| FromJSValue(context, |
| non_optional_value0, |
| kNoConversionFlags, |
| &exception_state, &arg1); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->LongLongArgumentOperation(arg1); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_longLongReturnOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->LongLongReturnOperation(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| args.rval().set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_longReturnOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->LongReturnOperation(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| args.rval().set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_octetArgumentOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| const size_t kMinArguments = 1; |
| if (args.length() < kMinArguments) { |
| exception_state.SetSimpleException(script::kInvalidNumberOfArguments); |
| return false; |
| } |
| // Non-optional arguments |
| TypeTraits<uint8_t >::ConversionType arg1; |
| |
| DCHECK_LT(0, args.length()); |
| JS::RootedValue non_optional_value0( |
| context, args[0]); |
| FromJSValue(context, |
| non_optional_value0, |
| kNoConversionFlags, |
| &exception_state, &arg1); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->OctetArgumentOperation(arg1); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_octetReturnOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->OctetReturnOperation(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| args.rval().set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_shortArgumentOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| const size_t kMinArguments = 1; |
| if (args.length() < kMinArguments) { |
| exception_state.SetSimpleException(script::kInvalidNumberOfArguments); |
| return false; |
| } |
| // Non-optional arguments |
| TypeTraits<int16_t >::ConversionType arg1; |
| |
| DCHECK_LT(0, args.length()); |
| JS::RootedValue non_optional_value0( |
| context, args[0]); |
| FromJSValue(context, |
| non_optional_value0, |
| kNoConversionFlags, |
| &exception_state, &arg1); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->ShortArgumentOperation(arg1); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_shortReturnOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->ShortReturnOperation(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| args.rval().set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_unrestrictedDoubleArgumentOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| const size_t kMinArguments = 1; |
| if (args.length() < kMinArguments) { |
| exception_state.SetSimpleException(script::kInvalidNumberOfArguments); |
| return false; |
| } |
| // Non-optional arguments |
| TypeTraits<double >::ConversionType arg1; |
| |
| DCHECK_LT(0, args.length()); |
| JS::RootedValue non_optional_value0( |
| context, args[0]); |
| FromJSValue(context, |
| non_optional_value0, |
| kNoConversionFlags, |
| &exception_state, &arg1); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->UnrestrictedDoubleArgumentOperation(arg1); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_unrestrictedDoubleReturnOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->UnrestrictedDoubleReturnOperation(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| args.rval().set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_unsignedLongArgumentOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| const size_t kMinArguments = 1; |
| if (args.length() < kMinArguments) { |
| exception_state.SetSimpleException(script::kInvalidNumberOfArguments); |
| return false; |
| } |
| // Non-optional arguments |
| TypeTraits<uint32_t >::ConversionType arg1; |
| |
| DCHECK_LT(0, args.length()); |
| JS::RootedValue non_optional_value0( |
| context, args[0]); |
| FromJSValue(context, |
| non_optional_value0, |
| kNoConversionFlags, |
| &exception_state, &arg1); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->UnsignedLongArgumentOperation(arg1); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_unsignedLongLongArgumentOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| const size_t kMinArguments = 1; |
| if (args.length() < kMinArguments) { |
| exception_state.SetSimpleException(script::kInvalidNumberOfArguments); |
| return false; |
| } |
| // Non-optional arguments |
| TypeTraits<uint64_t >::ConversionType arg1; |
| |
| DCHECK_LT(0, args.length()); |
| JS::RootedValue non_optional_value0( |
| context, args[0]); |
| FromJSValue(context, |
| non_optional_value0, |
| kNoConversionFlags, |
| &exception_state, &arg1); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->UnsignedLongLongArgumentOperation(arg1); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_unsignedLongLongReturnOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->UnsignedLongLongReturnOperation(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| args.rval().set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_unsignedLongReturnOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->UnsignedLongReturnOperation(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| args.rval().set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_unsignedShortArgumentOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| const size_t kMinArguments = 1; |
| if (args.length() < kMinArguments) { |
| exception_state.SetSimpleException(script::kInvalidNumberOfArguments); |
| return false; |
| } |
| // Non-optional arguments |
| TypeTraits<uint16_t >::ConversionType arg1; |
| |
| DCHECK_LT(0, args.length()); |
| JS::RootedValue non_optional_value0( |
| context, args[0]); |
| FromJSValue(context, |
| non_optional_value0, |
| kNoConversionFlags, |
| &exception_state, &arg1); |
| if (exception_state.is_exception_set()) { |
| return false; |
| } |
| |
| impl->UnsignedShortArgumentOperation(arg1); |
| result_value.set(JS::UndefinedHandleValue); |
| return !exception_state.is_exception_set(); |
| } |
| |
| JSBool fcn_unsignedShortReturnOperation( |
| JSContext* context, uint32_t argc, JS::Value *vp) { |
| JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| // Compute the 'this' value. |
| JS::RootedValue this_value(context, JS_ComputeThis(context, vp)); |
| // 'this' should be an object. |
| JS::RootedObject object(context); |
| if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) { |
| return false; |
| } |
| if (!JS_ValueToObject(context, this_value, object.address())) { |
| NOTREACHED(); |
| return false; |
| } |
| const JSClass* proto_class = |
| MozjsNumericTypesTestInterface::PrototypeClass(context); |
| if (proto_class == JS_GetClass(object)) { |
| // Simply returns true if the object is this class's prototype object. |
| // There is no need to return any value due to the object is not a platform |
| // object. The execution reaches here when Object.getOwnPropertyDescriptor |
| // gets called on native object prototypes. |
| return true; |
| } |
| |
| MozjsGlobalEnvironment* global_environment = |
| static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context)); |
| WrapperFactory* wrapper_factory = global_environment->wrapper_factory(); |
| if (!wrapper_factory->DoesObjectImplementInterface( |
| object, base::GetTypeId<NumericTypesTestInterface>())) { |
| MozjsExceptionState exception(context); |
| exception.SetSimpleException(script::kDoesNotImplementInterface); |
| return false; |
| } |
| MozjsExceptionState exception_state(context); |
| JS::RootedValue result_value(context); |
| |
| WrapperPrivate* wrapper_private = |
| WrapperPrivate::GetFromObject(context, object); |
| NumericTypesTestInterface* impl = |
| wrapper_private->wrappable<NumericTypesTestInterface>().get(); |
| |
| if (!exception_state.is_exception_set()) { |
| ToJSValue(context, |
| impl->UnsignedShortReturnOperation(), |
| &result_value); |
| } |
| if (!exception_state.is_exception_set()) { |
| args.rval().set(result_value); |
| } |
| return !exception_state.is_exception_set(); |
| } |
| |
| |
| const JSPropertySpec prototype_properties[] = { |
| { // Read/Write property |
| "byteProperty", 0, |
| JSPROP_SHARED | JSPROP_ENUMERATE, |
| JSOP_WRAPPER(&get_byteProperty), |
| JSOP_WRAPPER(&set_byteProperty), |
| }, |
| { // Read/Write property |
| "byteClampProperty", 0, |
| JSPROP_SHARED | JSPROP_ENUMERATE, |
| JSOP_WRAPPER(&get_byteClampProperty), |
| JSOP_WRAPPER(&set_byteClampProperty), |
| }, |
| { // Read/Write property |
|