Revert nsIGlobalHistory2 to what it was on the 1.8 branch. Move the new stuff
to nsIGlobalHistory3. Bug 328928, r=brettw and smfr, sr=darin
This commit is contained in:
@@ -2583,7 +2583,7 @@ nsNavHistory::SetURIGeckoFlags(nsIURI* aURI, PRUint32 aFlags)
|
||||
|
||||
// nsIGlobalHistory3 ***********************************************************
|
||||
|
||||
// nsNavHistory::AddToplevelRedirect
|
||||
// nsNavHistory::AddDocumentRedirect
|
||||
//
|
||||
// This adds a redirect mapping from the destination of the redirect to the
|
||||
// source, time, and type. This mapping is used by GetRedirectFor when we
|
||||
@@ -2600,8 +2600,10 @@ PLDHashOperator PR_CALLBACK nsNavHistory::ExpireNonrecentRedirects(
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsNavHistory::AddToplevelRedirect(nsIChannel *aOldChannel,
|
||||
nsIChannel *aNewChannel, PRInt32 aFlags)
|
||||
nsNavHistory::AddDocumentRedirect(nsIChannel *aOldChannel,
|
||||
nsIChannel *aNewChannel,
|
||||
PRInt32 aFlags,
|
||||
PRBool aTopLevel)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> oldURI, newURI;
|
||||
@@ -3180,7 +3182,7 @@ nsNavHistory::ExpireNonrecentEvents(RecentEventHash* hashTable)
|
||||
//
|
||||
// HOW REDIRECT TRACKING WORKS
|
||||
// ---------------------------
|
||||
// When we get an AddToplevelRedirect message, we store the redirect in
|
||||
// When we get an AddDocumentRedirect message, we store the redirect in
|
||||
// our mRecentRedirects which maps the destination URI to a source,time pair.
|
||||
// When we get a new URI, we see if there were any redirects to this page
|
||||
// in the hash table. If found, we know that the page came through the given
|
||||
@@ -3188,8 +3190,8 @@ nsNavHistory::ExpireNonrecentEvents(RecentEventHash* hashTable)
|
||||
//
|
||||
// Example: Page S redirects throught R1, then R2, to give page D. Page S
|
||||
// will have been already added to history.
|
||||
// - AddToplevelRedirect(R1, R2)
|
||||
// - AddToplevelRedirect(R2, D)
|
||||
// - AddDocumentRedirect(R1, R2)
|
||||
// - AddDocumentRedirect(R2, D)
|
||||
// - AddURI(uri=D, referrer=S)
|
||||
//
|
||||
// When we get the AddURI(D), we see the hash table has a value for D from R2.
|
||||
@@ -3200,8 +3202,8 @@ nsNavHistory::ExpireNonrecentEvents(RecentEventHash* hashTable)
|
||||
// Alternatively, the user could have typed or followed a bookmark from S.
|
||||
// In this case, with two redirects we'll get:
|
||||
// - MarkPageAsTyped(S)
|
||||
// - AddToplevelRedirect(S, R)
|
||||
// - AddToplevelRedirect(R, D)
|
||||
// - AddDocumentRedirect(S, R)
|
||||
// - AddDocumentRedirect(R, D)
|
||||
// - AddURI(uri=D, referrer=null)
|
||||
// We need to be careful to add a visit to S in this case with an incoming
|
||||
// transition of typed and an outgoing transition of redirect.
|
||||
|
||||
@@ -4683,14 +4683,18 @@ nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel,
|
||||
return; // not a toplevel document
|
||||
|
||||
nsCOMPtr<nsIGlobalHistory3> history3(do_QueryInterface(mGlobalHistory));
|
||||
nsresult result = NS_ERROR_NOT_IMPLEMENTED;
|
||||
if (history3) {
|
||||
// notify global history of this redirect
|
||||
history3->AddToplevelRedirect(aOldChannel, aNewChannel,
|
||||
aRedirectFlags);
|
||||
} else {
|
||||
// when there is no GlobalHistory3, we fall back to GlobalHistory2.
|
||||
// Just notify that the redirecting page was a redirect so it will
|
||||
// be link colored but not visible.
|
||||
result = history3->AddDocumentRedirect(aOldChannel, aNewChannel,
|
||||
aRedirectFlags, !IsFrame());
|
||||
}
|
||||
|
||||
if (result == NS_ERROR_NOT_IMPLEMENTED) {
|
||||
// when there is no GlobalHistory3, or it doesn't implement
|
||||
// AddToplevelRedirect, we fall back to GlobalHistory2. Just notify
|
||||
// that the redirecting page was a redirect so it will be link colored
|
||||
// but not visible.
|
||||
nsCOMPtr<nsIURI> oldURI;
|
||||
aOldChannel->GetURI(getter_AddRefs(oldURI));
|
||||
if (! oldURI)
|
||||
|
||||
@@ -197,15 +197,3 @@ nsGlobalHistoryAdapter::SetPageTitle(nsIURI* aURI, const nsAString& aTitle)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalHistoryAdapter::SetURIGeckoFlags(nsIURI *aURI, PRUint32 aFlags)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalHistoryAdapter::GetURIGeckoFlags(nsIURI *aURI, PRUint32* aFlags)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -51,12 +51,9 @@ interface nsIURI;
|
||||
// the nsIURI is the subject
|
||||
#define NS_LINK_VISITED_EVENT_TOPIC "link-visited"
|
||||
|
||||
// This is NOT part of the interface! It could change.
|
||||
#define NS_GECKO_FLAG_NEEDS_VERTICAL_SCROLLBAR (1 << 0)
|
||||
|
||||
%}
|
||||
|
||||
[scriptable, uuid(fbcfa5ca-5d05-4726-b325-d0e6563a1715)]
|
||||
[scriptable, uuid(cf777d42-1270-4b34-be7b-2931c93feda5)]
|
||||
interface nsIGlobalHistory2 : nsISupports
|
||||
{
|
||||
/**
|
||||
@@ -92,17 +89,4 @@ interface nsIGlobalHistory2 : nsISupports
|
||||
* @param aTitle the page title
|
||||
*/
|
||||
void setPageTitle(in nsIURI aURI, in AString aTitle);
|
||||
|
||||
/**
|
||||
* Get the Gecko flags for this URI. These flags are used by Gecko as hints
|
||||
* to optimize page loading. Not all histories have them; this need not be
|
||||
* supported (just return NS_ERROR_NOT_IMPLEMENTED. These flags are opaque
|
||||
* and should not be interpreted by the history engine.
|
||||
*/
|
||||
unsigned long getURIGeckoFlags(in nsIURI aURI);
|
||||
/**
|
||||
* Set the Gecko flags for this URI. May fail if the history entry
|
||||
* doesn't have any flags or if there is no entry for the URI.
|
||||
*/
|
||||
void setURIGeckoFlags(in nsIURI aURI, in unsigned long aFlags);
|
||||
};
|
||||
|
||||
@@ -40,10 +40,17 @@
|
||||
#include "nsIGlobalHistory2.idl"
|
||||
interface nsIChannel;
|
||||
|
||||
%{C++
|
||||
|
||||
// This is NOT part of the interface! It could change.
|
||||
#define NS_GECKO_FLAG_NEEDS_VERTICAL_SCROLLBAR (1 << 0)
|
||||
|
||||
%}
|
||||
|
||||
/**
|
||||
* Provides information about global history to gecko, extending GlobalHistory2
|
||||
*/
|
||||
[scriptable, uuid(40e9613e-1742-4b4d-a858-053e6237d04d)]
|
||||
[scriptable, uuid(24306852-c60e-49c3-a455-90f6747118ba)]
|
||||
interface nsIGlobalHistory3 : nsIGlobalHistory2
|
||||
{
|
||||
/**
|
||||
@@ -60,12 +67,37 @@ interface nsIGlobalHistory3 : nsIGlobalHistory2
|
||||
*
|
||||
* For implementors of nsIGlobalHistory3: The history implementation is
|
||||
* responsible for sending NS_LINK_VISITED_EVENT_TOPIC to observers for
|
||||
* redirect pages. This will be sent by the docshell for all non-redirect
|
||||
* pages (see nsDocShell::AddToGlobalHistory).
|
||||
* redirect pages. This notification must be sent for history consumers for
|
||||
* all non-redirect pages.
|
||||
*
|
||||
* This function takes the same arguments as
|
||||
* nsIChannelEventSink::OnChannelRedirect
|
||||
* @param aToplevel whether the URI is loaded in a top-level window. If
|
||||
* false, the load is in a subframe.
|
||||
*
|
||||
* The other params to this function are the same as those for
|
||||
* nsIChannelEventSink::OnChannelRedirect.
|
||||
*
|
||||
* Note: Implementors who wish to implement this interface but rely on
|
||||
* nsIGlobalHistory2.addURI for redirect processing may throw
|
||||
* NS_ERROR_NOT_IMPLEMENTED from this method. If they do so, then callers
|
||||
* must call nsIGlobalHistory2.addURI upon getting the
|
||||
* NS_ERROR_NOT_IMPLEMENTED result.
|
||||
*/
|
||||
void addToplevelRedirect(in nsIChannel aOldChannel, in nsIChannel aNewChannel,
|
||||
in PRInt32 aFlags);
|
||||
void addDocumentRedirect(in nsIChannel aOldChannel,
|
||||
in nsIChannel aNewChannel,
|
||||
in PRInt32 aFlags,
|
||||
in boolean aTopLevel);
|
||||
|
||||
/**
|
||||
* Get the Gecko flags for this URI. These flags are used by Gecko as hints
|
||||
* to optimize page loading. Not all histories have them; this need not be
|
||||
* supported (just return NS_ERROR_NOT_IMPLEMENTED. These flags are opaque
|
||||
* and should not be interpreted by the history engine.
|
||||
*/
|
||||
unsigned long getURIGeckoFlags(in nsIURI aURI);
|
||||
|
||||
/**
|
||||
* Set the Gecko flags for this URI. May fail if the history entry
|
||||
* doesn't have any flags or if there is no entry for the URI.
|
||||
*/
|
||||
void setURIGeckoFlags(in nsIURI aURI, in unsigned long aFlags);
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
#include "nsReflowPath.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsPresState.h"
|
||||
#include "nsIGlobalHistory2.h"
|
||||
#include "nsIGlobalHistory3.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
@@ -2623,7 +2623,7 @@ nsGfxScrollFrameInner::SaveVScrollbarStateToGlobalHistory()
|
||||
if (!uri)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIGlobalHistory2> history(do_GetService(NS_GLOBALHISTORY2_CONTRACTID));
|
||||
nsCOMPtr<nsIGlobalHistory3> history(do_GetService(NS_GLOBALHISTORY2_CONTRACTID));
|
||||
if (!history)
|
||||
return;
|
||||
|
||||
@@ -2646,7 +2646,7 @@ nsGfxScrollFrameInner::GetVScrollbarHintFromGlobalHistory(PRBool* aVScrollbarNee
|
||||
if (!uri)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIGlobalHistory2> history(do_GetService(NS_GLOBALHISTORY2_CONTRACTID));
|
||||
nsCOMPtr<nsIGlobalHistory3> history(do_GetService(NS_GLOBALHISTORY2_CONTRACTID));
|
||||
if (!history)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
@@ -548,14 +548,20 @@ nsGlobalHistory::~nsGlobalHistory()
|
||||
//
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ISUPPORTS7(nsGlobalHistory,
|
||||
nsIGlobalHistory2,
|
||||
nsIBrowserHistory,
|
||||
nsIObserver,
|
||||
nsISupportsWeakReference,
|
||||
nsIRDFDataSource,
|
||||
nsIRDFRemoteDataSource,
|
||||
nsIAutoCompleteSearch)
|
||||
NS_IMPL_ADDREF(nsGlobalHistory)
|
||||
NS_IMPL_RELEASE(nsGlobalHistory)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsGlobalHistory)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIGlobalHistory2, nsIGlobalHistory3)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIGlobalHistory3)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIBrowserHistory)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRDFDataSource)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRDFRemoteDataSource)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAutoCompleteSearch)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIBrowserHistory)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
@@ -1486,6 +1492,15 @@ nsGlobalHistory::MarkPageAsTyped(nsIURI *aURI)
|
||||
return SetRowValue(row, kToken_TypedColumn, 1);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalHistory::AddDocumentRedirect(nsIChannel *aOldChannel,
|
||||
nsIChannel *aNewChannel,
|
||||
PRInt32 aFlags,
|
||||
PRBool aTopLevel)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalHistory::SetURIGeckoFlags(nsIURI *aURI, PRUint32 aFlags)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#define nsglobalhistory__h____
|
||||
|
||||
#include "nsIBrowserHistory.h"
|
||||
|
||||
#include "nsIGlobalHistory3.h"
|
||||
#include "mdb.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
@@ -132,13 +132,15 @@ class nsGlobalHistory : nsSupportsWeakReference,
|
||||
public nsIObserver,
|
||||
public nsIRDFDataSource,
|
||||
public nsIRDFRemoteDataSource,
|
||||
public nsIAutoCompleteSearch
|
||||
public nsIAutoCompleteSearch,
|
||||
public nsIGlobalHistory3
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSIGLOBALHISTORY2
|
||||
NS_DECL_NSIGLOBALHISTORY3
|
||||
NS_DECL_NSIBROWSERHISTORY
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSIRDFDATASOURCE
|
||||
|
||||
@@ -528,14 +528,20 @@ nsGlobalHistory::~nsGlobalHistory()
|
||||
//
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ISUPPORTS7(nsGlobalHistory,
|
||||
nsIGlobalHistory2,
|
||||
nsIBrowserHistory,
|
||||
nsIObserver,
|
||||
nsISupportsWeakReference,
|
||||
nsIRDFDataSource,
|
||||
nsIRDFRemoteDataSource,
|
||||
nsIAutoCompleteSession)
|
||||
NS_IMPL_ADDREF(nsGlobalHistory)
|
||||
NS_IMPL_RELEASE(nsGlobalHistory)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsGlobalHistory)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIGlobalHistory2, nsIGlobalHistory3)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIGlobalHistory3)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIBrowserHistory)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRDFDataSource)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRDFRemoteDataSource)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAutoCompleteSession)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIBrowserHistory)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
@@ -1398,6 +1404,15 @@ nsGlobalHistory::MarkPageAsTyped(nsIURI *aURI)
|
||||
return SetRowValue(row, kToken_TypedColumn, 1);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalHistory::AddDocumentRedirect(nsIChannel *aOldChannel,
|
||||
nsIChannel *aNewChannel,
|
||||
PRInt32 aFlags,
|
||||
PRBool aTopLevel)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalHistory::SetURIGeckoFlags(nsIURI *aURI, PRUint32 aFlags)
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "mdb.h"
|
||||
#include "nsIBrowserHistory.h"
|
||||
#include "nsIGlobalHistory3.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
@@ -129,13 +130,15 @@ class nsGlobalHistory : nsSupportsWeakReference,
|
||||
public nsIObserver,
|
||||
public nsIRDFDataSource,
|
||||
public nsIRDFRemoteDataSource,
|
||||
public nsIAutoCompleteSession
|
||||
public nsIAutoCompleteSession,
|
||||
public nsIGlobalHistory3
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSIGLOBALHISTORY2
|
||||
NS_DECL_NSIGLOBALHISTORY3
|
||||
NS_DECL_NSIBROWSERHISTORY
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSIRDFDATASOURCE
|
||||
|
||||
Reference in New Issue
Block a user