NS_IMETHODIMP nsASDOMWindowEnumerator::GetNext(nsISupports **retval)
{
    if (!retval)
        return NS_ERROR_INVALID_ARG;

    *retval = nsnull;
    if (mCurrentPosition) {
        nsCOMPtr<nsIDOMWindow> domWindow;
        GetDOMWindow(mCurrentPosition->mWindow, domWindow);
        CallQueryInterface(domWindow, retval);
        mCurrentPosition = FindNext();
    }
    return NS_OK;
}
示例#2
0
// Returns the window of type inType ( if null return any window type ) which has the most recent
// time stamp
NS_IMETHODIMP
nsWindowMediator::GetMostRecentWindow(const PRUnichar* inType, nsIDOMWindowInternal** outWindow)
{
  NS_ENSURE_ARG_POINTER(outWindow);
  *outWindow = nsnull;

  // Find the most window with the highest time stamp that matches
  // the requested type

  nsAutoLock lock(mListLock);
  nsWindowInfo *info = MostRecentWindowInfo(inType);

  if (info && info->mWindow) {
    nsCOMPtr<nsIDOMWindowInternal> DOMWindow;
    if (NS_SUCCEEDED(GetDOMWindow(info->mWindow, DOMWindow))) {  
      *outWindow = DOMWindow;
      NS_ADDREF(*outWindow);
      return NS_OK;
    }
    return NS_ERROR_FAILURE;
  }

  return NS_OK;
}