diff options
-rw-r--r-- | components/places/moz.build | 1 | ||||
-rw-r--r-- | components/places/public/nsIBrowserHistory.idl | 2 | ||||
-rw-r--r-- | components/places/public/nsIDownloadHistory.idl (renamed from system/docshell/base/nsIDownloadHistory.idl) | 5 | ||||
-rw-r--r-- | components/places/src/History.cpp | 2 | ||||
-rw-r--r-- | system/docshell/base/moz.build | 3 | ||||
-rw-r--r-- | system/docshell/base/nsDocShell.cpp | 28 | ||||
-rw-r--r-- | system/docshell/base/nsDocShell.h | 5 | ||||
-rw-r--r-- | system/docshell/base/nsDownloadHistory.cpp | 51 | ||||
-rw-r--r-- | system/docshell/base/nsDownloadHistory.h | 27 | ||||
-rw-r--r-- | system/docshell/base/nsIGlobalHistory2.idl | 59 | ||||
-rw-r--r-- | system/docshell/build/nsDocShellModule.cpp | 9 |
11 files changed, 6 insertions, 186 deletions
diff --git a/components/places/moz.build b/components/places/moz.build index 540265537..2be099873 100644 --- a/components/places/moz.build +++ b/components/places/moz.build @@ -15,6 +15,7 @@ if CONFIG['MOZ_PLACES']: 'public/mozIPlacesPendingOperation.idl', 'public/nsIAnnotationService.idl', 'public/nsIBrowserHistory.idl', + 'public/nsIDownloadHistory.idl', 'public/nsIFaviconService.idl', 'public/nsINavBookmarksService.idl', 'public/nsITaggingService.idl', diff --git a/components/places/public/nsIBrowserHistory.idl b/components/places/public/nsIBrowserHistory.idl index 8f3265972..35a186293 100644 --- a/components/places/public/nsIBrowserHistory.idl +++ b/components/places/public/nsIBrowserHistory.idl @@ -8,7 +8,7 @@ */ #include "nsISupports.idl" -#include "nsIGlobalHistory2.idl" +interface nsIURI; [scriptable, uuid(20d31479-38de-49f4-9300-566d6e834c66)] interface nsIBrowserHistory : nsISupports diff --git a/system/docshell/base/nsIDownloadHistory.idl b/components/places/public/nsIDownloadHistory.idl index ed2a19deb..ca0a06549 100644 --- a/system/docshell/base/nsIDownloadHistory.idl +++ b/components/places/public/nsIDownloadHistory.idl @@ -8,11 +8,6 @@ interface nsIURI; -/** - * This interface can be used to add a download to history. There is a separate - * interface specifically for downloads in case embedders choose to track - * downloads differently from other types of history. - */ [scriptable, uuid(4dcd6a12-a091-4f38-8360-022929635746)] interface nsIDownloadHistory : nsISupports { /** diff --git a/components/places/src/History.cpp b/components/places/src/History.cpp index e9c27d1d6..fe74e230e 100644 --- a/components/places/src/History.cpp +++ b/components/places/src/History.cpp @@ -43,6 +43,8 @@ // Initial length for the visits removal hash. #define VISITS_REMOVAL_INITIAL_HASH_LENGTH 64 +#define NS_LINK_VISITED_EVENT_TOPIC "link-visited" + using namespace mozilla::dom; using namespace mozilla::ipc; using mozilla::Unused; diff --git a/system/docshell/base/moz.build b/system/docshell/base/moz.build index c60e0d882..308e29614 100644 --- a/system/docshell/base/moz.build +++ b/system/docshell/base/moz.build @@ -22,8 +22,6 @@ XPIDL_SOURCES += [ 'nsIDocShellTreeItem.idl', 'nsIDocShellTreeOwner.idl', 'nsIDocumentLoaderFactory.idl', - 'nsIDownloadHistory.idl', - 'nsIGlobalHistory2.idl', 'nsILoadContext.idl', 'nsIPrivacyTransitionObserver.idl', 'nsIReflowObserver.idl', @@ -65,7 +63,6 @@ SOURCES += [ 'nsDocShellLoadInfo.cpp', 'nsDocShellTransferableHooks.cpp', 'nsDocShellTreeOwner.cpp', - 'nsDownloadHistory.cpp', 'nsDSURIContentListener.cpp', 'nsWebNavigationInfo.cpp', 'SerializedLoadContext.cpp', diff --git a/system/docshell/base/nsDocShell.cpp b/system/docshell/base/nsDocShell.cpp index b07cb15ff..5df1b6775 100644 --- a/system/docshell/base/nsDocShell.cpp +++ b/system/docshell/base/nsDocShell.cpp @@ -174,8 +174,6 @@ #include "nsISelectionDisplay.h" -#include "nsIGlobalHistory2.h" - #include "nsIFrame.h" #include "nsSubDocumentFrame.h" @@ -4399,27 +4397,15 @@ nsDocShell::AddChildSHEntryToParent(nsISHEntry* aNewEntry, int32_t aChildOffset, NS_IMETHODIMP nsDocShell::SetUseGlobalHistory(bool aUseGlobalHistory) { - nsresult rv; - mUseGlobalHistory = aUseGlobalHistory; if (!aUseGlobalHistory) { - mGlobalHistory = nullptr; return NS_OK; } - // No need to initialize mGlobalHistory if IHistory is available. nsCOMPtr<IHistory> history = services::GetHistoryService(); - if (history) { - return NS_OK; - } - if (mGlobalHistory) { - return NS_OK; - } - - mGlobalHistory = do_GetService(NS_GLOBALHISTORY2_CONTRACTID, &rv); - return rv; + return history ? NS_OK : NS_ERROR_FAILURE; } NS_IMETHODIMP @@ -6490,8 +6476,6 @@ nsDocShell::SetTitle(const char16_t* aTitle) nsCOMPtr<IHistory> history = services::GetHistoryService(); if (history) { history->SetURITitle(mCurrentURI, mTitle); - } else if (mGlobalHistory) { - mGlobalHistory->SetPageTitle(mCurrentURI, nsString(mTitle)); } } @@ -10381,8 +10365,6 @@ nsDocShell::InternalLoad(nsIURI* aURI, nsCOMPtr<IHistory> history = services::GetHistoryService(); if (history) { history->SetURITitle(aURI, mTitle); - } else if (mGlobalHistory) { - mGlobalHistory->SetPageTitle(aURI, mTitle); } } @@ -12209,8 +12191,6 @@ nsDocShell::UpdateURLAndHistory(nsIDocument* aDocument, nsIURI* aNewURI, nsCOMPtr<IHistory> history = services::GetHistoryService(); if (history) { history->SetURITitle(aNewURI, mTitle); - } else if (mGlobalHistory) { - mGlobalHistory->SetPageTitle(aNewURI, mTitle); } } @@ -13185,12 +13165,6 @@ nsDocShell::AddURIVisit(nsIURI* aURI, } (void)history->VisitURI(aURI, aPreviousURI, visitURIFlags); - } else if (mGlobalHistory) { - // Falls back to sync global history interface. - (void)mGlobalHistory->AddURI(aURI, - !!aChannelRedirectFlags, - !IsFrame(), - aReferrerURI); } } diff --git a/system/docshell/base/nsDocShell.h b/system/docshell/base/nsDocShell.h index f8fead3ac..4d8f06302 100644 --- a/system/docshell/base/nsDocShell.h +++ b/system/docshell/base/nsDocShell.h @@ -81,7 +81,6 @@ class nsIContentViewer; class nsIDocument; class nsIDOMNode; class nsIDocShellTreeOwner; -class nsIGlobalHistory2; class nsIHttpChannel; class nsIMutableArray; class nsIPrompt; @@ -562,8 +561,7 @@ protected: uint32_t aChannelRedirectFlags); /** - * Helper function for adding a URI visit using IHistory. If IHistory is - * not available, the method tries nsIGlobalHistory2. + * Helper function for adding a URI visit using IHistory. * * The IHistory API maintains chains of visits, tracking both HTTP referrers * and redirects for a user session. VisitURI requires the current URI and @@ -828,7 +826,6 @@ protected: uint32_t mReferrerPolicy; RefPtr<nsGlobalWindow> mScriptGlobal; nsCOMPtr<nsISHistory> mSessionHistory; - nsCOMPtr<nsIGlobalHistory2> mGlobalHistory; nsCOMPtr<nsIWebBrowserFind> mFind; nsCOMPtr<nsICommandManager> mCommandManager; // Reference to the SHEntry for this docshell until the page is destroyed. diff --git a/system/docshell/base/nsDownloadHistory.cpp b/system/docshell/base/nsDownloadHistory.cpp deleted file mode 100644 index 5fa44d473..000000000 --- a/system/docshell/base/nsDownloadHistory.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#include "nsDownloadHistory.h" -#include "nsCOMPtr.h" -#include "nsServiceManagerUtils.h" -#include "nsIGlobalHistory2.h" -#include "nsIObserverService.h" -#include "nsIURI.h" -#include "mozilla/Services.h" - -NS_IMPL_ISUPPORTS(nsDownloadHistory, nsIDownloadHistory) - -NS_IMETHODIMP -nsDownloadHistory::AddDownload(nsIURI* aSource, - nsIURI* aReferrer, - PRTime aStartTime, - nsIURI* aDestination) -{ - NS_ENSURE_ARG_POINTER(aSource); - - nsCOMPtr<nsIGlobalHistory2> history = - do_GetService("@mozilla.org/browser/global-history;2"); - if (!history) { - return NS_ERROR_NOT_AVAILABLE; - } - - bool visited; - nsresult rv = history->IsVisited(aSource, &visited); - NS_ENSURE_SUCCESS(rv, rv); - - rv = history->AddURI(aSource, false, true, aReferrer); - NS_ENSURE_SUCCESS(rv, rv); - - if (!visited) { - nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService(); - if (os) { - os->NotifyObservers(aSource, NS_LINK_VISITED_EVENT_TOPIC, nullptr); - } - } - - return NS_OK; -} - -NS_IMETHODIMP -nsDownloadHistory::RemoveAllDownloads() -{ - return NS_ERROR_NOT_IMPLEMENTED; -} diff --git a/system/docshell/base/nsDownloadHistory.h b/system/docshell/base/nsDownloadHistory.h deleted file mode 100644 index 297868c00..000000000 --- a/system/docshell/base/nsDownloadHistory.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#ifndef __nsDownloadHistory_h__ -#define __nsDownloadHistory_h__ - -#include "nsIDownloadHistory.h" -#include "mozilla/Attributes.h" - -#define NS_DOWNLOADHISTORY_CID \ - {0x2ee83680, 0x2af0, 0x4bcb, {0xbf, 0xa0, 0xc9, 0x70, 0x5f, 0x65, 0x54, 0xf1}} - -class nsDownloadHistory final : public nsIDownloadHistory -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIDOWNLOADHISTORY - - NS_DEFINE_STATIC_CID_ACCESSOR(NS_DOWNLOADHISTORY_CID) - -private: - ~nsDownloadHistory() {} -}; - -#endif // __nsDownloadHistory_h__ diff --git a/system/docshell/base/nsIGlobalHistory2.idl b/system/docshell/base/nsIGlobalHistory2.idl deleted file mode 100644 index aa8b44620..000000000 --- a/system/docshell/base/nsIGlobalHistory2.idl +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* 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/. */ - -/** - * Provides information about global history to gecko. - * - * @note This interface replaces and deprecates nsIGlobalHistory. - */ - -#include "nsISupports.idl" -interface nsIURI; - -%{ C++ - -// nsIObserver topic to fire when you add new visited URIs to the history; -// the nsIURI is the subject -#define NS_LINK_VISITED_EVENT_TOPIC "link-visited" - -%} - -[scriptable, uuid(cf777d42-1270-4b34-be7b-2931c93feda5)] -interface nsIGlobalHistory2 : nsISupports -{ - /** - * Add a URI to global history - * - * @param aURI the URI of the page - * @param aRedirect whether the URI was redirected to another location; - * this is 'true' for the original URI which is - * redirected. - * @param aToplevel whether the URI is loaded in a top-level window - * @param aReferrer the URI of the referring page - * - * @note Docshell will not filter out URI schemes like chrome: data: - * about: and view-source:. Embedders should consider filtering out - * these schemes and others, e.g. mailbox: for the main URI and the - * referrer. - */ - void addURI(in nsIURI aURI, in boolean aRedirect, in boolean aToplevel, in nsIURI aReferrer); - - /** - * Checks to see whether the given URI is in history. - * - * @param aURI the uri to the page - * @return true if a URI has been visited - */ - boolean isVisited(in nsIURI aURI); - - /** - * Set the page title for the given uri. URIs that are not already in - * global history will not be added. - * - * @param aURI the URI for which to set to the title - * @param aTitle the page title - */ - void setPageTitle(in nsIURI aURI, in AString aTitle); -}; diff --git a/system/docshell/build/nsDocShellModule.cpp b/system/docshell/build/nsDocShellModule.cpp index b36d70b56..59043abe4 100644 --- a/system/docshell/build/nsDocShellModule.cpp +++ b/system/docshell/build/nsDocShellModule.cpp @@ -31,9 +31,6 @@ #include "nsSHistory.h" #include "nsSHTransaction.h" -// download history -#include "nsDownloadHistory.h" - using mozilla::dom::ContentHandlerService; static bool gInitialized = false; @@ -87,9 +84,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsSHEntry) NS_GENERIC_FACTORY_CONSTRUCTOR(nsSHTransaction) NS_GENERIC_FACTORY_CONSTRUCTOR(nsSHistory) -// download history -NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadHistory) - NS_DEFINE_NAMED_CID(NS_DOCSHELL_CID); NS_DEFINE_NAMED_CID(NS_DEFAULTURIFIXUP_CID); NS_DEFINE_NAMED_CID(NS_WEBNAVIGATION_INFO_CID); @@ -109,7 +103,6 @@ NS_DEFINE_NAMED_CID(NS_SHENTRY_CID); NS_DEFINE_NAMED_CID(NS_SHTRANSACTION_CID); NS_DEFINE_NAMED_CID(NS_SHISTORY_CID); NS_DEFINE_NAMED_CID(NS_SHISTORY_INTERNAL_CID); -NS_DEFINE_NAMED_CID(NS_DOWNLOADHISTORY_CID); NS_DEFINE_NAMED_CID(NS_CONTENTHANDLERSERVICE_CID); const mozilla::Module::CIDEntry kDocShellCIDs[] = { @@ -134,7 +127,6 @@ const mozilla::Module::CIDEntry kDocShellCIDs[] = { { &kNS_SHTRANSACTION_CID, false, nullptr, nsSHTransactionConstructor }, { &kNS_SHISTORY_CID, false, nullptr, nsSHistoryConstructor }, { &kNS_SHISTORY_INTERNAL_CID, false, nullptr, nsSHistoryConstructor }, - { &kNS_DOWNLOADHISTORY_CID, false, nullptr, nsDownloadHistoryConstructor }, { nullptr } }; @@ -188,7 +180,6 @@ const mozilla::Module::ContractIDEntry kDocShellContracts[] = { { NS_SHTRANSACTION_CONTRACTID, &kNS_SHTRANSACTION_CID }, { NS_SHISTORY_CONTRACTID, &kNS_SHISTORY_CID }, { NS_SHISTORY_INTERNAL_CONTRACTID, &kNS_SHISTORY_INTERNAL_CID }, - { NS_DOWNLOADHISTORY_CONTRACTID, &kNS_DOWNLOADHISTORY_CID }, { nullptr } }; |