nsISupports
Last changed in Gecko 49.0 (Firefox 49.0 / Thunderbird 49.0 / SeaMonkey 2.46)Implemented by: Window
. To get this interface, use:
var domWindowUtils = window.windowUtils;
void activateNativeMenuItemAt(in AString indexString); |
void clearMozAfterPaintEvents(); |
PRUint32 compareCanvases(in nsIDOMHTMLCanvasElement aCanvas1, in nsIDOMHTMLCanvasElement aCanvas2, out unsigned long aMaxDifference); |
double computeAnimationDistance(in nsIDOMElement element, in AString property, in AString value1, in AString value2); |
nsICompositionStringSynthesizer createCompositionStringSynthesizer(); Obsolete since Gecko 38.0 |
void disableNonTestMouseEvents(in boolean aDisable); |
boolean dispatchDOMEventViaPresShell(in nsIDOMNode aTarget, in nsIDOMEvent aEvent, in boolean aTrusted); |
nsIDOMElement elementFromPoint(in float aX, in float aY, in boolean aIgnoreRootScrollFrame, in boolean aFlushLayout); |
void enterModalState(); |
|
void focus(in nsIDOMElement aElement); |
void forceUpdateNativeMenuAt(in AString indexString); |
void garbageCollect([optional] in nsICycleCollectorListener aListener); |
short getCursorType(); |
AString getDocumentMetadata(in AString aName); |
nsIDOMWindow getOuterWindowWithId(in unsigned long long aOuterWindowID); |
long getPCCountScriptCount(); |
AString getPCCountScriptSummary(in long aScript); |
AString getPCCountScriptContents(in long aScript); |
void getScrollXY(in boolean aFlushLayout, out long aScrollX, out long aScrollY); |
AString getVisitedDependentComputedStyle(in nsIDOMElement aElement, in AString aPseudoElement, in AString aPropertyName); |
boolean isInModalState(); |
void leaveModalState(); |
void loadSheet(in nsIURI sheetURI, in unsigned long type); |
nsIDOMNodeList nodesFromRect(in float aX, in float aY, in float aTopSize, in float aRightSize, in float aBottomSize, in float aLeftSize, in boolean aIgnoreRootScrollFrame, in boolean aFlushLayout); |
void processUpdates(); Obsolete since Gecko 13.0 |
void purgePCCounts(); |
unsigned long redraw([optional] in unsigned long aCount); |
void RenderDocument(in nsConstRect aRect, in PRUint32 aFlags, in nscolor aBackgroundColor, in gfxContext aThebesContext); Native code only! |
void removeSheet(in nsIURI sheetURI, in unsigned long type); |
void resumeTimeouts(); |
void sendCompositionEvent(in AString aType); Obsolete since Gecko 9 |
void sendCompositionEvent(in AString aType, in AString aData, in AString aLocale); Obsolete since Gecko 38.0 |
void sendContentCommandEvent(in AString aType, [optional] in nsITransferable aTransferable); |
void getClassName(in object aObj); |
boolean sendKeyEvent(in AString aType, in long aKeyCode, in long aCharCode, in long aModifiers, [optional] in boolean aPreventDefault); Obsolete since Gecko 15.0 |
boolean sendKeyEvent(in AString aType, in long aKeyCode, in long aCharCode, in long aModifiers, [optional] in unsigned long aAdditionalFlags); Deprecated since Gecko 38.0 |
void sendMouseEvent(in AString aType, in float aX, in float aY, in long aButton, in long aClickCount, in long aModifiers, [optional] in boolean aIgnoreRootScrollFrame); |
void sendMouseEventToWindow(in AString aType, in float aX, in float aY, in long aButton, in long aClickCount, in long aModifiers, [optional] in boolean aIgnoreRootScrollFrame); |
void sendMouseScrollEvent(in AString aType, in float aX, in float aY, in long aButton, in long aScrollFlags, in long aDelta, in long aModifiers); Obsolete since Gecko 17.0 |
void sendWheelEvent(in float aX, in float aY, in double aDeltaX, in double aDeltaY, in double aDeltaZ, in unsigned long aDeltaMode, in long aModifiers, in long aLineOrPageDeltaX, in long aLineOrPageDeltaY, in unsigned long aOptions); |
void sendNativeKeyEvent(in long aNativeKeyboardLayout, in long aNativeKeyCode, in long aModifierFlags, in AString aCharacters, in AString aUnmodifiedCharacters); |
void sendNativeMouseEvent(in long aScreenX, in long aScreenY, in long aNativeMessage, in long aModifierFlags, in nsIDOMElement aElement); |
Obsolete since Gecko 31.0 |
|
boolean sendSelectionSetEvent(in unsigned long aOffset, in unsigned long aLength, in boolean aReverse); Obsolete since Gecko 31.0 |
boolean sendSelectionSetEvent(in unsigned long aOffset, in unsigned long aLength, [optional] in unsigned long aAdditionalFlags); |
void sendSimpleGestureEvent(in AString aType, in float aX, in float aY, in unsigned long aDirection, in double aDelta, in long aModifiers); |
void sendTextEvent(in AString aCompositionString, in long aFirstClauseLength, in unsigned long aFirstClauseAttr, in long aSecondClauseLength, in unsigned long aSecondClauseAttr, in long aThirdClauseLength, in unsigned long aThirdClauseAttr, in long aCaretStart, in long aCaretLength); Obsolete since Gecko 26 |
boolean sendTouchEvent(in AString aType, [array, size_is(count)] in PRUint32 aIdentifiers, [array, size_is(count)] in PRInt32 aXs, [array, size_is(count)] in PRInt32 aYs, [array, size_is(count)] in PRUint32 aRxs, [array, size_is(count)] in PRUint32 aRys, [array, size_is(count)] in float aRotationAngles, [array, size_is(count)] in float aForces, in PRUint32 count, in long aModifiers, [optional] in boolean aIgnoreRootScrollFrame); |
void setCSSViewport(in float aWidthPx, in float aHeightPx); |
void setDisplayPort(in float aXPx, in float aYPx, in float aWidthPx, in float aHeightPx); |
void setResolution(in float aXResolution, in float aYResolution); |
void startPCCountProfiling(); |
void stopPCCountProfiling(); |
void suppressEventHandling(in boolean aSuppress); |
void suspendTimeouts(); |
nsIDOMFile wrapDOMFile( |
Attribute | Type | Description |
currentInnerWindowID |
unsigned long long |
The ID of the window's current inner window. Read only. Exceptions thrown
|
displayDPI |
float |
The DPI of the display. Read only. |
docCharsetIsForced |
boolean |
Whether the charset of the window's current document has been forced by the user. Cannot be accessed from unprivileged context (not content-accessible) Read only. |
elementsRestyled Read only |
unsigned long long |
The number of elements which have been restyled for the current document. Keep in mind that during a restyle operation, an element may be restyled multiple times (for example, when an inline element contains blocks). This number also counts restyling of pseudo-elements and anonymous boxes. Throws NS_ERROR_NOT_AVAILABLE if the count can't be provided. |
focusedInputType |
string |
The type of the currently-focused HTML <input> element, if one is focused. |
imageAnimationMode |
unsigned short |
Returns the image animation mode of the window. The attribute's value must be one of the animationMode values from imgIContainer . |
IMEIsOpen |
boolean |
Returns the IME open state. True if it's open, otherwise false . This attribute only works when IMEStatus is IME_STATUS_ENABLED . Read only. |
IMEStatus |
unsigned long |
Returns the current IME status. Values correspond to the IME_STATUS_* constants defined below. Read only. |
isMozAfterPaintPending |
boolean |
Returns true if a MozAfterPaint event has been queued but not yet fired. Read only. |
layerManagerType |
AString |
What type of layer manager the widget associated with this window is using. "Basic" is unaccelerated; other types are accelerated. Throws an error if there is no widget associated with this window. Read only. |
outerWindowID |
unsigned long long |
The ID of the window's outer window. Read only. |
paintingSuppressed |
boolean |
This is used on mobile, for example, to prevent attempts to render content until enough of the page has been loaded to avoid content bouncing around excessively as more content is loaded. |
screenPixelsPerCSSPixel |
float |
Returns the number of screen pixels per CSS pixel. Read only. |
audioMuted | boolean |
With this it's possible to mute all the MediaElements in this window. We have audioMuted and audioVolume to preserve the volume across mute/umute. |
audioVolume | float |
Range: greater or equal to 0. The real volume level is affected by the volume of all ancestor windows. |
Constant | Value | Description |
MODIFIER_ALT |
0x0001 |
getModifierState("Alt") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . |
MODIFIER_CONTROL |
0x0002 |
getModifierState("Control") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . |
MODIFIER_SHIFT |
0x0004 |
getModifierState("Shift") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . |
MODIFIER_META |
0x0008 |
getModifierState("Meta") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . |
MODIFIER_ALTGRAPH |
0x0010 |
getModifierState("AltGraph") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . |
MODIFIER_CAPSLOCK |
0x0020 |
getModifierState("CapsLock") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . |
MODIFIER_FN |
0x0040 |
getModifierState("Fn") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . |
MODIFIER_FNLOCK |
0x0080 |
getModifierState("Fn") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . |
MODIFIER_NUMLOCK |
0x0100 |
getModifierState("NumLock") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . Value Changed , was 0x0080. |
MODIFIER_SCROLL |
0x0100 |
getModifierState("Scroll") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . Obsolete |
MODIFIER_SCROLLLOCK |
0x0200 |
getModifierState("Scroll") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . |
MODIFIER_SYMBOL |
0x0400 |
getModifierState("SymbolLock") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . |
MODIFIER_SYMBOLLOCK |
0x0800 |
getModifierState("SymbolLock") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . Value Changed , was 0x0200. |
MODIFIER_WIN |
0x0400 |
getModifierState("Win") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . Obsolete |
MODIFIER_OS |
0x1000 |
getModifierState("Os") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event() . |
KEY_FLAG_PREVENT_DEFAULT |
0x0001 |
getDefaultPrevented() returns true if this is specified to aAdditionalFlags of sendKeyEvent() . Deprecated since Gecko 38.0 |
KEY_FLAG_NOT_SYNTHESIZED_FOR_TESTS |
0x0002 |
|
KEY_FLAG_LOCATION_STANDARD |
0x0010 |
location attrubute of the sending key event by sendKeyEvent() returns KeyboardEvent.DOM_KEY_LOCATION_STANDARD if this is specified to the aAdditionalFlags . Deprecated since Gecko 38.0 |
KEY_FLAG_LOCATION_LEFT |
0x0020 |
location attrubute of the sending key event by sendKeyEvent() returns KeyboardEvent.DOM_KEY_LOCATION_LEFT if this is specified to the aAdditionalFlags . Deprecated since Gecko 38.0 |
KEY_FLAG_LOCATION_RIGHT |
0x0040 |
location attrubute of the sending key event by sendKeyEvent() returns KeyboardEvent.DOM_KEY_LOCATION_RIGHT if this is specified to the aAdditionalFlags . Deprecated since Gecko 38.0 |
KEY_FLAG_LOCATION_NUMPAD |
0x0080 |
location attrubute of the sending key event by sendKeyEvent() returns KeyboardEvent.DOM_KEY_LOCATION_NUMPAD if this is specified to the aAdditionalFlags . Deprecated since Gecko 38.0 |
KEY_FLAG_LOCATION_MOBILE |
0x0100 |
location attrubute of the sending key event by sendKeyEvent() returns KeyboardEvent.DOM_KEY_LOCATION_MOBILE if this is specified to the aAdditionalFlags .Obsolete since Gecko 38.0 |
KEY_FLAG_LOCATION_JOYSTICK |
0x0200 |
location attrubute of the sending key event by sendKeyEvent() returns KeyboardEvent.DOM_KEY_LOCATION_JOYSTICK if this is specified to the aAdditionalFlags .Obsolete since Gecko 38.0 |
WHEEL_EVENT_CAUSED_BY_NO_LINE_OR_PAGE_DELTA_DEVICE |
0x0001 |
Used for aOptions of sendWheelEvent() . |
WHEEL_EVENT_CAUSED_BY_PIXEL_ONLY_DEVICE |
0x0001 |
Used for aOptions of sendWheelEvent() . If this is set, the synthesized wheel event emulates wheel events come from some devices without the line scroll amount by the event. It means that the aLineOrPageDeltaX and aLineOrPageDeltaY don't have proper values. |
WHEEL_EVENT_CAUSED_BY_MOMENTUM |
0x0002 |
Used for aOptions of sendWheelEvent() . If this is set, the synthesized wheel event emulates momentum scroll event. |
WHEEL_EVENT_CUSTOMIZED_BY_USER_PREFS |
0x0004 |
Used for aOptions of sendWheelEvent() . If this is set, the synthesized wheel event emulates an event whose delta values are computed from user prefs in widget level. |
WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_ZERO |
0x0010 |
|
WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_POSITIVE |
0x0020 |
|
WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_NEGATIVE |
0x0040 |
|
WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_ZERO |
0x0100 |
|
WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_POSITIVE |
0x0200 |
|
WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_NEGATIVE |
0x0400 |
|
MOUSESCROLL_PREFER_WIDGET_AT_POINT |
1 |
|
MOUSESCROLL_SCROLL_LINES |
2 |
|
MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL |
65536 |
|
TOUCH_HOVER |
1 |
|
TOUCH_CONTACT |
2 |
|
TOUCH_REMOVE |
4 |
|
TOUCH_CANCEL |
8 |
|
IME_STATUS_DISABLED |
0 |
Users cannot use IME at all. This state is not the same as ime-mode: disabled . |
IME_STATUS_ENABLED |
1 |
Users can use all functions of IME. This state is same as ime-mode: normal . |
IME_STATUS_PASSWORD |
2 |
Users cannot use most IME functions. On GTK2, users can use "Simple IME" which only supports dead key inputting. This state is the same as ime-mode: password. |
IME_STATUS_PLUGIN |
3 |
Plug-in has focus. At this time we should not attempt to set the IME state. |
COMPOSITION_ATTR_RAWINPUT |
0x02 |
Synthesize a text event to the window. Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges. Currently, this method doesn't support 4 or more clauses composition string. Obsolete since Gecko 38.0 |
COMPOSITION_ATTR_SELECTEDRAWTEXT |
0x03 |
Obsolete since Gecko 38.0 |
COMPOSITION_ATTR_CONVERTEDTEXT |
0x04 |
Obsolete since Gecko 38.0 |
COMPOSITION_ATTR_SELECTEDCONVERTEDTEXT |
0x05 |
Obsolete since Gecko 38.0 |
QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK |
0x0000 |
One of values of aAdditionalFlags of sendQueryContentEvent() . This flag must not be set with QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK . When this is set (or not set ), the aOffset and aLength are offset and length in/of the content generated with native line breaks (E.g., "\r\n" on Windows). Additionally, the offset, length and string of result are also computed with native line breaks. |
QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK |
0x0001 |
One of values of aAdditionalFlags of sendQueryContentEvent() . This flag must not be set with QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK . When this is set, the aOffset and aLength are offset and length in/of the content generated with XP line breaks (I.e., "\n" on all platforms). Additionally, the offset, length and string of result are also computed with XP line breaks. This is more useful for Javascript in chrome. |
QUERY_CONTENT_FLAG_SELECTION_SPELLCHECK |
0x0002 |
One of values of aAdditionalFlags of sendQueryContentEvent() . |
QUERY_CONTENT_FLAG_SELECTION_IME_RAWINPUT |
0x0008 |
One of values of aAdditionalFlags of sendQueryContentEvent() . |
QUERY_CONTENT_FLAG_SELECTION_IME_SELECTEDRAWTEXT |
0x0010 |
One of values of aAdditionalFlags of sendQueryContentEvent() . |
QUERY_CONTENT_FLAG_SELECTION_IME_CONVERTEDTEXT |
0x0020 |
One of values of aAdditionalFlags of sendQueryContentEvent() . |
QUERY_CONTENT_FLAG_SELECTION_IME_SELECTEDCONVERTEDTEXT |
0x0040 |
One of values of aAdditionalFlags of sendQueryContentEvent() . |
QUERY_CONTENT_FLAG_SELECTION_ACCESSIBILITY |
0x0080 |
One of values of aAdditionalFlags of sendQueryContentEvent() . |
QUERY_CONTENT_FLAG_SELECTION_FIND |
0x0100 |
One of values of aAdditionalFlags of sendQueryContentEvent() . |
QUERY_CONTENT_FLAG_SELECTION_URLSECONDARY |
0x0200 |
One of values of aAdditionalFlags of sendQueryContentEvent() . |
QUERY_CONTENT_FLAG_SELECTION_URLSTRIKEOUT |
0x0400 |
One of values of aAdditionalFlags of sendQueryContentEvent() . |
QUERY_CONTENT_FLAG_OFFSET_RELATIVE_TO_INSERTION_POINT |
0x0800 |
One of values of aAdditionalFlags of sendQueryContentEvent() . |
QUERY_SELECTED_TEXT |
3200 |
QUERY_SELECTED_TEXT queries the first selection range's information. |
QUERY_TEXT_CONTENT |
3201 |
QUERY_TEXT_CONTENT queries the text at the specified range. |
QUERY_CARET_RECT |
3203 |
QUERY_CARET_RECT queries the (collapsed) caret rect of the offset. If the actual caret is there at the specified offset, this returns the actual caret rect. Otherwise, this guesses the caret rect from the metrics of the text. |
QUERY_TEXT_RECT |
3204 |
QUERY_TEXT_RECT queries the specified text's rect. |
QUERY_EDITOR_RECT |
3205 |
QUERY_TEXT_RECT queries the focused editor's rect. |
QUERY_CHARACTER_AT_POINT |
3208 |
Note: If there are some panels at the point, this method send the query event to the panel's widget automatically. |
QUERY_TEXT_RECT_ARRAY |
3209 |
|
SELECTION_SET_FLAG_USE_NATIVE_LINE_BREAK |
0x0000 |
One of values of aAdditionalFlags of sendSelectionSetEvent() . This flag must not be set with SELECTION_SET_FLAG_USE_XP_LINE_BREAK . When this is set (or not set SELECTION_SET_FLAG_USE_XP_LINE_BREAK) , the aOffset and aLength are offset and length in/of the content generated with native line breaks (E.g., "\r\n" on Windows) |
SELECTION_SET_FLAG_USE_XP_LINE_BREAK |
0x0001 |
One of values of aAdditionalFlags of sendSelectionSetEvent() . This flag must not be set with SELECTION_SET_FLAG_USE_NATIVE_LINE_BREAK . When this is set, the aOffset and aLength are offset and length in/of the content generated with XP line breaks (I.e., "\n" on all platforms). This is more useful for Javascript in chrome |
SELECTION_SET_FLAG_REVERSE |
0x0002 |
One of values of aAdditionalFlags of sendSelectionSetEvent() . If this is set, the selection is set from aOffset + aLength to aOffset . |
SELECT_CHARACTER |
0 |
|
SELECT_CLUSTER |
1 |
|
SELECT_WORD |
2 |
|
SELECT_LINE |
3 |
|
SELECT_BEGINLINE |
4 |
|
SELECT_ENDLINE |
5 |
|
SELECT_PARAGRAPH |
6 |
|
SELECT_WORDNOSPACE |
7 |
|
AGENT_SHEET |
0 |
A possible type of a style sheet loaded/removed with loadSheet() /removeSheet() . See CSS2 specification for details. |
USER_SHEET |
1 |
A possible type of a style sheet loaded/removed with loadSheet() /removeSheet() . See CSS2 specification for details. |
AUTHOR_SHEET |
2 |
A possible type of a style sheet loaded/removed with loadSheet() /removeSheet() . See CSS2 specification for details. |
See nsIWidget.ActivateNativeMenuItemAt()
.
Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.
void activateNativeMenuItemAt( in AString indexString );
indexString
void clearMozAfterPaintEvents();
None.
Compare the two canvases, returning the number of differing pixels and the maximum difference in a channel. This will throw an error if the dimensions of the two canvases are different.
This method requires UniversalXPConnect privileges.
PRUint32 compareCanvases( in nsIDOMHTMLCanvasElement aCanvas1, in nsIDOMHTMLCanvasElement aCanvas2, out unsigned long aMaxDifference );
aCanvas1
aCanvas2
aMaxDifference
Method for testing nsStyleAnimation::ComputeDistance.
Returns the distance between the two values as reported by nsStyleAnimation::ComputeDistance for the given element and property.
double computeAnimationDistance( in nsIDOMElement element, in AString property, in AString value1, in AString value2 );
element
property
value1
value2
Obsolete since Gecko 38 Method for creating an instance which has nsICompositionStringSynthesizer
.
However, this is obsoleted since Gecko 38, use nsITextInputProcessor
instead.
nsICompositionStringSynthesizer createCompositionStringSynthesizer();
An instance of nsICompositionStringSynthesizer
. It's associated with the DOM window which is associated with the instance of nsIDOMWindowUtils.
Disable or enable non synthetic test mouse events on *all* windows.
Cannot be accessed from unprivileged context (not content-accessible). Will throw a DOM security error if called without UniversalXPConnect privileges.
void disableNonTestMouseEvents( in boolean aDisable );
aDisable
true
, disable all non synthetic test mouse events on all windows. Otherwise, enable them.Dispatches aEvent via the nsIPresShell
object of the window's document. The event is dispatched to aTarget, which should be an object which implements nsIContent
interface (#element, #text, etc).
Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.
boolean dispatchDOMEventViaPresShell( in nsIDOMNode aTarget, in nsIDOMEvent aEvent, in boolean aTrusted );
aTarget
aEvent
aTrusted
boolean to show if the event was successful
Retrieve the element at point aX, aY in the window's document.
nsIDOMElement elementFromPoint( in float aX, in float aY, in boolean aIgnoreRootScrollFrame, in boolean aFlushLayout );
aX
aY
aIgnoreRootScrollFrame
false
, this method returns null
for coordinates outside of the viewport.aFlushLayout
true
. Otherwise, no flush occurs.
Put the window into a state where scripts are frozen and events suppressed, for use when the window has launched a modal prompt.
void enterModalState();
None.
Given a view ID from the compositor process, return the corresponding DOM element object.
nsIDOMElement findElementWithViewId( in nsViewID aId );
aId
nsIDOMElement
object.The nsIDOMElement
object for the HTML element drawn by the specified view ID.
<frame>
and <iframe>
), the enclosed document's root element is returned.Focus the element aElement. 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.
Do not use this method. Just use element.focus if available or nsIFocusManager.SetFocus()
instead.
void focus( in nsIDOMElement aElement );
aElement
See nsIWidget.ForceUpdateNativeMenuAt()
.
Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.
void forceUpdateNativeMenuAt( in AString indexString );
indexString
Force a garbage collection followed by a cycle collection.
Will throw a DOM security error if called without UniversalXPConnect privileges in non-debug builds. Available to all callers in debug builds.
void garbageCollect(
in nsICycleCollectorListener aListener Optional
);
aListener
Optional Get current cursor type from this window.
short getCursorType();
None.
The current value of nsCursor.
Function to get metadata associated with the window's current document.
Will throw a DOM security error if called without UniversalXPConnect privileges.
AString getDocumentMetadata( in AString aName );
aName
The value of the metadata, or the empty string if it's not set.
Returns the nsIDOMWindow
matching the specified outer window's ID.
nsIDOMWindow getOuterWindowWithId( in unsigned long long aOuterWindowID );
aOuterWindowID
An nsIDOMWindow
object representing the outer window with the specified ID; if no matching window is found, returns null
.
Returns the number of scripts which profile information was constructed for. This should be used after a call to stopPCCountProfiling()
.
long getPCCountScriptCount();
None.
Returns a summary of the profile information for a script. This should be used after a call to stopPCCountProfiling()
.
AString getPCCountScriptSummary(in long aScript);
aScript
getPCCountScriptCount()
.A JSON string summarizing the information profiled about the script. This includes counts for how often and in what ways the script executed. The structure of the JSON is unspecified and may vary between versions of Firefox.
Returns detailed information about the profile information for a script. This should be used after a call to stopPCCountProfiling()
.
AString getPCCountScriptContents(in long script);
aScript
getPCCountScriptCount()
.A JSON string with all profile information accumulated for the script. This includes the text of the script and details about its internal representation in SpiderMonkey, and counts for how often and in what ways each operation in the script executed. The structure of the JSON is unspecified and may vary between versions of Firefox.
Returns the scroll position of the window's currently loaded document.
void getScrollXY( in boolean aFlushLayout, out long aScrollX, out long aScrollY );
aFlushLayout
true
. Otherwise, no flush occurs.aScrollX
aScrollY
Perform the equivalent of: window.getComputedStyle(aElement, aPseudoElement). getPropertyValue(aPropertyName) except that, when the link whose presence in history is allowed to influence aElement's style is visited, get the value the property would have if allowed all properties to change as a result of :visited selectors (except for cases where getComputedStyle uses data from the frame).
This is easier to implement than adding our property restrictions to this API, and is sufficient for the present testing requirements (which are essentially testing 'color').
AString getVisitedDependentComputedStyle( in nsIDOMElement aElement, in AString aPseudoElement, in AString aPropertyName );
aElement
aPseudoElement
aPropertyName
Is the window is in a modal state? [See enterModalState()
]
boolean isInModalState();
None.
Resume normal window state, where scripts can run and events are delivered.
void leaveModalState();
None.
Synchronously loads a style sheet from |sheetURI| and adds it to the list of additional style sheets of the document.
These additional style sheets are very much like user/agent sheets loaded with loadAndRegisterSheet
. The only difference is that they are applied only on the document owned by this window.
Sheets added via this API take effect immediately on the document.
unsigned long loadSheet( in nsIURI sheetURI, in unsigned long type );
sheetURI
nsIURI
of the CSS file to be removed.type
AGENT_SHEET
, USER_SHEET
or AUTHOR_SHEET
).Returns an nsIDOMNodeList
containing all nodes that intersect a specified rectangle within the window's document. The rectangle is specified using a central point and a distance to expand in all four cardinal directions. This is used to locate nodes that are within some number of pixels of a point; for example, you can use this to find candidate target nodes when the user taps on a touch screen.
nsIDOMNodeList nodesFromRect( in float aX, in float aY, in float aTopSize, in float aRightSize, in float aBottomSize, in float aLeftSize, in boolean aIgnoreRootScrollFrame, in boolean aFlushLayout );
aX
aY
aTopSize
(aX, aY)
.aRightSize
(aX, aY)
.aBottomSize
(aX, aY)
.aLeftSize
(aX, aY)
.aIgnoreRootScrollFrame
false
, this method will return null
for coordinates outside the viewport.aFlushLayout
true
, layout is flushed before hit testing begins. This ensures that the node list is current. If you don't need an absolutely up to date node list, you can set this to false
.An nsIDOMNodeList
referencing all the nodes that intersect the specified rectangle.
Force processing of any queued paints.
void processUpdates();
None.
Purge all accumulated profile information for scripts which was generated after a call to stopPCCountProfiling()
.
void purgePCCounts();
None.
Force an immediate redraw of this window. The parameter specifies the number of times to redraw, and the return value is the length, in milliseconds, that the redraws took. If aCount is not specified or is 0, it is taken to be 1.
unsigned long redraw(
in unsigned long aCount Optional
);
aCount
Optional
Remove the document style sheet at sheetURI
from the list of additional style sheets of the document. The removal takes effect immediately.
unsigned long removeSheet( in nsIURI sheetURI, in unsigned long type );
sheetURI
nsIURI
of the CSS file to be removed.type
AGENT_SHEET
, USER_SHEET
or AUTHOR_SHEET
).
void RenderDocument( in nsConstRect aRect, in PRUint32 aFlags, in nscolor aBackgroundColor, in gfxContext aThebesContext );
aRect
aFlags
aBackgroundColor
aThebesContext
Resumes timeouts on this window and its descendant windows.
void resumeTimeouts();
None.
Obsolete since Gecko 38 Synthesize a composition event to the window.
Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.
This is obsoleted since Gecko 38. Use nsITextInputProcessor
, instead.
void sendCompositionEvent(
in AString aType,
); Obsolete since Gecko 9
aType
"compositionstart"
or "compositionend"
.void sendCompositionEvent(
in AString aType,
in AString aData,
in AString aLocale
); Obsolete since Gecko 38
aType
"compositionstart"
or "compositionend"
Obsolete since Gecko 36. Since Gecko 36, specifying "compositionend"
isn't fired anything. Instead, use "compositioncommitasis"
or "compositioncommit".
"compositionupdate"
. Obsolete since Gecko 35 Note that, since Gecko 35, specifying "compositionupdate"
isn't fired anything. Instead, compositionupdate
event is fired automatically when it should be fired."compositioncommitasis"
or "compositioncommit"
. "compositioncommitasis"
will cause commiting the composition with the last composing string. "compositioncommit"
will cause commiting the composition with aData
. Both compositionupdate
event and compositionend
event are fired automatically if they are necessary.aType
is "compositionstart" or "compositioncommitasis", this is ignored.Returns the real classname (possibly of the mostly-transparent security wrapper) of aObj.
Generate a content command event.
Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.
void sendContentCommandEvent(
in AString aType,
in nsITransferable aTransferable Optional
);
aType
aTransferable
OptionalnsITransferable
when aType is "pasteTransferable"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.
However, this is deprecated since Gecko 38 (and will be obsolete soon), use nsITextInputProcessor
instead.
boolean sendKeyEvent( in AString aType, in long aKeyCode, in long aCharCode, in long aModifiers, in unsigned long aAdditionalFlags Optional ); Deprecated since Gecko 38.0
boolean sendKeyEvent( in AString aType, in long aKeyCode, in long aCharCode, in long aModifiers, in boolean aPreventDefault Optional ); Obsolete since Gecko 15.0
aType
aKeyCode
aCharCode
aModifiers
nsIDOMNSEvent
. Obsolete since Gecko 15.0aPreventDefault
Optional Obsolete since Gecko 15.0true
, preventDefault() the event before dispatch.aAdditionalFlags
Optional 0
or KEY_FLAG_PREVENT_DEFAULT
and/or one of KEY_FLAG_LOCATION_*
.KEY_FLAG_PREVENT_DEFAULT
is specified, the dispatching key event's default is prevented.KEY_FLAG_LOCATION_*
isn't set, an appropriate location is automatically computed from aKeyCode
. If two or more KEY_FLAG_LOCATION_*
is specified, this method will throw an exception.false
if the event had preventDefault() called on it, true
otherwise. In other words, true
if and only if the default action was taken.
Synthesize a mouse event. The event types supported are: mousedown, mouseup, mousemove, mouseover, mouseout, contextmenu.
Events are sent in coordinates offset by aX and aY from the window.
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.
The event is dispatched via the toplevel window, so it could go to any window under the toplevel window, in some cases it could never reach this window at all.
void sendMouseEvent(
in AString aType,
in float aX,
in float aY,
in long aButton,
in long aClickCount,
in long aModifiers,
in boolean aIgnoreRootScrollFrame Optional
);
aType
aX
aY
aButton
aClickCount
aModifiers
nsIDOMNSEvent
. Obsolete since Gecko 15.0aIgnoreRootScrollFrame
Optional The same as sendMouseEvent()
but ensures that the event is dispatched to this DOM window or one of its children.
void sendMouseEventToWindow(
in AString aType,
in float aX,
in float aY,
in long aButton,
in long aClickCount,
in long aModifiers,
in boolean aIgnoreRootScrollFrame Optional
);
aType
aX
aY
aButton
aClickCount
aModifiers
nsIDOMNSEvent
. Obsolete since Gecko 15.0aIgnoreRootScrollFrame
Optional Obsolete since Gecko 17.0 (Firefox 17.0 / Thunderbird 17.0 / SeaMonkey 2.14)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
Synthesize a mouse scroll event for a window. The event types supported are: DOMMouseScroll MozMousePixelScroll.
Events are sent in coordinates offset by aX and aY from the window.
Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.
void sendMouseScrollEvent( in AString aType, in float aX, in float aY, in long aButton, in long aScrollFlags, in long aDelta, in long aModifiers );
aType
aX
aY
aButton
aScrollFlags
aDelta
aModifiers
nsIDOMNSEvent
. Obsolete since Gecko 15.0Synthesize a wheel event for a window. The event type is always "wheel".
Events are sent in coordinates offset by aX and aY from the window.
Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.
void sendWheelEvent( in float aX, in float aY, in double aDeltaX, in double aDeltaY, in double aDeltaZ, in unsigned long aDeltaMode, in long aModifiers, in long aLineOrPageDeltaX, in long aLineOrPageDeltaY, in unsigned long aOptions );
aX
aY
aDeltaX
aDeltaY
aDeltaZ
aDeltaMode
WheelEvent
(nsIDOMWheelEvent
).aModifiers
aLineOrPageDeltaX
DOM_DELTA_PIXEL
or DOM_DELTA_LINE
) or pages (if aDeltaMode is DOM_DELTA_PAGE
). If this values isn't 0, horizontal DOMMouseScroll
event will be dispatched with this value. However, this value may be ignored by nsEventStateManager
if some prefs are customized or aOptions
value includes some flags.aLineOrPageDeltaY
DOM_DELTA_PIXEL
or DOM_DELTA_LINE
) or pages (if aDeltaMode is DOM_DELTA_PAGE
). If this values isn't 0, vertical DOMMouseScroll
event will be dispatched with this value. However, this value may be ignored by nsEventStateManager
if some prefs are customized or aOptions
value includes some flags.aOptions
WHEEL_EVENT_*
flags.This method lets you create and send keyboard events to a DOM window from a privileged context; for example, this can be used to automate testing. This delivers the key to the currently-focused widget by calling its See nsIWidget.synthesizeNativeKeyEvent()
method.
This method throws a DOM security error if called without UniversalXPConnect privileges.
void sendNativeKeyEvent( in long aNativeKeyboardLayout, in long aNativeKeyCode, in long aModifierFlags, in AString aCharacters, in AString aUnmodifiedCharacters );
aNativeKeyboardLayout
aNativeKeyCode
aModifierFlags
aCharacters
aUnmodifiedCharacters
See nsIWidget.SynthesizeNativeMouseEvent()
.
Will be called on the widget that contains aElement. Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.
void sendNativeMouseEvent( in long aScreenX, in long aScreenY, in long aNativeMessage, in long aModifierFlags, in nsIDOMElement aElement );
aScreenX
aScreenY
aNativeMessage
aModifierFlags
aElement
Synthesize a query content event.
nsIQueryContentEventResult sendQueryContentEvent(
in unsigned long aType,
in unsigned long aOffset,
in unsigned long aLength,
in long aX,
in long aY,
in unsigned long aAdditionalFlags Optional
);
nsIQueryContentEventResult sendQueryContentEvent(
in unsigned long aType,
in unsigned long aOffset,
in unsigned long aLength,
in long aX,
in long aY
); Obsolete since Gecko 31.0
aType
aOffset
aLength
aX
aY
aAdditionalFlags
QUERY_CONTENT_FLAG_*
.
Synthesize a selection set event to the window.
This sets the selection as the specified information.
boolean sendSelectionSetEvent(
in unsigned long aOffset,
in unsigned long aLength,
in unsigned long aAdditionalFlags Optional
);
boolean sendSelectionSetEvent(
in unsigned long aOffset,
in unsigned long aLength,
in boolean aReverse
); Obsolete since Gecko 31.0
aOffset
aLength
aReverse
Obsolete since Gecko 31.0true
, the selection set from |aOffset + aLength| to |aOffset|. Otherwise, set from |aOffset| to |aOffset + aLength|.aAdditionalFlags
SELECTION_SET_FLAG_*
.True
, if succeeded. Otherwise, false
.
Synthesize a simple gesture event for a window. The event types supported are: MozSwipeGestureMayStart, MozSwipeGestureStart, MozSwipeGestureUpdate, MozSwipeGestureEnd, MozSwipeGesture, MozMagnifyGestureStart, MozMagnifyGestureUpdate, MozMagnifyGesture, MozRotateGestureStart, MozRotateGestureUpdate, MozRotateGesture, MozPressTapGesture, MozTapGesture, and MozEdgeUIGesture.
Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges.
void sendSimpleGestureEvent(
in AString aType,
in float aX,
in float aY,
in unsigned long aDirection,
in double aDelta,
in long aModifiers,
in unsigned long aClickCount Optional
);
aType
aX
aY
aDirection
nsIDOMSimpleGestureEvent
.aDelta
aModifiers
nsIDOMNSEvent
. Obsolete since Gecko 15.0aClickCount
Obsolete since Gecko 26 This can create composition string with 3 or less clauses. Use createCompositionStringSynthesizer() instead. New API doesn't have this limitation.
void sendTextEvent( in AString aCompositionString, in long aFirstClauseLength, in unsigned long aFirstClauseAttr, in long aSecondClauseLength, in unsigned long aSecondClauseAttr, in long aThirdClauseLength, in unsigned long aThirdClauseAttr, in long aCaretStart, in long aCaretLength );
aCompositionString
aFirstClauseLength
aFirstClauseAttr
aSecondClauseLength
aSecondClauseAttr
aThirdClauseLength
aThirdClauseAttr
aCaretStart
aCaretLength
Synthesizes a touch event and sends it to the window. This method supports multiple touches of the same type, but not multiple touches on the screen of different types.
The event is dispatched via the top-level window, so it could go to any window under that top level. In some cases, it may not even reach the target window, if one of those other windows accepts it.
boolean sendTouchEvent( in AString aType, [array, size_is(count)] in PRUint32 aIdentifiers, [array, size_is(count)] in PRInt32 aXs, [array, size_is(count)] in PRInt32 aYs, [array, size_is(count)] in PRUint32 aRxs, [array, size_is(count)] in PRUint32 aRys, [array, size_is(count)] in float aRotationAngles, [array, size_is(count)] in float aForces, in PRUint32 count, in long aModifiers, [optional] in boolean aIgnoreRootScrollFrame );
aType
aIdentifiers
aXs
aYs
aRxs
aRys
aRotationAngles
aForces
count
aModifiers
nsIDOMNSEvent
. Obsolete since Gecko 15.0aIgnoreRootScrollFrames
true
if the page called Event.preventDefault()
, indicating that default processing of the event should not occur.
Sets the dimensions of the CSS viewport to the specified size in CSS pixels, regardless of the size of the enclosing widget/view. This triggers reflow.
The caller of this method must have UniversalXPConnect privileges.
window.innerWidth
and window.innerHeight
properties return the size of the viewport you've specified instead of the size of the browser widget.void setCSSViewport( in float aWidthPx, in float aHeightPx );
aWidthPx
aHeightPx
Set the "displayport" to be <xPx, yPx, widthPx, heightPx> in units of CSS pixels, regardless of the size of the enclosing widget/view. This will *not* trigger reflow.
<x, y> is relative to the top-left of the CSS viewport. This means that the pixels rendered to the displayport take scrolling into account, for example.
The displayport will be used as the window's visible region for the purposes of invalidation and painting. The displayport can approximately be thought of as a "persistent" drawWindow() (albeit with coordinates relative to the CSS viewport): the bounds are remembered by the platform, and layer pixels are retained and updated inside the viewport bounds.
It's legal to set a displayport that extends beyond the CSS viewport in any direction (left/right/top/bottom).
It's also legal to set a displayport that extends beyond the document's bounds. The value of the pixels rendered outside the document bounds is not yet defined.
The caller of this method must have UniversalXPConnect privileges.
void setDisplayPort( in float aXPx, in float aYPx, in float aWidthPx, in float aHeightPx );
aXPx
aYPx
aWidthPx
aHeightPx
Get/set the resolution at which rescalable web content is drawn. Currently this is only (some) thebes content.
Setting a new resolution does *not* trigger reflow. This API is entirely separate from textZoom and fullZoom; a resolution scale can be applied together with both textZoom and fullZoom.
The effect of is API for gfx code to allocate more or fewer pixels for rescalable content by a factor of |resolution| in either or both dimensions. setResolution
together with setDisplayport()
can be used to implement a non-reflowing scale-zoom in concert with another entity that can draw with a scale. For example, to scale a content |window| inside a <browser> by a factor of 2.0.
window.setDisplayport()
(x, y, oldW / 2.0, oldH / 2.0); window.setResolution
(2.0, 2.0); // elsewhere browser.setViewportScale(2.0, 2.0);
The caller of this method must have UniversalXPConnect privileges.
void setResolution( in float aXResolution, in float aYResolution );
aXResolution
aYResolution
Begins detailed profiling of all executed JavaScript code in the browser. This slows down JavaScript execution, but accumulates information about what code has executed that may be queried after a call to stopPCCountProfiling()
.
void startPCCountProfiling();
None.
Stops profiling of executed JavaScript code. Profile information about code that has executed since a preceding call to startPCCountProfiling()
will be constructed, and will be retained until a call to purgePCCounts()
. This profile information may be queried using getPCCountScriptCount()
, getPCCountScriptSummary()
, and getPCCountScriptContents()
.
void stopPCCountProfiling();
None.
Suppresses/unsuppresses user initiated event handling in window's document and subdocuments.
void suppressEventHandling( in boolean aSuppress );
aSuppress
Suspend/resume timeouts on this window and its descendant windows.
void suspendTimeouts();
None.
Wraps the specified nsIDOMFile
in a DOM File
object.
nsIDOMFile wrapDOMFile( nsIFile aFile );
aFile
nsIFile
object to wrap in a DOM File
object.An nsIDOMFile
object, which is a DOM File
. You can then use that object with DOM methods that use the File API.