WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIDOMWindowUtils

IID:7a55fc2b-afb3-41c6-9e50-3fee341fa87c
Inherits From:nsISupports

Properties

readonly PRBool docCharsetIsForced

Whether the charset of the window's current document has been forced by the user. Cannot be accessed from unprivileged context (not content-accessible)

PRUint16 imageAnimationMode

Image animation mode of the window. When this attribute's value is changed, the implementation should set all images in the window to the given value. That is, when set to kDontAnimMode, all images will stop animating. The attribute's value must be one of the animationMode values from imgIContainer.


Methods

void focus ( nsIDOMElement element ) void garbageCollect ( ) AString getDocumentMetadata ( AString name ) void redraw ( ) void sendKeyEvent ( AString type , PRInt32 keyCode , PRInt32 charCode , PRInt32 modifiers ) void sendMouseEvent ( AString type , PRInt32 aX , PRInt32 aY , PRInt32 button , PRInt32 clickCount , PRInt32 modifiers )

void focus ( nsIDOMElement element )

Focus the element element. The element should be in the same document that the window is displaying. Pass null to blur the element, if any, that currently has focus, and focus the document.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

Arguments:
element: the element to focus

void garbageCollect ( )

Force a garbage collection. This will run the cycle-collector twice to make sure all garbage is collected.

Will throw a DOM security error if called without UniversalXPConnect privileges in non-debug builds. Available to all callers in debug builds.


AString getDocumentMetadata ( AString name )

Function to get metadata associated with the window's current document

Will throw a DOM security error if called without UniversalXPConnect privileges.

Arguments:
name: the name of the metadata. This should be all lowercase.
Returns:
the value of the metadata, or the empty string if it's not set

void redraw ( )

Force an immediate redraw of this window.


void sendKeyEvent ( AString type , PRInt32 keyCode , PRInt32 charCode , PRInt32 modifiers )

Synthesize a key event to the window. The event types supported are: keydown, keyup, keypress

Key events generally end up being sent to the focused node.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

Arguments:
type: event type
keyCode: key code
charCode: character code
modifiers: modifiers pressed, using constants defined in nsIDOMNSEvent

void sendMouseEvent ( AString type , PRInt32 aX , PRInt32 aY , PRInt32 button , PRInt32 clickCount , PRInt32 modifiers )

Synthesize a mouse event for a window. The event types supported are: mousedown, mouseup, mousemove, mouseover, mouseout, contextmenu

Events are sent in coordinates offset by aX and aY from the window.

Note that additional events may be fired as a result of this call. For instance, typically a click event will be fired as a result of a mousedown and mouseup in sequence.

Normally at this level of events, the mouseover and mouseout events are only fired when the window is entered or exited. For inter-element mouseover and mouseout events, a movemove event fired on the new element should be sufficient to generate the correct over and out events as well.

Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.

Arguments:
type: event type
aX: x offset
aY: y offset
button: button to synthesize
clickCount: number of clicks that have been performed
modifiers: modifiers pressed, using constants defined in nsIDOMNSEvent

Reference documentation is generated from Mozilla's source.