nsCOMPtr<nsIInterfaceInfoManager> iim = getter_AddRefs(XPTI_GetInterfaceInfoManager()); NS_ASSERTION(iim, "could not get interface info manager");
nsCOMPtr<nsIInterfaceInfoManager> iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID, &rv)); NS_ENSURE_SUCCESS(rv, rv);
  nsresult GenerateInterfaces()  {    nsresult rv;    nsCOMPtr<nsIInterfaceInfoManager> iim =      getter_AddRefs(XPTI_GetInterfaceInfoManager());    NS_ASSERTION(iim, "could not get interface info manager");    nsCOMPtr<nsIEnumerator> etor;    rv = iim->EnumerateInterfaces(getter_AddRefs(etor));    NS_ENSURE_SUCCESS(rv, rv);    // loop over interfaces    etor->First();    do {      // get current interface      nsCOMPtr<nsISupports> item;      rv = etor->CurrentItem(getter_AddRefs(item));      NS_ENSURE_SUCCESS(rv, rv);      nsCOMPtr<nsIInterfaceInfo> iface(do_QueryInterface(item));      if (!iface)        break;      // we only care about scriptable interfaces, so skip over those      // that aren't      PRBool scriptable;      iface->IsScriptable(&scriptable);      if (!scriptable) {        // XXX SWT uses non-scriptable interface 'nsIAppShell' (bug 270892), so        // include that one.        const char* iface_name;        iface->GetNameShared(&iface_name);        if (strcmp("nsIAppShell", iface_name) != 0)          continue;      }      rv = WriteOneInterface(iface);      NS_ENSURE_SUCCESS(rv, rv);    } while (NS_SUCCEEDED(etor->Next()));    return NS_OK;  }