2018-08-30 04:08:59 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2005-08-18 15:16:08 +04:00
|
|
|
|
2005-08-18 15:16:22 +04:00
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2018-08-30 04:37:40 +03:00
|
|
|
interface nsIBFCacheEntry;
|
2013-08-30 08:14:59 +04:00
|
|
|
interface nsISHEntry;
|
2005-08-18 15:16:22 +04:00
|
|
|
interface nsISHistoryListener;
|
2018-08-30 04:37:40 +03:00
|
|
|
interface nsIURI;
|
2020-03-10 17:28:22 +03:00
|
|
|
webidl BrowsingContext;
|
2018-08-30 04:37:40 +03:00
|
|
|
|
|
|
|
%{C++
|
|
|
|
#include "nsTArrayForwardDeclare.h"
|
2020-03-10 17:28:22 +03:00
|
|
|
#include "mozilla/Maybe.h"
|
|
|
|
struct EntriesAndBrowsingContextData;
|
2018-08-30 04:37:40 +03:00
|
|
|
%}
|
|
|
|
|
|
|
|
[ref] native nsDocshellIDArray(nsTArray<nsID>);
|
2020-05-04 17:53:34 +03:00
|
|
|
native MaybeInt32(mozilla::Maybe<int32_t>);
|
2005-08-18 15:16:08 +04:00
|
|
|
/**
|
2005-08-18 15:16:22 +04:00
|
|
|
* 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.
|
2010-07-02 18:27:06 +04:00
|
|
|
* This interface is accessible from javascript.
|
2005-08-18 15:16:08 +04:00
|
|
|
*/
|
2005-08-18 15:14:57 +04:00
|
|
|
|
2018-09-11 09:08:37 +03:00
|
|
|
[builtinclass, scriptable, uuid(7b807041-e60a-4384-935f-af3061d8b815)]
|
2005-08-18 15:14:57 +04:00
|
|
|
interface nsISHistory: nsISupports
|
|
|
|
{
|
|
|
|
/**
|
2018-08-30 04:08:59 +03:00
|
|
|
* A readonly property of the interface that returns
|
2005-08-18 15:16:22 +04:00
|
|
|
* the number of toplevel documents currently available
|
|
|
|
* in session history.
|
2005-08-18 15:14:57 +04:00
|
|
|
*/
|
2018-09-11 09:08:37 +03:00
|
|
|
[infallible] readonly attribute long count;
|
2005-08-18 15:14:57 +04:00
|
|
|
|
2016-10-14 10:18:29 +03:00
|
|
|
/**
|
2018-09-11 09:08:37 +03:00
|
|
|
* The index of the current document in session history. Not infallible
|
|
|
|
* because setting can fail if the assigned value is out of range.
|
2005-08-18 15:14:57 +04:00
|
|
|
*/
|
2018-09-05 02:02:37 +03:00
|
|
|
attribute long index;
|
2005-08-18 15:14:57 +04:00
|
|
|
|
2016-11-29 12:31:17 +03:00
|
|
|
/**
|
|
|
|
* A readonly property of the interface that returns
|
2008-04-14 05:36:04 +04:00
|
|
|
* the index of the last document that started to load and
|
|
|
|
* didn't finished yet. When document finishes the loading
|
|
|
|
* value -1 is returned.
|
2006-02-19 20:33:31 +03:00
|
|
|
*/
|
2018-09-11 09:08:37 +03:00
|
|
|
[infallible] readonly attribute long requestedIndex;
|
2006-02-19 20:33:31 +03:00
|
|
|
|
2019-02-15 22:49:11 +03:00
|
|
|
/**
|
|
|
|
* Artifically set the |requestedIndex| for this nsISHEntry to the given
|
|
|
|
* index. This is used when resuming a cross-process load from a different
|
|
|
|
* process.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom]
|
|
|
|
void internalSetRequestedIndex(in long aRequestedIndex);
|
|
|
|
|
2005-08-18 15:15:14 +04:00
|
|
|
/**
|
2018-09-05 02:03:22 +03:00
|
|
|
* Get the history entry at a given index. Returns non-null on success.
|
2005-08-18 15:16:22 +04:00
|
|
|
*
|
|
|
|
* @param index The index value whose entry is requested.
|
2014-02-07 05:15:59 +04:00
|
|
|
* The oldest entry is located at index == 0.
|
2018-09-05 02:03:22 +03:00
|
|
|
* @return The found entry; never null.
|
2005-08-18 15:15:14 +04:00
|
|
|
*/
|
2018-09-05 02:02:37 +03:00
|
|
|
nsISHEntry getEntryAtIndex(in long aIndex);
|
2005-08-18 15:14:57 +04:00
|
|
|
|
2005-08-18 15:15:59 +04:00
|
|
|
/**
|
2005-08-18 15:16:22 +04:00
|
|
|
* Called to purge older documents from history.
|
2018-08-30 04:08:59 +03:00
|
|
|
* Documents can be removed from session history for various
|
|
|
|
* reasons. For example to control memory usage of the browser, to
|
2005-08-18 15:16:22 +04:00
|
|
|
* 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,
|
2018-08-30 04:08:59 +03:00
|
|
|
* the latest documents are maintained and older
|
2005-08-18 15:16:22 +04:00
|
|
|
* 'numEntries' documents are removed from history.
|
2018-08-30 04:08:59 +03:00
|
|
|
* @throws <code>NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA</code>
|
|
|
|
* Purge was vetod.
|
2005-08-18 15:16:59 +04:00
|
|
|
* @throws <code>NS_ERROR_FAILURE</code> numEntries is
|
2005-08-18 15:16:22 +04:00
|
|
|
* invalid or out of bounds with the size of history.
|
2005-08-18 15:15:59 +04:00
|
|
|
*/
|
2020-09-16 17:51:01 +03:00
|
|
|
void purgeHistory(in long aNumEntries);
|
2005-08-18 15:15:34 +04:00
|
|
|
|
2005-08-18 15:16:00 +04:00
|
|
|
/**
|
2005-08-18 15:16:22 +04:00
|
|
|
* Called to register a listener for the session history component.
|
|
|
|
* Listeners are notified when pages are loaded or purged from history.
|
2018-08-30 04:08:59 +03:00
|
|
|
*
|
2005-08-18 15:16:22 +04:00
|
|
|
* @param aListener Listener object to be notified for all
|
|
|
|
* page loads that initiate in session history.
|
|
|
|
*
|
2018-08-30 04:08:59 +03:00
|
|
|
* @note A listener object must implement
|
2005-08-18 15:16:22 +04:00
|
|
|
* nsISHistoryListener and nsSupportsWeakReference
|
|
|
|
*
|
|
|
|
* @see nsISHistoryListener
|
|
|
|
* @see nsSupportsWeakReference
|
2005-08-18 15:16:00 +04:00
|
|
|
*/
|
2018-08-30 04:08:59 +03:00
|
|
|
void addSHistoryListener(in nsISHistoryListener aListener);
|
2005-08-18 15:16:00 +04:00
|
|
|
|
|
|
|
/**
|
2005-08-18 15:16:22 +04:00
|
|
|
* Called to remove a listener for the session history component.
|
|
|
|
* Listeners are notified when pages are loaded from history.
|
2018-08-30 04:08:59 +03:00
|
|
|
*
|
|
|
|
* @param aListener Listener object to be removed from
|
2005-08-18 15:16:22 +04:00
|
|
|
* session history.
|
|
|
|
*
|
2018-08-30 04:08:59 +03:00
|
|
|
* @note A listener object must implement
|
2005-08-18 15:16:22 +04:00
|
|
|
* nsISHistoryListener and nsSupportsWeakReference
|
|
|
|
* @see nsISHistoryListener
|
|
|
|
* @see nsSupportsWeakReference
|
2018-08-30 04:08:59 +03:00
|
|
|
*/
|
|
|
|
void removeSHistoryListener(in nsISHistoryListener aListener);
|
2005-08-18 15:16:00 +04:00
|
|
|
|
2018-08-30 04:08:59 +03:00
|
|
|
void reloadCurrentEntry();
|
2014-04-24 23:12:15 +04:00
|
|
|
|
2018-09-11 09:08:39 +03:00
|
|
|
/**
|
|
|
|
* Load the entry at the particular index.
|
|
|
|
*/
|
|
|
|
[noscript]
|
|
|
|
void gotoIndex(in long aIndex);
|
|
|
|
|
2020-06-09 17:50:14 +03:00
|
|
|
/**
|
|
|
|
* If an element exists at the particular index and
|
|
|
|
* whether it has user interaction.
|
|
|
|
*/
|
|
|
|
[noscript,notxpcom]
|
|
|
|
boolean hasUserInteractionAtIndex(in long aIndex);
|
|
|
|
|
2018-08-30 04:08:59 +03:00
|
|
|
/**
|
2014-04-24 23:12:15 +04:00
|
|
|
* Called to obtain the index to a given history entry.
|
|
|
|
*
|
|
|
|
* @param aEntry The entry to obtain the index of.
|
|
|
|
*
|
|
|
|
* @return <code>NS_OK</code> index for the history entry
|
|
|
|
* is obtained successfully.
|
|
|
|
* <code>NS_ERROR_FAILURE</code> Error in obtaining
|
|
|
|
* index for the given history entry.
|
|
|
|
*/
|
2018-09-11 09:08:39 +03:00
|
|
|
[noscript, notxpcom]
|
2018-08-30 04:08:59 +03:00
|
|
|
long getIndexOfEntry(in nsISHEntry aEntry);
|
2018-08-30 04:37:40 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a new Entry to the History List.
|
|
|
|
*
|
|
|
|
* @param aEntry The entry to add.
|
|
|
|
* @param aPersist If true this specifies that the entry should
|
|
|
|
* persist in the list. If false, this means that
|
|
|
|
* when new entries are added this element will not
|
|
|
|
* appear in the session history list.
|
|
|
|
*/
|
|
|
|
void addEntry(in nsISHEntry aEntry, in boolean aPersist);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the index maintained by sessionHistory
|
|
|
|
*/
|
|
|
|
void updateIndex();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Replace the nsISHEntry at a particular index
|
|
|
|
*
|
|
|
|
* @param aIndex The index at which the entry should be replaced.
|
|
|
|
* @param aReplaceEntry The replacement entry for the index.
|
|
|
|
*/
|
|
|
|
void replaceEntry(in long aIndex, in nsISHEntry aReplaceEntry);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifies all registered session history listeners about an impending
|
|
|
|
* reload.
|
|
|
|
*
|
|
|
|
* @return Whether the operation can proceed.
|
|
|
|
*/
|
2019-04-04 19:18:48 +03:00
|
|
|
boolean notifyOnHistoryReload();
|
2018-08-30 04:37:40 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Evict content viewers which don't lie in the "safe" range around aIndex.
|
|
|
|
* In practice, this should leave us with no more than gHistoryMaxViewers
|
|
|
|
* viewers associated with this SHistory object.
|
|
|
|
*
|
|
|
|
* Also make sure that the total number of content viewers in all windows is
|
|
|
|
* not greater than our global max; if it is, evict viewers as appropriate.
|
|
|
|
*
|
|
|
|
* @param aIndex The index around which the "safe" range is
|
|
|
|
* centered. In general, if you just navigated the
|
|
|
|
* history, aIndex should be the index history was
|
|
|
|
* navigated to.
|
|
|
|
*/
|
|
|
|
void evictOutOfRangeContentViewers(in long aIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Evict the content viewer associated with a bfcache entry that has timed
|
|
|
|
* out.
|
|
|
|
*/
|
|
|
|
void evictExpiredContentViewerForEntry(in nsIBFCacheEntry aEntry);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Evict all the content viewers in this session history
|
|
|
|
*/
|
|
|
|
void evictAllContentViewers();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a BFCache entry to expiration tracker so it gets evicted on
|
|
|
|
* expiration.
|
|
|
|
*/
|
2018-09-11 09:08:39 +03:00
|
|
|
[noscript, notxpcom]
|
2018-08-30 04:37:40 +03:00
|
|
|
void addToExpirationTracker(in nsIBFCacheEntry aEntry);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a BFCache entry from expiration tracker.
|
|
|
|
*/
|
2018-09-11 09:08:39 +03:00
|
|
|
[noscript, notxpcom]
|
2018-08-30 04:37:40 +03:00
|
|
|
void removeFromExpirationTracker(in nsIBFCacheEntry aEntry);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove dynamic entries found at given index.
|
|
|
|
*
|
|
|
|
* @param aIndex Index to remove dynamic entries from. It will be
|
|
|
|
* passed to RemoveEntries as aStartIndex.
|
|
|
|
* @param aEntry (optional) The entry to start looking in for dynamic
|
|
|
|
* entries. Only the dynamic descendants of the
|
|
|
|
* entry will be removed. If not given, all dynamic
|
|
|
|
* entries at the index will be removed.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom]
|
|
|
|
void RemoveDynEntries(in long aIndex, in nsISHEntry aEntry);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Similar to RemoveDynEntries, but instead of specifying an index, use the
|
|
|
|
* given BFCacheEntry to find the index and remove dynamic entries from the
|
|
|
|
* index.
|
|
|
|
*
|
|
|
|
* The method takes no effect if the bfcache entry is not or no longer hold
|
|
|
|
* by the SHistory instance.
|
|
|
|
*
|
|
|
|
* @param aEntry The bfcache entry to look up for index to remove
|
|
|
|
* dynamic entries from.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom]
|
|
|
|
void RemoveDynEntriesForBFCacheEntry(in nsIBFCacheEntry aEntry);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes entries from the history if their docshellID is in
|
|
|
|
* aIDs array.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom]
|
|
|
|
void RemoveEntries(in nsDocshellIDArray aIDs, in long aStartIndex);
|
2019-03-05 17:46:10 +03:00
|
|
|
|
2019-03-22 22:45:38 +03:00
|
|
|
/**
|
|
|
|
* Collect docshellIDs from aEntry's children and remove those
|
|
|
|
* entries from history.
|
|
|
|
*
|
2020-09-16 17:51:01 +03:00
|
|
|
* @param aEntry Children docshellID's will be collected from
|
2019-03-22 22:45:38 +03:00
|
|
|
* this entry and passed to RemoveEntries as aIDs.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom]
|
|
|
|
void RemoveFrameEntries(in nsISHEntry aEntry);
|
|
|
|
|
2019-03-05 17:46:10 +03:00
|
|
|
[noscript]
|
|
|
|
void Reload(in unsigned long aReloadFlags);
|
2019-05-07 22:23:08 +03:00
|
|
|
|
|
|
|
[notxpcom] void EnsureCorrectEntryAtCurrIndex(in nsISHEntry aEntry);
|
2020-09-16 17:51:01 +03:00
|
|
|
|
2019-04-18 22:18:00 +03:00
|
|
|
[notxpcom] void EvictContentViewersOrReplaceEntry(in nsISHEntry aNewSHEntry, in bool aReplace);
|
2019-10-17 21:03:49 +03:00
|
|
|
|
|
|
|
nsISHEntry createEntry();
|
2020-03-10 17:28:22 +03:00
|
|
|
|
|
|
|
[noscript] void AddToRootSessionHistory(in bool aCloneChildren, in nsISHEntry aOSHE,
|
2020-08-21 23:59:52 +03:00
|
|
|
in BrowsingContext aRootBC, in nsISHEntry aEntry,
|
2020-03-10 17:28:22 +03:00
|
|
|
in unsigned long aLoadType,
|
|
|
|
in bool aShouldPersist,
|
|
|
|
out MaybeInt32 aPreviousEntryIndex,
|
|
|
|
out MaybeInt32 aLoadedEntryIndex);
|
|
|
|
|
|
|
|
[noscript] void AddChildSHEntryHelper(in nsISHEntry aCloneRef, in nsISHEntry aNewEntry,
|
2020-08-21 23:59:52 +03:00
|
|
|
in BrowsingContext aRootBC, in bool aCloneChildren);
|
2020-06-01 23:01:11 +03:00
|
|
|
|
|
|
|
[noscript, notxpcom] boolean isEmptyOrHasEntriesForSingleTopLevelPage();
|
2010-12-28 00:22:46 +03:00
|
|
|
};
|