jsbindings/jscontroller-jsbindings.cpp
/**
 * @brief Removes the AAMP_JSController instance from JS context
 *
 * @param[in] context JS execution context
 */
@brief Removes the AAMP_JSController instance from JS context
@param[in] context JS execution context
@brief Removes the AAMP_JSController instance from JS context @param [ in ] context JS execution context
void aamp_UnloadJSController(JSGlobalContextRef context)
{
	INFO("[AAMP_JSController] aamp_UnloadJSController context=%p\n", context);
	aamp_UnloadJS(context);
	AAMPPlayer_UnloadJS(context);
	JSObjectRef globalObj = JSContextGetGlobalObject(context);
	JSStringRef str = JSStringCreateWithUTF8CString("AAMP_JSController");
	JSValueRef aamp = JSObjectGetProperty(context, globalObj, str, NULL);
	if (aamp == NULL)
	{
		JSStringRelease(str);
		return;
	}
	JSObjectRef aampObj = JSValueToObject(context, aamp, NULL);
	if (aampObj == NULL || JSObjectGetPrivate(aampObj) == NULL)
	{
		JSStringRelease(str);
		return;
	}
	AAMP_JSController_finalize(aampObj);
	_globalController = NULL;
	JSObjectSetProperty(context, globalObj, str, JSValueMakeUndefined(context), kJSPropertyAttributeReadOnly, NULL);
	JSStringRelease(str);
	LOG("[AAMP_JSController] JSGarbageCollect(%p)\n", context);
	JSGarbageCollect(context);
}
void aamp_UnloadJSController ( JSGlobalContextRef context ) { INFO ( " \n " , context ) ; aamp_UnloadJS ( context ) ; AAMPPlayer_UnloadJS ( context ) ; JSObjectRef globalObj = JSContextGetGlobalObject ( context ) ; JSStringRef str = JSStringCreateWithUTF8CString ( " " ) ; JSValueRef aamp = JSObjectGetProperty ( context , globalObj , str , NULL ) ; if ( aamp == NULL ) { JSStringRelease ( str ) ; return ; } JSObjectRef aampObj = JSValueToObject ( context , aamp , NULL ) ; if ( aampObj == NULL || JSObjectGetPrivate ( aampObj ) == NULL ) { JSStringRelease ( str ) ; return ; } AAMP_JSController_finalize ( aampObj ) ; _globalController = NULL ; JSObjectSetProperty ( context , globalObj , str , JSValueMakeUndefined ( context ) , kJSPropertyAttributeReadOnly , NULL ) ; JSStringRelease ( str ) ; LOG ( " \n " , context ) ; JSGarbageCollect ( context ) ; }
@brief Removes the AAMP_JSController instance from JS context
 @param[in] context JS execution context
@brief Removes the AAMP_JSController instance from JS context @param [ in ] context JS execution context