зеркало из https://github.com/mozilla/gecko-dev.git
Bug 568971 - Nuke nsIGlobalHistory3. r=mak sr=bz
This commit is contained in:
Родитель
87b69c69e4
Коммит
033d960531
|
@ -66,7 +66,6 @@ XPIDLSRCS = \
|
|||
nsIDocShellTreeOwner.idl \
|
||||
nsIDocShellHistory.idl \
|
||||
nsIGlobalHistory2.idl \
|
||||
nsIGlobalHistory3.idl \
|
||||
nsIMarkupDocumentViewer.idl \
|
||||
nsIScrollable.idl \
|
||||
nsITextScroll.idl \
|
||||
|
|
|
@ -197,7 +197,6 @@
|
|||
#include "nsISelectionDisplay.h"
|
||||
|
||||
#include "nsIGlobalHistory2.h"
|
||||
#include "nsIGlobalHistory3.h"
|
||||
|
||||
#ifdef DEBUG_DOCSHELL_FOCUS
|
||||
#include "nsEventStateManager.h"
|
||||
|
|
|
@ -1,103 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla gecko engine.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brett Wilson <brettw@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#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(24306852-c60e-49c3-a455-90f6747118ba)]
|
||||
interface nsIGlobalHistory3 : nsIGlobalHistory2
|
||||
{
|
||||
/**
|
||||
* Notifies the history system that the page loading via aOldChannel
|
||||
* redirected to aNewChannel. Implementations should generally add the URI for
|
||||
* aOldChannel to history for link coloring, but are advised not to expose it
|
||||
* in the history user interface. This function is preferred if
|
||||
* nsIGlobalHistory3 is available. Otherwise, nsIGlobalHistory2.addURI should
|
||||
* be called with redirect=true.
|
||||
*
|
||||
* This function is preferred to nsIGlobalHistory2.addURI because it provides
|
||||
* more information (including the redirect destination, channels involved,
|
||||
* and redirect flags) to the history implementation.
|
||||
*
|
||||
* For implementors of nsIGlobalHistory3: The history implementation is
|
||||
* responsible for sending NS_LINK_VISITED_EVENT_TOPIC to observers for
|
||||
* redirect pages. This notification must be sent for history consumers for
|
||||
* all non-redirect pages.
|
||||
*
|
||||
* @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 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);
|
||||
};
|
|
@ -67,7 +67,6 @@
|
|||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsPresState.h"
|
||||
#include "nsIGlobalHistory3.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
|
|
|
@ -2166,10 +2166,6 @@ XPCOMUtils.defineLazyGetter(PlacesUtils, "ghistory2", function() {
|
|||
return PlacesUtils.history.QueryInterface(Ci.nsIGlobalHistory2);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(PlacesUtils, "ghistory3", function() {
|
||||
return PlacesUtils.history.QueryInterface(Ci.nsIGlobalHistory3);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(PlacesUtils, "favicons",
|
||||
"@mozilla.org/browser/favicon-service;1",
|
||||
"nsIFaviconService");
|
||||
|
|
|
@ -212,8 +212,7 @@ NS_IMPL_CLASSINFO(nsNavHistory, NULL, nsIClassInfo::SINGLETON,
|
|||
NS_NAVHISTORYSERVICE_CID)
|
||||
NS_INTERFACE_MAP_BEGIN(nsNavHistory)
|
||||
NS_INTERFACE_MAP_ENTRY(nsINavHistoryService)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIGlobalHistory2, nsIGlobalHistory3)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIGlobalHistory3)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIGlobalHistory2)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDownloadHistory)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIBrowserHistory)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIObserver)
|
||||
|
@ -227,10 +226,9 @@ NS_INTERFACE_MAP_BEGIN(nsNavHistory)
|
|||
NS_INTERFACE_MAP_END
|
||||
|
||||
// We don't care about flattening everything
|
||||
NS_IMPL_CI_INTERFACE_GETTER5(
|
||||
NS_IMPL_CI_INTERFACE_GETTER4(
|
||||
nsNavHistory
|
||||
, nsINavHistoryService
|
||||
, nsIGlobalHistory3
|
||||
, nsIGlobalHistory2
|
||||
, nsIDownloadHistory
|
||||
, nsIBrowserHistory
|
||||
|
@ -471,8 +469,6 @@ nsNavHistory::Init()
|
|||
NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(mRecentBookmark.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(mRecentRedirects.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Embed visits hash table.
|
||||
NS_ENSURE_TRUE(mEmbedVisits.Init(EMBED_VISITS_INITIAL_CACHE_SIZE),
|
||||
|
@ -2726,9 +2722,8 @@ nsNavHistory::AddVisit(nsIURI* aURI, PRTime aTime, nsIURI* aReferringURI,
|
|||
|
||||
// Normally docshell sends the link visited observer notification for us (this
|
||||
// will tell all the documents to update their visited link coloring).
|
||||
// However, for redirects (since we implement nsIGlobalHistory3) and downloads
|
||||
// (since we implement nsIDownloadHistory) this will not happen and we need to
|
||||
// send it ourselves.
|
||||
// However, for redirects and downloads (since we implement nsIDownloadHistory)
|
||||
// this will not happen and we need to send it ourselves.
|
||||
if (newItem && (aIsRedirect || aTransitionType == TRANSITION_DOWNLOAD)) {
|
||||
nsCOMPtr<nsIObserverService> obsService =
|
||||
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
|
||||
|
@ -4839,11 +4834,7 @@ nsNavHistory::AddURIInternal(nsIURI* aURI, PRTime aTime, PRBool aRedirect,
|
|||
// (like referring visit ID and typed/bookmarked state).
|
||||
//
|
||||
// This function walks up the referring chain and recursively calls itself,
|
||||
// each time calling InternalAdd to create a new history entry. (When we
|
||||
// get notified of redirects, we don't actually add any history entries, just
|
||||
// save them in mRecentRedirects. This function will add all of them for a
|
||||
// given destination page when that page is actually visited.)
|
||||
// See GetRedirectFor for more information about how redirects work.
|
||||
// each time calling InternalAdd to create a new history entry.
|
||||
|
||||
nsresult
|
||||
nsNavHistory::AddVisitChain(nsIURI* aURI,
|
||||
|
@ -4869,52 +4860,10 @@ nsNavHistory::AddVisitChain(nsIURI* aURI,
|
|||
PRBool isEmbedVisit = !aToplevel &&
|
||||
!CheckIsRecentEvent(&mRecentLink, spec);
|
||||
|
||||
// Check if this visit came from a redirect.
|
||||
PRUint32 transitionType = 0;
|
||||
PRTime redirectTime = 0;
|
||||
nsCAutoString redirectSourceUrl;
|
||||
if (GetRedirectFor(spec, redirectSourceUrl, &redirectTime, &transitionType)) {
|
||||
// redirectSourceUrl redirected to aURL, at redirectTime, with
|
||||
// a transitionType redirect.
|
||||
nsCOMPtr<nsIURI> redirectSourceURI;
|
||||
rv = NS_NewURI(getter_AddRefs(redirectSourceURI), redirectSourceUrl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Don't add a new visit if a page redirects to itself.
|
||||
PRBool redirectIsSame;
|
||||
if (NS_SUCCEEDED(aURI->Equals(redirectSourceURI, &redirectIsSame)) &&
|
||||
redirectIsSame)
|
||||
return NS_OK;
|
||||
|
||||
// Recusively call addVisitChain to walk up the chain till the first
|
||||
// not-redirected URI.
|
||||
// Ensure that the sources have a visit time smaller than aTime, otherwise
|
||||
// visits would end up incorrectly ordered.
|
||||
PRTime sourceTime = NS_MIN(redirectTime, aTime - 1);
|
||||
PRInt64 sourceVisitId = 0;
|
||||
rv = AddVisitChain(redirectSourceURI, sourceTime, aToplevel,
|
||||
PR_TRUE, // Is a redirect.
|
||||
aReferrerURI, // This one is the originating source.
|
||||
&sourceVisitId, // Get back the visit id of the source.
|
||||
aSessionID);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// All the visits for preceding pages in the redirects chain have been
|
||||
// added, now add the visit to aURI.
|
||||
if (isEmbedVisit)
|
||||
transitionType = nsINavHistoryService::TRANSITION_EMBED;
|
||||
else if (!aToplevel)
|
||||
transitionType = nsINavHistoryService::TRANSITION_FRAMED_LINK;
|
||||
|
||||
// This page is result of a redirect, save the source page in from_visit,
|
||||
// to be able to walk up the chain.
|
||||
// See bug 411966 and bug 428690 for details.
|
||||
// TODO: Add a closure table with a chain id to easily reconstruct chains
|
||||
// without having to recurse through the table. See bug 468710.
|
||||
fromVisitURI = redirectSourceURI;
|
||||
}
|
||||
else if (aReferrerURI) {
|
||||
// This page does not come from a redirect and had a referrer.
|
||||
if (aReferrerURI) {
|
||||
// This page had a referrer.
|
||||
|
||||
// Check if the referrer has a previous visit.
|
||||
PRTime lastVisitTime;
|
||||
|
@ -5082,107 +5031,6 @@ nsNavHistory::GetPageTitle(nsIURI* aURI, nsAString& aTitle)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsNavHistory::GetURIGeckoFlags
|
||||
//
|
||||
// FIXME: should we try to use annotations for this stuff?
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavHistory::GetURIGeckoFlags(nsIURI* aURI, PRUint32* aResult)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
// nsNavHistory::SetURIGeckoFlags
|
||||
//
|
||||
// FIXME: should we try to use annotations for this stuff?
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavHistory::SetURIGeckoFlags(nsIURI* aURI, PRUint32 aFlags)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsIGlobalHistory3 ***********************************************************
|
||||
|
||||
// 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
|
||||
// get a page added to reconstruct the redirects that happened when a page
|
||||
// is visited. See GetRedirectFor for more information
|
||||
|
||||
// this is the expiration callback function that deletes stale entries
|
||||
PLDHashOperator nsNavHistory::ExpireNonrecentRedirects(
|
||||
nsCStringHashKey::KeyType aKey, RedirectInfo& aData, void* aUserArg)
|
||||
{
|
||||
PRInt64* threshold = reinterpret_cast<PRInt64*>(aUserArg);
|
||||
if (aData.mTimeCreated < *threshold)
|
||||
return PL_DHASH_REMOVE;
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavHistory::AddDocumentRedirect(nsIChannel *aOldChannel,
|
||||
nsIChannel *aNewChannel,
|
||||
PRInt32 aFlags,
|
||||
PRBool aToplevel)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
|
||||
NS_ENSURE_ARG(aOldChannel);
|
||||
NS_ENSURE_ARG(aNewChannel);
|
||||
|
||||
// Ignore internal redirects.
|
||||
// These redirects are not initiated by the remote server, but specific to the
|
||||
// channel implementation, so they are ignored.
|
||||
if (aFlags & nsIChannelEventSink::REDIRECT_INTERNAL)
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> oldURI, newURI;
|
||||
rv = aOldChannel->GetURI(getter_AddRefs(oldURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aNewChannel->GetURI(getter_AddRefs(newURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCString oldSpec, newSpec;
|
||||
rv = oldURI->GetSpec(oldSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = newURI->GetSpec(newSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mRecentRedirects.Count() > RECENT_EVENT_QUEUE_MAX_LENGTH) {
|
||||
// Expire outdated cached redirects.
|
||||
PRInt64 threshold = PR_Now() - RECENT_EVENT_THRESHOLD;
|
||||
mRecentRedirects.Enumerate(ExpireNonrecentRedirects,
|
||||
reinterpret_cast<void*>(&threshold));
|
||||
}
|
||||
|
||||
RedirectInfo info;
|
||||
|
||||
// Remove any old entries for this redirect destination, since they are going
|
||||
// to be replaced.
|
||||
if (mRecentRedirects.Get(newSpec, &info))
|
||||
mRecentRedirects.Remove(newSpec);
|
||||
// Save the new redirect info.
|
||||
info.mSourceURI = oldSpec;
|
||||
info.mTimeCreated = PR_Now();
|
||||
if (aFlags & nsIChannelEventSink::REDIRECT_TEMPORARY)
|
||||
info.mType = TRANSITION_REDIRECT_TEMPORARY;
|
||||
else
|
||||
info.mType = TRANSITION_REDIRECT_PERMANENT;
|
||||
mRecentRedirects.Put(newSpec, info);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// mozIStorageVacuumParticipant
|
||||
|
@ -6333,77 +6181,6 @@ nsNavHistory::ExpireNonrecentEvents(RecentEventHash* hashTable)
|
|||
}
|
||||
|
||||
|
||||
// nsNavHistory::GetRedirectFor
|
||||
//
|
||||
// Given a destination URI, this finds a recent redirect that resulted in
|
||||
// this URI. If it finds one, it will put the redirect source info into
|
||||
// the out params and return true. If there is no matching redirect, it will
|
||||
// return false.
|
||||
//
|
||||
// @param aDestination The destination URI spec of the redirect to look for.
|
||||
// @param aSource Will be filled with the redirect source URI when a
|
||||
// redirect is found.
|
||||
// @param aTime Will be filled with the time the redirect happened
|
||||
// when a redirect is found.
|
||||
// @param aRedirectType Will be filled with the redirect type when a redirect
|
||||
// is found. Will be either
|
||||
// TRANSITION_REDIRECT_PERMANENT or
|
||||
// TRANSITION_REDIRECT_TEMPORARY
|
||||
// @returns True if the redirect is found.
|
||||
//
|
||||
// HOW REDIRECT TRACKING WORKS
|
||||
// ---------------------------
|
||||
// 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
|
||||
// redirect and add it.
|
||||
//
|
||||
// Example: Page S redirects throught R1, then R2, to give page D. Page S
|
||||
// will have been already added to history.
|
||||
// - 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.
|
||||
// We have to recursively check that source since there could be more than
|
||||
// one redirect, as in this case. Here we see there was a redirect to R2 from
|
||||
// R1. The referrer for D is S, so we know S->R1->R2->D.
|
||||
//
|
||||
// Alternatively, the user could have typed or followed a bookmark from S.
|
||||
// In this case, with two redirects we'll get:
|
||||
// - MarkPageAsTyped(S)
|
||||
// - 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.
|
||||
//
|
||||
// Note that this can get confused in some cases where you have a page
|
||||
// open in more than one window loading at the same time. This should be rare,
|
||||
// however, and should not affect much.
|
||||
|
||||
PRBool
|
||||
nsNavHistory::GetRedirectFor(const nsACString& aDestination,
|
||||
nsACString& aSource,
|
||||
PRTime* aTime,
|
||||
PRUint32* aRedirectType)
|
||||
{
|
||||
RedirectInfo info;
|
||||
if (mRecentRedirects.Get(aDestination, &info)) {
|
||||
// Consume the redirect entry, it's no longer useful.
|
||||
mRecentRedirects.Remove(aDestination);
|
||||
if (info.mTimeCreated < GetNow() - RECENT_EVENT_THRESHOLD)
|
||||
return PR_FALSE; // too long ago, probably invalid
|
||||
aSource = info.mSourceURI;
|
||||
*aTime = info.mTimeCreated;
|
||||
*aRedirectType = info.mType;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
// nsNavHistory::RowToResult
|
||||
//
|
||||
// Here, we just have a generic row. It could be a query, URL, visit,
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "nsPIPlacesHistoryListenersNotifier.h"
|
||||
#include "nsIBrowserHistory.h"
|
||||
#include "nsIGlobalHistory.h"
|
||||
#include "nsIGlobalHistory3.h"
|
||||
#include "nsIDownloadHistory.h"
|
||||
|
||||
#include "nsIPrefService.h"
|
||||
|
@ -168,7 +167,6 @@ class nsNavHistory : public nsSupportsWeakReference
|
|||
, public nsINavHistoryService
|
||||
, public nsIObserver
|
||||
, public nsIBrowserHistory
|
||||
, public nsIGlobalHistory3
|
||||
, public nsIDownloadHistory
|
||||
, public nsICharsetResolver
|
||||
, public nsPIPlacesDatabase
|
||||
|
@ -184,7 +182,6 @@ public:
|
|||
|
||||
NS_DECL_NSINAVHISTORYSERVICE
|
||||
NS_DECL_NSIGLOBALHISTORY2
|
||||
NS_DECL_NSIGLOBALHISTORY3
|
||||
NS_DECL_NSIDOWNLOADHISTORY
|
||||
NS_DECL_NSIBROWSERHISTORY
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
@ -847,19 +844,6 @@ protected:
|
|||
const nsACString& url);
|
||||
void ExpireNonrecentEvents(RecentEventHash* hashTable);
|
||||
|
||||
// redirect tracking. See GetRedirectFor for a description of how this works.
|
||||
struct RedirectInfo {
|
||||
nsCString mSourceURI;
|
||||
PRTime mTimeCreated;
|
||||
PRUint32 mType; // one of TRANSITION_REDIRECT_[TEMPORARY,PERMANENT]
|
||||
};
|
||||
typedef nsDataHashtable<nsCStringHashKey, RedirectInfo> RedirectHash;
|
||||
RedirectHash mRecentRedirects;
|
||||
static PLDHashOperator ExpireNonrecentRedirects(
|
||||
nsCStringHashKey::KeyType aKey, RedirectInfo& aData, void* aUserArg);
|
||||
PRBool GetRedirectFor(const nsACString& aDestination, nsACString& aSource,
|
||||
PRTime* aTime, PRUint32* aRedirectType);
|
||||
|
||||
// Sessions tracking.
|
||||
PRInt64 mLastSessionID;
|
||||
|
||||
|
|
|
@ -53,8 +53,6 @@ ok(bhist != null, "Could not get Browser History Service");
|
|||
var ghist = Cc["@mozilla.org/browser/global-history;2"].
|
||||
getService(Ci.nsIGlobalHistory2);
|
||||
ok(ghist != null, "Could not get Global History Service");
|
||||
var ghist3 = ghist.QueryInterface(Ci.nsIGlobalHistory3);
|
||||
ok(ghist3 != null, "Could not get Global History Service");
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
ok(ios != null, "Could not get IO Service");
|
||||
|
@ -113,7 +111,6 @@ StreamListener.prototype = {
|
|||
// nsIChannelEventSink
|
||||
asyncOnChannelRedirect: function (aOldChannel, aNewChannel, aFlags, callback) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
ghist3.addDocumentRedirect(aOldChannel, aNewChannel, aFlags, true);
|
||||
// If redirecting, store the new channel
|
||||
this.mChannel = aNewChannel;
|
||||
callback.onRedirectVerifyCallback(Components.results.NS_OK);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||
getService(Ci.nsINavHistoryService);
|
||||
let bh = hs.QueryInterface(Ci.nsIBrowserHistory);
|
||||
let ghist3 = hs.QueryInterface(Ci.nsIGlobalHistory3);
|
||||
|
||||
const PERMA_REDIR_PATH = "/permaredir";
|
||||
const TEMP_REDIR_PATH = "/tempredir";
|
||||
|
@ -181,10 +180,6 @@ ChannelListener.prototype = {
|
|||
do_check_true(this._got_onchannelredirect);
|
||||
do_check_true(this._buffer.length > 0);
|
||||
|
||||
// The referrer is wrong since it's the first element in the redirects
|
||||
// chain, but this is good, since it will test a special path.
|
||||
ghist3.addURI(uri(FOUND_URL), false, true, uri(PERMA_REDIR_URL));
|
||||
|
||||
continue_test();
|
||||
},
|
||||
|
||||
|
@ -192,7 +187,6 @@ ChannelListener.prototype = {
|
|||
asyncOnChannelRedirect: function (aOldChannel, aNewChannel, aFlags, callback) {
|
||||
do_log_info("onChannelRedirect");
|
||||
this._got_onchannelredirect = true;
|
||||
ghist3.addDocumentRedirect(aOldChannel, aNewChannel, aFlags, true);
|
||||
callback.onRedirectVerifyCallback(Components.results.NS_OK);
|
||||
},
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче