NS_ASSERTION(!IsXPTCStub(xpcomObj), "Expected JavaXPCOMInstance, but got nsJavaXPTCStub"); servMgr = do_QueryInterface(((JavaXPCOMInstance*) xpcomObj)->GetInstance());
XPCOM_NATIVE(shutdownXPCOM) (JNIEnv *env, jclass, jobject aServMgr){  nsCOMPtr<nsIServiceManager> servMgr;  if (aServMgr) {    // Find corresponding XPCOM object    void* xpcomObj = GetMatchingXPCOMObject(env, aServMgr);    NS_ASSERTION(xpcomObj != nsnull, "Failed to get matching XPCOM object");    if (xpcomObj == nsnull) {      ThrowXPCOMException(env, 0,                          "No matching XPCOM obj for service manager proxy");      return;    }    NS_ASSERTION(!IsXPTCStub(xpcomObj),                 "Expected JavaXPCOMInstance, but got nsJavaXPTCStub");    servMgr = do_QueryInterface(((JavaXPCOMInstance*) xpcomObj)->GetInstance());  }  nsresult rv = NS_ShutdownXPCOM(servMgr);  if (NS_FAILED(rv))    ThrowXPCOMException(env, rv, "NS_ShutdownXPCOM failed");  FreeJavaGlobals(env);}