Interface nsIWindowWatcherType

nsIWindowWatcher is the keeper of Gecko/DOM Windows. It maintains a list of open top-level windows, and allows some operations on them. Usage notes: This component has an |activeWindow| property. Clients may expect this property to be always current, so to properly integrate this component the application will need to keep it current by setting the property as the active window changes. This component should not keep a (XPCOM) reference to any windows; the implementation will claim no ownership. Windows must notify this component when they are created or destroyed, so only a weak reference is kept. Note that there is no interface for such notifications (not a public one, anyway). This is taken care of both in Mozilla and by common embedding code. Embedding clients need do nothing special about that requirement. This component must be initialized at application startup by calling setWindowCreator.

Hierarchy

Properties

activeWindow: mozIDOMWindowProxy

Retrieves the active window from the focus manager.

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Retrieve the chrome window mapped to the given DOM window. Window Watcher keeps a list of all top-level DOM windows currently open, along with their corresponding chrome interfaces. Since DOM Windows lack a (public) means of retrieving their corresponding chrome, this method will do that.

    Returns

    the corresponding chrome window

    Parameters

    • aWindow: mozIDOMWindowProxy

      the DOM window whose chrome window the caller needs

    Returns nsIWebBrowserChrome

  • Return a newly created nsIAuthPrompt implementation.

    Returns

    a new nsIAuthPrompt object

    Parameters

    • aParent: mozIDOMWindowProxy

      the parent window used for posing alerts. can be null.

    Returns nsIAuthPrompt

  • Return a newly created nsIPrompt implementation.

    Returns

    a new nsIPrompt object

    Parameters

    • aParent: mozIDOMWindowProxy

      the parent window used for posing alerts. can be null.

    Returns nsIPrompt

  • Retrieve an existing chrome window (or frame).

    Parameters

    • aTargetName: string

      the window name

      Note: This method will not consider special names like "_blank", "_top", "_self", or "_parent", as there is no reference window.

      Note: This method will search all open windows for any window or frame with the given window name. Make sure you understand the security implications of this before using this method!

    Returns mozIDOMWindowProxy

  • Get an iterator for currently open windows in the order they were opened, guaranteeing that each will be visited exactly once.

    Returns

    an enumerator which will itself return nsISupports objects which can be QIed to an nsIDOMWindow

    Returns nsISimpleEnumerator

  • Returns true if a window creator callback has been set, false otherwise.

    Returns boolean

  • Create a new window. It will automatically be added to our list (via addWindow()).

    Returns

    the new window

    Note

    This method may examine the JS context stack for purposes of determining the security context to use for the search for a given window named aName.

    Note

    This method should try to set the default charset for the new window to the default charset of aParent. This is not guaranteed, however.

    Note

    This method may dispatch a "toplevel-window-ready" notification via nsIObserverService if the window did not already exist.

    Parameters

    • aParent: mozIDOMWindowProxy

      parent window, if any. Null if no parent. If it is impossible to get to an nsIWebBrowserChrome from aParent, this method will effectively act as if aParent were null.

    • aUrl: string
    • aName: string

      window name from JS window.open. can be null. If a window with this name already exists, the openWindow call may just load aUrl in it (if aUrl is not null) and return it.

    • aFeatures: string

      window features from JS window.open. can be null.

    • aArguments: nsISupports

      extra argument(s) to the new window, to be attached as the |arguments| property. An nsIArray will be unwound into multiple arguments (but not recursively!). can be null.

    Returns mozIDOMWindowProxy

  • Clients of this service can register themselves to be notified when a window is opened or closed (added to or removed from this service). This method adds an aObserver to the list of objects to be notified.

    Parameters

    • aObserver: nsIObserver

      the object to be notified when windows are opened or closed. Its Observe method will be called with the following parameters:

      aObserver::Observe interprets its parameters so: aSubject the window being opened or closed, sent as an nsISupports which can be QIed to an nsIDOMWindow. aTopic a wstring, either "domwindowopened" or "domwindowclosed". someData not used.

    Returns void

  • Set the window creator callback. It must be filled in by the app. openWindow will use it to create new windows.

    Parameters

    • creator: nsIWindowCreator

      the callback. if null, the callback will be cleared and window creation capabilities lost.

    Returns void

  • Clients of this service can register themselves to be notified when a window is opened or closed (added to or removed from this service). This method removes an aObserver from the list of objects to be notified.

    Parameters

    • aObserver: nsIObserver

      the observer to be removed.

    Returns void

Generated using TypeDoc