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.

nsIContentViewer

This article needs a technical review. How you can help.

Handles displaying content.
Inherits from: nsISupports Last changed in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7)

Implemented by: ?????????????????????????????????????. To create an instance, use:

var contentViewer = Components.classes["@mozilla.org/????????????????????????????"]
                    .createInstance(Components.interfaces.nsIContentViewer);

Method overview

void clearHistoryEntry();
void close(in nsISHEntry historyEntry);
void destroy();
[noscript,notxpcom,nostdcall] nsIViewPtr findContainerView();
void getBounds(in nsIntRectRef aBounds); Native code only!
[noscript,notxpcom] nsIDocumentPtr getDocument();
void hide();
void init(in nsIWidgetPtr aParentWidget, [const] in nsIntRectRef aBounds); Native code only!
void loadComplete(in unsigned long aStatus);
void loadStart(in nsISupports aDoc);
void move(in long aX, in long aY);
void open(in nsISupports aState, in nsISHEntry aSHEntry);
void pageHide(in boolean isUnload);
boolean permitUnload([optional] in boolean aCallerClosesWindow);
boolean requestWindowClose();
void resetCloseWindow();
void setBounds([const] in nsIntRectRef aBounds); Native code only!
void setDocumentInternal(in nsIDocumentPtr aDocument, in boolean aForceReuseInnerWindow); Native code only!
[noscript,notxpcom,nostdcall] void setNavigationTiming(in nsDOMNavigationTimingPtr aTiming);
void setPageMode(in boolean aPageMode, in nsIPrintSettings aPrintSettings);
void show();
void stop();
void unload(); Obsolete since Gecko 1.8

Attributes

Attribute Type Description
container nsISupports  
DOMDocument nsIDOMDocument  
enableRendering boolean Obsolete since Gecko 2.0
historyEntry nsISHEntry Get the history entry that this viewer will save itself into when destroyed. Can return null. Read only.
isTabModalPromptAllowed boolean Read only.
presContext nsPresContextPtr

Read only. Native code only!

Note: Prior to Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7), this attribute was part of nsIDocumentViewer.
presShell nsIPresShellPtr

Read only. Native code only!

Note: Prior to Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7), this attribute was part of nsIDocumentViewer.
previousViewer nsIContentViewer The previous content viewer, which has been closed but not destroyed. Native code only!
sticky boolean  

Methods

Requires Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

clearHistoryEntry()

Clears the current history entry. This is used to clear out the saved presentation state.

void clearHistoryEntry();
Parameters

None.

close()

All users of a content viewer are responsible for calling both close() and destroy(), in that order.

close() should be called when the load of a new page for the next content viewer begins, and destroy() should be called when the next content viewer replaces this one.

Note: If the document is currently being printed, it will not be saved in session history.
void close(
  in nsISHEntry historyEntry
);
Parameters
historyEntry
The session history entry for the content viewer. If this is null, then destroy() will be called on the document by close(). If it is non-null, the document will not be destroyed, and the following actions will happen when destroy() is called:
  • Sanitize() will be called on the viewer's document
  • The content viewer will set the contentViewer property on the history entry, and release its reference (ownership reversal).
  • Hide() will be called, and no further destruction will happen.

destroy()

void destroy();
Parameters

None.

Requires Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7)

findContainerView()

Finds the view to use as the container view for MakeWindow.

Note: Prior to Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7), this attribute was part of nsIDocumentViewer.
[noscript,notxpcom,nostdcall] nsIViewPtr findContainerView();
Parameters

None.

Return value

The container view, or null if this content viewer is the root of a view manager hierarchy.

Note: If this container is the root of a view manager hierarchy (that is, this method returns null), and mParentWidget is also null, then this document should not even be displayed.

Native code only!

getBounds

void getBounds(
  in nsIntRectRef aBounds
);
Parameters
aBounds
Missing Description

Requires Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

getDocument()

Returns the DOM document object (as an nsIDocument without addrefing.

[noscript,notxpcom] nsIDocumentPtr getDocument();
Parameters

None.

Return value

The DOM document object.

hide()

void hide();
Parameters

None.

Native code only!

init

Initializes the content viewer.

void init(
  in nsIWidgetPtr aParentWidget,
  [const] in nsIntRectRef aBounds
);
Parameters
aParentWidget
Missing Description
aBounds
Missing Description

loadComplete()

void loadComplete(
  in unsigned long aStatus
);
Parameters
aStatus
Missing Description
Exceptions thrown
Missing Exception
Missing Description

loadStart()

void loadStart(
  in nsISupports aDoc
);
Parameters
aDoc
Missing Description
Exceptions thrown
Missing Exception
Missing Description

move()

void move(
  in long aX,
  in long aY
);
Parameters
aX
Missing Description
aY
Missing Description

Requires Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

open()

Attaches the content viewer to its DOM window and docshell.

void open(
  in nsISupports aState,
  in nsISHEntry aSHEntry
);
Parameters
aState
A state object that might be useful in attaching the DOM window.
aSHEntry
The history entry that the content viewer was stored in. The entry must have the docshells for all of the child documents stored in its child shell list.

Requires Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

pageHide()

void pageHide(
  in boolean isUnload
);
Parameters
isUnload
Missing Description
Exceptions thrown
Missing Exception
Missing Description

permitUnload()

Determins whether or not the document wants to prevent unloading by firing beforeunload on the document, and if it does, prompts the user. The result is returned.

boolean permitUnload(
  in boolean aCallerClosesWindow Optional
);
Parameters
aCallerClosesWindow Optional
Indicates that the current caller will close() the window. If the method returns true, all subsequent calls will be ignored.
Return value

true if the document will allow unloading; otherwise false.

requestWindowClose()

boolean requestWindowClose();
Parameters

None.

Return value

Missing Description

Exceptions thrown
Missing Exception
Missing Description

Requires Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)

resetCloseWindow()

Works in tandem with permitUnload(), if the caller decides not to close() the window it indicated it will, it is the caller's responsibility to reset that with this method.

Note: @Note this method is only meant to be called on documents for which the caller has indicated that it will close the window. If that is not the case the behavior of this method is undefined.

void resetCloseWindow();
Parameters

None.

Exceptions thrown
Missing Exception
Missing Description

Native code only!

setBounds

void setBounds(
  [const] in nsIntRectRef aBounds
);
Parameters
aBounds
Missing Description

Native code only!

setDocumentInternal

Note: Prior to Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7), this attribute was part of nsIDocumentViewer.
void setDocumentInternal(
  in nsIDocumentPtr aDocument,
  in boolean aForceReuseInnerWindow
);
Parameters
aDocument
Missing Description
aForceReuseInnerWindow
Missing Description

Requires Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7)

setNavigationTiming()

Set collector for navigation timing data (load and unload events).

[noscript,notxpcom,nostdcall] void setNavigationTiming(
  in nsDOMNavigationTimingPtr aTiming
);
Parameters
aTiming
Missing Description
Return value

Missing Description

Requires Gecko 1.9 (Firefox 3)

setPageMode()

void setPageMode(
  in boolean aPageMode,
  in nsIPrintSettings aPrintSettings
);
Parameters
aPageMode
Missing Description
aPrintSettings
Missing Description

show()

void show();
Parameters

None.

stop()

void stop();
Parameters

None.

Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

unload()

void unload();
Parameters

None.

Document Tags and Contributors

 Contributors to this page: Sheppy, fscholz, kscarfone
 Last updated by: Sheppy,