Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Attributes
nsDOMWindowList Class Reference

#include <nsDOMWindowList.h>

Inheritance diagram for nsDOMWindowList:
Inheritance graph
[legend]
Collaboration diagram for nsDOMWindowList:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsDOMWindowList (nsIDocShell *aDocShell)
virtual ~nsDOMWindowList ()
NS_DECL_ISUPPORTS NS_IMETHOD GetLength (PRUint32 *aLength)
NS_IMETHOD Item (PRUint32 aIndex, nsIDOMWindow **aReturn)
NS_IMETHOD NamedItem (const nsAString &aName, nsIDOMWindow **aReturn)
NS_IMETHOD SetDocShell (nsIDocShell *aDocShell)
nsIDOMWindow item (in unsigned long index)
 Method for accessing an item in this collection by index.
nsIDOMWindow namedItem (in DOMString name)
 Method for accessing an item in this collection by window name.

Public Attributes

readonly attribute unsigned long length
 Accessor for the number of windows in this collection.

Protected Attributes

nsIDocShellTreeNodemDocShellNode

Detailed Description

Definition at line 49 of file nsDOMWindowList.h.


Constructor & Destructor Documentation

Definition at line 57 of file nsDOMWindowList.cpp.

{
  SetDocShell(aDocShell);
}

Here is the call graph for this function:

Definition at line 62 of file nsDOMWindowList.cpp.

{
}

Member Function Documentation

Definition at line 84 of file nsDOMWindowList.cpp.

{
  nsresult rv = NS_OK;

  *aLength = 0;

  nsCOMPtr<nsIWebNavigation> shellAsNav(do_QueryInterface(mDocShellNode));

  if (shellAsNav) {
    nsCOMPtr<nsIDOMDocument> domdoc;
    shellAsNav->GetDocument(getter_AddRefs(domdoc));

    nsCOMPtr<nsIDocument> doc(do_QueryInterface(domdoc));

    if (doc) {
      doc->FlushPendingNotifications(Flush_ContentAndNotify);
    }
  }

  // The above flush might cause mDocShellNode to be cleared, so we
  // need to check that it's still non-null here.

  if (mDocShellNode) {
    PRInt32 length;
    rv = mDocShellNode->GetChildCount(&length);

    *aLength = length;
  }

  return rv;
}

Here is the call graph for this function:

Definition at line 117 of file nsDOMWindowList.cpp.

{
  nsCOMPtr<nsIDocShellTreeItem> item;

  *aReturn = nsnull;

  nsCOMPtr<nsIWebNavigation> shellAsNav = do_QueryInterface(mDocShellNode);

  if (shellAsNav) {
    nsCOMPtr<nsIDOMDocument> domdoc;
    shellAsNav->GetDocument(getter_AddRefs(domdoc));

    nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc);

    if (doc) {
      doc->FlushPendingNotifications(Flush_ContentAndNotify);
    }
  }

  // The above flush might cause mDocShellNode to be cleared, so we
  // need to check that it's still non-null here.

  if (mDocShellNode) {
    mDocShellNode->GetChildAt(aIndex, getter_AddRefs(item));

    nsCOMPtr<nsIScriptGlobalObject> globalObject(do_GetInterface(item));
    NS_WARN_IF_FALSE(!item || (item && globalObject),
                     "Couldn't get to the globalObject");

    if (globalObject) {
      CallQueryInterface(globalObject, aReturn);
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

nsIDOMWindow nsIDOMWindowCollection::item ( in unsigned long  index) [inherited]

Method for accessing an item in this collection by index.

Here is the caller graph for this function:

NS_IMETHODIMP nsDOMWindowList::NamedItem ( const nsAString &  aName,
nsIDOMWindow **  aReturn 
)

Definition at line 154 of file nsDOMWindowList.cpp.

{
  nsCOMPtr<nsIDocShellTreeItem> item;

  *aReturn = nsnull;

  nsCOMPtr<nsIWebNavigation> shellAsNav(do_QueryInterface(mDocShellNode));

  if (shellAsNav) {
    nsCOMPtr<nsIDOMDocument> domdoc;
    shellAsNav->GetDocument(getter_AddRefs(domdoc));

    nsCOMPtr<nsIDocument> doc(do_QueryInterface(domdoc));

    if (doc) {
      doc->FlushPendingNotifications(Flush_ContentAndNotify);
    }
  }

  // The above flush might cause mDocShellNode to be cleared, so we
  // need to check that it's still non-null here.

  if (mDocShellNode) {
    mDocShellNode->FindChildWithName(PromiseFlatString(aName).get(),
                                     PR_FALSE, PR_FALSE, nsnull,
                                     nsnull, getter_AddRefs(item));

    nsCOMPtr<nsIScriptGlobalObject> globalObject(do_GetInterface(item));
    NS_ASSERTION(globalObject, "Couldn't get to the globalObject");
    if (globalObject) {
      CallQueryInterface(globalObject.get(), aReturn);
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

nsIDOMWindow nsIDOMWindowCollection::namedItem ( in DOMString  name) [inherited]

Method for accessing an item in this collection by window name.

Definition at line 75 of file nsDOMWindowList.cpp.

{
  nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
  mDocShellNode = docShellAsNode; // Weak Reference

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

readonly attribute unsigned long nsIDOMWindowCollection::length [inherited]

Accessor for the number of windows in this collection.

Definition at line 55 of file nsIDOMWindowCollection.idl.

Definition at line 66 of file nsDOMWindowList.h.


The documentation for this class was generated from the following files: