FFSessionHandler::~FFSessionHandler(void) { Debug::log(Debug::Debugging) << "FFSessionHandler::~FFSessionHandler(this=" << this << ")" << Debug::flush; disconnect(); if (runtime) { JS_RemoveRootRT(runtime, &jsObjectsById); jsObjectsById = NULL; JS_RemoveRootRT(runtime, &toStringTearOff); runtime = NULL; } }
XPCVariant::~XPCVariant() { nsVariant::Cleanup(&mData); if(JSVAL_IS_GCTHING(mJSVal)) { JSRuntime* rt; nsIJSRuntimeService* rtsrvc = nsXPConnect::GetJSRuntimeService(); if(rtsrvc && NS_SUCCEEDED(rtsrvc->GetRuntime(&rt))) JS_RemoveRootRT(rt, &mJSVal); } }
/** * Get the window object for a plugin instance. * * @param jEnv - JNIEnv on which the call is being made. * @param obj - A Native JS Object. */ NS_METHOD nsCLiveconnect::FinalizeJSObject(JNIEnv *jEnv, lcjsobject obj) { if(jEnv == NULL || obj == 0) { return NS_ERROR_FAILURE; } JSObjectHandle *handle = (JSObjectHandle *)obj; if (!handle) return NS_ERROR_NULL_POINTER; JS_RemoveRootRT(handle->rt, &handle->js_obj); free(handle); return NS_OK; }
static void finalize(RubyLandProxy* proxy) { // could get finalized after the context has been freed if (proxy->runtime && proxy->runtime->jsids) { // remove this proxy from the OID map jsval proxy_value; get_jsval_for_proxy(proxy, &proxy_value); JS_HashTableRemove(proxy->runtime->jsids, (void *)proxy_value); } if (proxy->runtime) { // remove our GC handle on the JS value JS_RemoveRootRT(proxy->runtime->js, &(proxy->key)); } free(proxy); }
/* * Class: netscape_javascript_JSObject * Method: finalize * Signature: ()V */ JNIEXPORT void JNICALL Java_netscape_javascript_JSObject_finalize(JNIEnv *jEnv, jobject java_wrapper_obj) { JSBool success; JSObjectHandle *handle; success = JS_FALSE; #if JS_BYTES_PER_LONG == 8 handle = (JSObjectHandle *)((*jEnv)->GetLongField(jEnv, java_wrapper_obj, njJSObject_long_internal)); #else handle = (JSObjectHandle *)((*jEnv)->GetIntField(jEnv, java_wrapper_obj, njJSObject_internal)); #endif JS_ASSERT(handle); if (!handle) return; success = JS_RemoveRootRT(handle->rt, &handle->js_obj); free(handle); JS_ASSERT(success); }