| 919 | auto ret = JS_DefineProperty(_context, |
| 920 | fromValdiJSValue(object), |
| 921 | fromValdiJSPropertyName(propertyName), |
| 922 | propertyValue, |
| 923 | JS_UNDEFINED, |
| 924 | JS_UNDEFINED, |
| 925 | JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE | JS_PROP_HAS_VALUE | |
| 926 | JS_PROP_HAS_CONFIGURABLE | JS_PROP_HAS_WRITABLE | JS_PROP_THROW); |
| 927 | JS_FreeValue(_context, propertyValue); |
| 928 | checkCall(exceptionTracker, ret); |
| 929 | } |
| 930 | |
| 931 | void QuickJSJavaScriptContext::setObjectProperty(const Valdi::JSValue& object, |
| 932 | const Valdi::JSValue& propertyName, |
| 933 | const Valdi::JSValue& propertyValue, |
| 934 | bool enumerable, |
| 935 | Valdi::JSExceptionTracker& exceptionTracker) { |
| 936 | auto guard = _threadAccessChecker.guard(); |
| 937 | auto atom = JS_ValueToAtom(_context, fromValdiJSValue(propertyName)); |
| 938 | if (atom == JS_ATOM_NULL) { |
| 939 | setExceptionToTracker(exceptionTracker); |
| 940 | return; |
| 941 | } |
| 942 | |
| 943 | setObjectProperty(object, toValdiJSPropertyName(atom), propertyValue, enumerable, exceptionTracker); |
| 944 | |
| 945 | JS_FreeAtom(_context, atom); |
| 946 | } |
| 947 | |
| 948 | void QuickJSJavaScriptContext::setObjectPropertyIndex(const Valdi::JSValue& object, |
| 949 | size_t index, |
| 950 | const Valdi::JSValue& value, |
| 951 | Valdi::JSExceptionTracker& exceptionTracker) { |
| 952 | auto guard = _threadAccessChecker.guard(); |
| 953 | // JS_SetProperty() automatically releases the given value. |
| 954 | auto retainedJsValue = JS_DupValue(_context, fromValdiJSValue(value)); |
| 955 | checkCall(exceptionTracker, |
| 956 | JS_SetPropertyUint32(_context, fromValdiJSValue(object), static_cast<uint32_t>(index), retainedJsValue)); |
| 957 | } |
| 958 | |
| 959 | Valdi::JSValueRef QuickJSJavaScriptContext::callObjectAsFunction(const Valdi::JSValue& object, |
| 960 | Valdi::JSFunctionCallContext& callContext) { |
| 961 | auto guard = _threadAccessChecker.guard(); |
| 962 | JSValue argv[callContext.getParameterSize()]; |
| 963 | for (size_t i = 0; i < callContext.getParameterSize(); i++) { |
| 964 | argv[i] = fromValdiJSValue(callContext.getParameter(i)); |
| 965 | } |
| 966 | |
| 967 | return checkCallAndGetValue(callContext.getExceptionTracker(), |
| 968 | JS_Call(_context, |
| 969 | fromValdiJSValue(object), |
nothing calls this directly
no test coverage detected