Fix for bug # 100993. Freeze nsIHistoryEntry.idl and nsISHistory.idl according to the

embedding freezing guidelines. r=chak sr=alec
This commit is contained in:
radha%netscape.com 2001-10-01 20:15:06 +00:00
parent d3e184dc44
commit 55322c6772
6 changed files with 127 additions and 28 deletions

View File

@ -123,6 +123,7 @@ typedef unsigned long HMTX;
#include "nsISelectionController.h"
#include "nsIFileStream.h"
#include "nsISHistoryInternal.h"
#include "nsIHistoryEntry.h"
#include "nsIHttpChannel.h" // add this to the ick include list...we need it to QI for post data interface
#include "nsIUploadChannel.h"

View File

@ -42,6 +42,7 @@
//
// Header file for nsiHistory interface test cases
#include nsIHistoryEntry.h
/////////////////////////////////////////////////////////////////////////////
// CNsIHistory window

View File

@ -37,28 +37,45 @@
* ***** END LICENSE BLOCK ***** */
/**
* The interface to nsIHistoryEntry. Each document or subframe in
* Session History will have a nsIHistoryEntry associated with it which will
* hold only public information like URI and title for that document.
* More information like post data layout data are held in the private
* interface nsISHEntry
* An interface to individual entries in session history. Each
* document or frame will have a nsIHistoryEntry associated with
* it. nsIHistoryEntry provides access to information like URI,
* title and frame traversal status for that document.
* This interface is accessible from javascript.
*
* @status FROZEN
* @version 1.0
*/
#include "nsISupports.idl"
#include "nsIURI.idl"
interface nsIURI;
[scriptable, uuid(A41661D4-1417-11D5-9882-00C04FA02F40)]
interface nsIHistoryEntry : nsISupports
{
/** URI for the document */
/**
* A readonly property that returns the URI
* of the current entry. The object returned is
* of type nsIURI
*/
readonly attribute nsIURI URI;
/** Title for the document */
/**
* A readonly property that returns the title
* of the current entry. The object returned
* is a encoded string
*/
readonly attribute wstring title;
/** Flag that indicates if the entry is for a subframe navigation */
/**
* A readonly property that returns a boolean
* flag which indicates if the entry was created as a
* result of a subframe navigation. This flag will be
* 'false' when a frameset page is visited for
* the first time. This flag will be 'true' for all
* history entries created as a result of a subframe
* navigation.
*/
readonly attribute boolean isSubFrame;
};

View File

@ -36,18 +36,24 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIHistoryEntry;
interface nsISHistoryListener;
interface nsISimpleEnumerator;
/**
* Interface to Session History
* An interface to the primary properties of the Session History
* component. In an embedded browser environment, the nsIWebBrowser
* object creates an instance of session history for each open window.
* A handle to the session history object can be obtained from
* nsIWebNavigation. In a non-embedded situation, the owner of the
* session history component must create a instance of it and set
* it in the nsIWebNavigation object.
* This interface is accessible from javascript.
*
* @status FROZEN
*/
#include "nsISupports.idl"
#include "nsIFactory.idl"
#include "nsIHistoryEntry.idl"
#include "nsISHistoryListener.idl"
interface nsISimpleEnumerator;
%{C++
#define NS_SHISTORY_CID \
@ -60,43 +66,109 @@ interface nsISimpleEnumerator;
interface nsISHistory: nsISupports
{
/**
* Get the size of the History list
* A readonly property of the interface that returns
* the number of toplevel documents currently available
* in session history.
*/
readonly attribute long count;
/**
* Get the index of the current document in the history list
* A readonly property of the interface that returns
* the index of the current document in session history.
*/
readonly attribute long index;
/**
* Get/Set the Max entries Session History will hold per window
* A read/write property of the interface, used to Get/Set
* the maximum number of toplevel documents, session history
* can hold for each instance.
*/
attribute long maxLength;
/**
* Get the entry at a given index
* Called to obtain handle to the history entry at a
* given index.
*
* @param index The index value whose entry is requested.
* @param modifyIndex A boolean flag that indicates if the current
* index of session history should be modified
* to the parameter index.
*
* @return <code>NS_OK</code> history entry for
* the index is obtained successfully.
* <code>NS_ERROR_FAILURE</code> Error in obtaining
* history entry for the given index.
*/
nsIHistoryEntry getEntryAtIndex(in long index, in boolean modifyIndex);
/**
* Purge the oldest numEntries from history list
* Called to purge older documents from history.
* Documents can be removed from session history for various
* reasons. For example to control memory usage of the browser, to
* prevent users from loading documents from history, to erase evidence of
* prior page loads etc...
*
* @param numEntries The number of toplevel documents to be
* purged from history. During purge operation,
* the latest documents are maintained and older
* 'numEntries' documents are removed from history.
* @return <code>NS_OK</code> Purging was successfull
* <code>NS_ERROR_FAILURE</code> numEntries is
* invalid or out of bounds with the size of history.
*
*/
void PurgeHistory(in long numEntries);
/**
* Register a Session History Listener to be notified on SHistory events
* Called to register a listener for the session history component.
* Listeners are notified when pages are loaded or purged from history.
*
* @param aListener Listener object to be notified for all
* page loads that initiate in session history.
*
* @note A listener object must implement
* nsISHistoryListener and nsSupportsWeakReference
*
* @see nsISHistoryListener
* @see nsSupportsWeakReference
*/
void addSHistoryListener(in nsISHistoryListener aListener);
/**
* Remove a previously registered Session History Listener
*/
* Called to remove a listener for the session history component.
* Listeners are notified when pages are loaded from history.
*
* @param aListener Listener object to be removed from
* session history.
*
* @note A listener object must implement
* nsISHistoryListener and nsSupportsWeakReference
* @see nsISHistoryListener
* @see nsSupportsWeakReference
*/
void removeSHistoryListener(in nsISHistoryListener aListener);
/**
* Get a enumerator to access all the entries in SH
* Called to obtain a enumerator for all the documents stored in
* session history. The enumerator object thus returned by this method
* can be traversed using nsISimpleEnumerator.
*
* @note To access individual history entries of the enumerator, perform the
* following steps:
* 1) Call nsISHistory->GetSHistoryEnumerator() to obtain handle
* the nsISimpleEnumerator object.
* 2) Use nsISimpleEnumerator->GetNext() on the object returned
* by step #1 to obtain handle to the next object in the list.
* The object returned by this step is of type nsISupports.
* 3) Perform a QueryInterface on the object returned by step #2
* to nsIHistoryEntry.
* 4) Use nsIHistoryEntry to access properties of each history entry.
*
* @see nsISimpleEnumerator
* @see nsIHistoryEntry
* @see QueryInterface()
* @see do_QueryInterface()
*/
readonly attribute nsISimpleEnumerator SHistoryEnumerator;
};

View File

@ -410,8 +410,14 @@ nsSHistory::AddSHistoryListener(nsISHistoryListener * aListener)
NS_IMETHODIMP
nsSHistory::RemoveSHistoryListener(nsISHistoryListener * aListener)
{
mListener = nsnull;
return NS_OK;
// Make sure the listener that wants to be removed is the
// one we have in store.
nsWeakPtr listener = getter_AddRefs(NS_GetWeakReference(aListener));
if (listener == mListener) {
mListener = nsnull;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
//*****************************************************************************

View File

@ -33,6 +33,8 @@
#include "nsIWebNavigation.h"
#include "nsIWeakReference.h"
#include "nsISimpleEnumerator.h"
#include "nsISHistoryListener.h"
#include "nsIHistoryEntry.h"
class nsIDocShell;
class nsSHEnumerator;