return NS_ERROR_FAILURE;
if (NS_FAILED(frv)) return frv;
nsresult NS_NewTimer(nsITimer ** aInstancePtrResult){  NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");    if (nsnull == aInstancePtrResult)     return NS_ERROR_NULL_POINTER;    nsresult   rv = NS_ERROR_FAILURE;  nsITimer * timer = nsnull;    static nsIFactory * factory = nsnull;  if (nsnull == factory)  {    nsresult frv = nsComponentManager::FindFactory(kCTimerGtkCID,&factory);    NS_ASSERTION(NS_SUCCEEDED(frv),"Could not find timer factory.");    NS_ASSERTION(nsnull != factory,"Could not instanciate timer factory.");    return NS_ERROR_FAILURE;  }  rv = factory->CreateInstance(NULL,                               kITimerIID,                               (void **)& timer);  NS_ASSERTION(NS_SUCCEEDED(rv),"Could not instanciate a timer.");  if (nsnull == timer)     return NS_ERROR_OUT_OF_MEMORY;  *aInstancePtrResult = timer;    return rv;}