예제 #1
0
already_AddRefed<nsPIDOMWindowOuter>
nsDOMWindowList::IndexedGetter(uint32_t aIndex)
{
  nsCOMPtr<nsIDocShellTreeItem> item = GetDocShellTreeItemAt(aIndex);
  if (!item) {
    return nullptr;
  }

  nsCOMPtr<nsPIDOMWindowOuter> window = item->GetWindow();
  MOZ_ASSERT(window);

  return window.forget();
}
예제 #2
0
already_AddRefed<nsIDOMWindow>
nsDOMWindowList::IndexedGetter(uint32_t aIndex, bool& aFound)
{
  aFound = false;

  nsCOMPtr<nsIDocShellTreeItem> item = GetDocShellTreeItemAt(aIndex);
  if (!item) {
    return nullptr;
  }

  nsCOMPtr<nsIDOMWindow> window = do_GetInterface(item);
  MOZ_ASSERT(window);

  aFound = true;
  return window.forget();
}