summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2022-01-09 02:41:39 -0600
committerMatt A. Tobin <email@mattatobin.com>2022-01-09 02:41:39 -0600
commiteed98f7886e68bbe89fbf170f5f9f136cd8ac766 (patch)
treec0c97183f41f5778d4a10547596b30c7d034b036 /system
parent2c76f5eea2723cf0496448d35c9cba6a48ddbc30 (diff)
downloadaura-central-eed98f7886e68bbe89fbf170f5f9f136cd8ac766.tar.gz
Bug 1419704 - Remove nsIGlobalHistory2 and docshell's nsDownloadHistory as they are redundant(ly busted).
* Since gecko/22 the actual impl for nsIGlobalHistory has been removed and without it nsDownloadHistory in docshell will not function. As well as, Mozilla only be sheer luck was able to rely on the places impl for nsIDownloadHistory overriding docshell's. Obviously this is fuckin moronic as hell and as demonstrated with moving things around it in its broken state became dominate. * The difference between our port and what Mozilla is doing is that we are not gonna remove the interface for nsIDownloadHistory nor the observer topic as there are consumers of them.
Diffstat (limited to 'system')
-rw-r--r--system/docshell/base/moz.build3
-rw-r--r--system/docshell/base/nsDocShell.cpp28
-rw-r--r--system/docshell/base/nsDocShell.h5
-rw-r--r--system/docshell/base/nsDownloadHistory.cpp51
-rw-r--r--system/docshell/base/nsDownloadHistory.h27
-rw-r--r--system/docshell/base/nsIDownloadHistory.idl58
-rw-r--r--system/docshell/base/nsIGlobalHistory2.idl59
-rw-r--r--system/docshell/build/nsDocShellModule.cpp9
8 files changed, 2 insertions, 238 deletions
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/nsIDownloadHistory.idl b/system/docshell/base/nsIDownloadHistory.idl
deleted file mode 100644
index ed2a19deb..000000000
--- a/system/docshell/base/nsIDownloadHistory.idl
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 sts=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 "nsISupports.idl"
-
-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 {
- /**
- * Adds a download to history. This will also notify observers that the
- * URI aSource is visited with the topic NS_LINK_VISITED_EVENT_TOPIC if
- * aSource has not yet been visited.
- *
- * @param aSource
- * The source of the download we are adding to history. This cannot be
- * null.
- * @param aReferrer
- * [optional] The referrer of source URI.
- * @param aStartTime
- * [optional] The time the download was started. If the start time
- * is not given, the current time is used.
- * @param aDestination
- * [optional] The target where the download is to be saved on the local
- * filesystem.
- * @throws NS_ERROR_NOT_AVAILABLE
- * In a situation where a history implementation is not available,
- * where 'history implementation' refers to something like
- * nsIGlobalHistory and friends.
- * @note This addition is not guaranteed to be synchronous, since it delegates
- * the actual addition to the underlying history implementation. If you
- * need to observe the completion of the addition, use the underlying
- * history implementation's notifications system (e.g. nsINavHistoryObserver
- * for toolkit's implementation of this interface).
- */
- void addDownload(in nsIURI aSource, [optional] in nsIURI aReferrer,
- [optional] in PRTime aStartTime,
- [optional] in nsIURI aDestination);
-
- /**
- * Remove all downloads from history.
- *
- * @note This removal is not guaranteed to be synchronous, since it delegates
- * the actual removal to the underlying history implementation. If you
- * need to observe the completion of the removal, use the underlying
- * history implementation's notifications system (e.g. nsINavHistoryObserver
- * for toolkit's implementation of this interface).
- */
- void removeAllDownloads();
-};
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 }
};