Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

这篇文章需要技术复核。如何帮忙。

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!

This interface is a DOM utility interface that provides useful DOM methods and attributes.
1.0
51
Introduced
Gecko 1.8
Inherits from: nsISupports Last changed in Gecko 38.0 (Firefox 38.0 / Thunderbird 38.0 / SeaMonkey 2.35)

Implemented by: nsIDOMWindow. To get this interface, use:

var domWindowUtils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                     .getInterface(Components.interfaces.nsIDOMWindowUtils);

Method overview

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();
nsIDOMElement findElementWithViewId(in nsViewID aId); Mobile Only in Gecko 2.0
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);
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
nsIQueryContentEventResult sendQueryContentEvent(in unsigned long aType, in unsigned long aOffset, in unsigned long aLength, in long aX, in long aY, [optional] in unsigned long aAdditionalFlags);
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(nsIFile aFile);

Attributes

Attribute Type Description
currentInnerWindowID unsigned long long

The ID of the window's current inner window. Read only.

Exceptions thrown
NS_ERROR_NOT_AVAILABLE
There is no current inner window
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.
focusedInputType string The type of the currently-focused HTML <input> element, if one is focused. Mobile Only in Gecko 2.0
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

true if painting is currently suppressed for this window; otherwise false. Read only.

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.

Constants

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 QUERY_CONTENT_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). 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

QUERY_CHARACTER_AT_POINT queries the character information at the specified point. The point is offset in the window.

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.

Methods

activateNativeMenuItemAt()

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
);
Parameters
indexString
 

clearMozAfterPaintEvents()

void clearMozAfterPaintEvents();
Parameters

None.

compareCanvases()

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
);
Parameters
aCanvas1
 
aCanvas2
 
aMaxDifference
 
Return value

 

computeAnimationDistance()

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
);
Parameters
element
 
property
 
value1
 
value2
 
Return value

 

createCompositionStringSynthesizer()

Obsolete since Gecko 38 Method for creating an instance which has nsICompositionStringSynthesizer.

However, this is obsoleted since Gecko 38, use nsITextInputProcessor instead.

nsICompositionStringSynthesizer createCompositionStringSynthesizer();
Return value

An instance of nsICompositionStringSynthesizer. It's associated with the DOM window which is associated with the instance of nsIDOMWindowUtils.

disableNonTestMouseEvents()

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
);
Parameters
aDisable
If true, disable all non synthetic test mouse events on all windows. Otherwise, enable them.

dispatchDOMEventViaPresShell()

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.

Note: Event handlers won't get aEvent as parameter, but a similar event. Also, aEvent should not be reused.

boolean dispatchDOMEventViaPresShell(
  in nsIDOMNode aTarget,
  in nsIDOMEvent aEvent,
  in boolean aTrusted
);
Parameters
aTarget
 
aEvent
 
aTrusted
 
Return value

boolean to show if the event was successful

 

elementFromPoint()

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
);
Parameters
aX
 
aY
 
aIgnoreRootScrollFrame
Whether or not to ignore the root scroll frame when retrieving the element. If false, this method returns null for coordinates outside of the viewport.
aFlushLayout
Flushes layout if true. Otherwise, no flush occurs.
Return value

 

enterModalState()

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();
Parameters

None.

findElementWithViewId()

Mobile Only in Gecko 2.0
Available only in Firefox Mobile as of Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Given a view ID from the compositor process, return the corresponding DOM element object.

nsIDOMElement findElementWithViewId(
  in nsViewID aId
); 
Parameters
aId
The ID of the view for which to retrieve the corresponding nsIDOMElement object.
Return value

The nsIDOMElement object for the HTML element drawn by the specified view ID.

Note: For scrollable frames containing documents (that is, <frame> and <iframe>), the enclosed document's root element is returned.

focus()

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
);
Parameters
aElement
The element to focus.

forceUpdateNativeMenuAt()

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
);
Parameters
indexString
 

garbageCollect()

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 
);
Parameters
aListener Optional
Listener that receives information about the CC graph (see @mozilla.org/cycle-collector-logger;1 for a logger component)

getCursorType()

Get current cursor type from this window.

short getCursorType();
Parameters

None.

Return value

The current value of nsCursor.

getDocumentMetadata()

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
);
Parameters
aName
The name of the metadata. This should be all lowercase.
Return value

The value of the metadata, or the empty string if it's not set.

getOuterWindowWithId()

Returns the nsIDOMWindow matching the specified outer window's ID.

nsIDOMWindow getOuterWindowWithId(
  in unsigned long long aOuterWindowID
);
Parameters
aOuterWindowID
The ID of the outer window for which to return the window.
Return value

An nsIDOMWindow object representing the outer window with the specified ID; if no matching window is found, returns null.


getPCCountScriptCount()

Returns the number of scripts which profile information was constructed for.  This should be used after a call to stopPCCountProfiling().

long getPCCountScriptCount();
Parameters

None.

getPCCountScriptSummary()

Returns a summary of the profile information for a script.  This should be used after a call to stopPCCountProfiling().

AString getPCCountScriptSummary(in long aScript);
Parameters
aScript
Index of the profiled script to get the profile summary for.  Should be less than getPCCountScriptCount().
Return value

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.

getPCCountScriptContents()

Returns detailed information about the profile information for a script.  This should be used after a call to stopPCCountProfiling().

AString getPCCountScriptContents(in long script);
Parameters
aScript
Index of the profiled script to get the profile contents for.  Should be less than getPCCountScriptCount().
Return value

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.

getScrollXY()

Returns the scroll position of the window's currently loaded document.

void getScrollXY(
  in boolean aFlushLayout,
  out long aScrollX,
  out long aScrollY
);
Parameters
aFlushLayout
Flushes layout if true. Otherwise, no flush occurs.
aScrollX
 
aScrollY
 

getVisitedDependentComputedStyle()

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
);
Parameters
aElement
 
aPseudoElement
 
aPropertyName
 
Return value

 

isInModalState()

Is the window is in a modal state? [See enterModalState()]

boolean isInModalState();
Parameters

None.

Return value

 

leaveModalState()

Resume normal window state, where scripts can run and events are delivered.

void leaveModalState();
Parameters

None.

 

loadSheet()

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
);
Parameters
sheetURI
The nsIURI of the CSS file to be removed.
type
The type of the sheet (AGENT_SHEET, USER_SHEET or AUTHOR_SHEET).

nodesFromRect()

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
);
Parameters
aX
The X coordinate of the point at which to begin constructing the rectangle, in CSS pixels.
aY
The Y coordinate of the point at which to begin constructing the rectangle, in CSS pixels.
aTopSize
The number of CSS pixels to expand the rectangle upward from the point (aX, aY).
aRightSize
The number of CSS pixels to expand the rectangle to the right from the point (aX, aY).
aBottomSize
The number of CSS pixels to expand the rectangle downward from the point (aX, aY).
aLeftSize
The number of CSS pixels to expand the rectangle to the left from the point (aX, aY).
aIgnoreRootScrollFrame
Whether or not to ignore the root scroll frame when retrieving the nodes. If this is false, this method will return null for coordinates outside the viewport.
aFlushLayout
If 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.
Return value

An nsIDOMNodeList referencing all the nodes that intersect the specified rectangle.

processUpdates()

Obsolete since Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10)

Force processing of any queued paints.

void processUpdates();
Parameters

None.

purgePCCounts()

Purge all accumulated profile information for scripts which was generated after a call to stopPCCountProfiling().

void purgePCCounts();
Parameters

None.

redraw()

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 
);
Parameters
aCount Optional
 
Return value

 

removeSheet()

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
);
Parameters
sheetURI
The nsIURI of the CSS file to be removed.
type
The type of the sheet (AGENT_SHEET, USER_SHEET or AUTHOR_SHEET).

 

Native code only!

RenderDocument

void RenderDocument(
  in nsConstRect aRect,
  in PRUint32 aFlags,
  in nscolor aBackgroundColor,
  in gfxContext aThebesContext
);
Parameters
aRect
 
aFlags
 
aBackgroundColor
 
aThebesContext
 

resumeTimeouts()

Resumes timeouts on this window and its descendant windows.

void resumeTimeouts();
Parameters

None.

sendCompositionEvent()

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
Parameters
aType
The event type: "compositionstart" or "compositionend".
void sendCompositionEvent(
  in AString aType,
  in AString aData, 
  in AString aLocale
);  Obsolete since Gecko 38
Parameters
aType
The event type: "compositionstart" or "compositionend" Obsolete since Gecko 36. Since Gecko 36, specifying "compositionend" isn't fired anything. Instead, use "compositioncommitasis" or "compositioncommit".

Or "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.

Or "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.
aData
The data value of dispatching composition event. If aType is "compositionstart" or "compositioncommitasis", this is ignored.
aLocale
The locale value of dispatching composition event.

getClassName()

Returns the real classname (possibly of the mostly-transparent security wrapper) of aObj.

sendContentCommandEvent()

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
);
Parameters
aType
Type of command content event to send. Can be one of "cut", "copy", "paste", "delete", "undo", "redo", or "pasteTransferable".
aTransferable Optional
An instance of nsITransferable when aType is "pasteTransferable"

sendKeyEvent()

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
Parameters
aType
Event type.
aKeyCode
Key code.
aCharCode
Character code.
aModifiers
Modifiers pressed.
Using constants defined in nsIDOMNSEvent. Obsolete since Gecko 15.0
Using constants defined as MODIFIER_*.
aPreventDefault Optional Obsolete since Gecko 15.0
If true, preventDefault() the event before dispatch.
aAdditionalFlags Optional
0 or KEY_FLAG_PREVENT_DEFAULT and/or one of KEY_FLAG_LOCATION_*.
If KEY_FLAG_PREVENT_DEFAULT is specified, the dispatching key event's default is prevented.
If 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.
Return value

false if the event had preventDefault() called on it, true otherwise. In other words, true if and only if the default action was taken.

sendMouseEvent()

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.

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.

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 
);
Parameters
aType
Event type.
aX
X offset in CSS pixels.
aY
Y offset in CSS pixels.
aButton
Button to synthesize.
aClickCount
Number of clicks that have been performed.
aModifiers
Modifiers pressed.
Using constants defined in nsIDOMNSEvent. Obsolete since Gecko 15.0
Using constants defined as MODIFIER_*.
aIgnoreRootScrollFrame Optional
Whether the event should ignore viewport bounds during dispatch.

sendMouseEventToWindow()

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
);
Parameters
aType
 
aX
 
aY
 
aButton
 
aClickCount
 
aModifiers
Modifiers pressed.
Using constants defined in nsIDOMNSEvent. Obsolete since Gecko 15.0
Using constants defined as MODIFIER_*.
aIgnoreRootScrollFrame Optional
 

sendMouseScrollEvent()

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
);
Parameters
aType
Event type.
aX
X offset in CSS pixels.
aY
Y offset in CSS pixels.
aButton
Button to synthesize.
aScrollFlags
Flag bits --- see nsMouseScrollFlags in nsGUIEvent.h.
aDelta
The direction and amount to scroll (in lines or pixels, depending on the event type)
aModifiers
Modifiers pressed.
Using constants defined in nsIDOMNSEvent. Obsolete since Gecko 15.0
Using constants defined as MODIFIER_*.

sendWheelEvent()

Synthesize 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
);
Parameters
aX
X offset in CSS pixels.
aY
Y offset in CSS pixels.
aDeltaX
Delta value around x-axis.
aDeltaY
Delta value around y-axis.
aDeltaZ
Delta value around z-axis.
aDeltaMode
One of delta mode values which are defined by WheelEvent (nsIDOMWheelEvent).
aModifiers
Modifiers pressed. Using constants defined as MODIFIER_*.
aLineOrPageDeltaX
Scroll amount around x-axis by lines (if aDeltaMode is 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
Scroll amount around y-axis by lines (if aDeltaMode is 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
0 or one or more WHEEL_EVENT_* flags.

sendNativeKeyEvent()

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
);
Parameters
aNativeKeyboardLayout
 
aNativeKeyCode
The key code to send.
aModifierFlags
The modifier flags to send.
aCharacters
 
aUnmodifiedCharacters
 

sendNativeMouseEvent()

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
);
Parameters
aScreenX
 
aScreenY
 
aNativeMessage
 
aModifierFlags
 
aElement
 

sendQueryContentEvent()

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
Parameters
aType
On of the following const values. And see also each comment for the other parameters and the result.
aOffset
 
aLength
 
aX
 
aY
 
aAdditionalFlags
See the explanation of QUERY_CONTENT_FLAG_*.
Return value

 

sendSelectionSetEvent()

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
Parameters
aOffset
The caret offset of the selection start.
aLength
The length of the selection. If this is too long, the extra length is ignored.
aReverse Obsolete since Gecko 31.0
If true, the selection set from |aOffset + aLength| to |aOffset|. Otherwise, set from |aOffset| to |aOffset + aLength|.
aAdditionalFlags
See the explanation of SELECTION_SET_FLAG_*.
Return value

True, if succeeded. Otherwise, false.

sendSimpleGestureEvent()

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
);
Parameters
aType
Event type.
aX
X offset in CSS pixels.
aY
Y offset in CSS pixels.
aDirection
Direction, using constants defined in nsIDOMSimpleGestureEvent.
aDelta
Amount of magnification or rotation for magnify and rotation events.
aModifiers
Modifiers pressed, using constants defined in nsIDOMNSEvent. Obsolete since Gecko 15.0
Using constants defined as MODIFIER_*.
aClickCount
For tap gestures, the number of taps.

sendTextEvent()

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
);
Parameters
aCompositionString
 
aFirstClauseLength
 
aFirstClauseAttr
 
aSecondClauseLength
 
aSecondClauseAttr
 
aThirdClauseLength
 
aThirdClauseAttr
 
aCaretStart
 
aCaretLength
 

sendTouchEvent()

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.

Note: This method cannot be called from unprivileged content; that is, it's not accessible from web content. It will throw a DOM security error if called without UniversalXPConnect privileges.

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
);
Parameters
aType
The touch event type to dispatch to the window. This must be one of "touchstart", "touchend", "touchmove", or "touchcancel".
aIdentifiers
An array of the identifiers for each of the touches.
aXs
An array of X offsets in CSS pixels for each touch to be sent to the window.
aYs
An array of Y offsets in CSS pixels for each touch to be sent to the window.
aRxs
An array of touch X radii in CSS pixels for each touch to be sent to the window.
aRys
An array of touch Y radii in CSS pixels for each touch to be sent to the window.
aRotationAngles
An array of angles in degrees for each touch's touch oval.
aForces
An array of forces (from 0 to 1) indicating the amount of pressure applied at each touch point.
count
The number of touches; this is the number of entries in each of the preceding arrays.
aModifiers
Modifiers pressed.
Using constants defined in nsIDOMNSEvent. Obsolete since Gecko 15.0
Using constants defined as MODIFIER_*.
aIgnoreRootScrollFrames
A Boolean value indicating whether or not the event should ignore viewport bounds during dispatch.
Return value

true if the page called Event.preventDefault(), indicating that default processing of the event should not occur.

setCSSViewport()

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.

Note: After calling this method, the 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
);
Parameters
aWidthPx
The width of the viewport in CSS pixels.
aHeightPx
The height of the viewport in CSS pixels.

setDisplayPort()

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
);
Parameters
aXPx
 
aYPx
 
aWidthPx
 
aHeightPx
 

setResolution()

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
);
Parameters
aXResolution
 
aYResolution
 

startPCCountProfiling()

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();
Parameters

None.

stopPCCountProfiling()

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();
Parameters

None.

suppressEventHandling()

Suppresses/unsuppresses user initiated event handling in window's document and subdocuments.

void suppressEventHandling(
  in boolean aSuppress
);
Parameters
aSuppress
 

suspendTimeouts()

Suspend/resume timeouts on this window and its descendant windows.

void suspendTimeouts();
Parameters

None.

wrapDOMFile()

Wraps the specified nsIDOMFile in a DOM File object.

nsIDOMFile wrapDOMFile(
  nsIFile aFile
);
Parameters
aFile
The nsIFile object to wrap in a DOM File object.
Return value

An nsIDOMFile object, which is a DOM File. You can then use that object with DOM methods that use the File API.

文档标签和贡献者

 最后编辑者: Makyen,