Bug 1489365 - Part 2: Remove the XPCOM component registration for nsDirIndexParser; r=valentin

Differential Revision: https://phabricator.services.mozilla.com/D5229
This commit is contained in:
Ehsan Akhgari 2018-09-06 22:34:30 -04:00
Родитель 3a9430c8dd
Коммит babcacdc91
4 изменённых файлов: 16 добавлений и 21 удалений

Просмотреть файл

@ -175,13 +175,11 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMIMEHeaderParamImpl)
#include "nsRequestObserverProxy.h"
#include "nsSimpleStreamListener.h"
#include "nsDirIndexParser.h"
typedef mozilla::net::nsRequestObserverProxy nsRequestObserverProxy;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRequestObserverProxy)
typedef mozilla::net::nsSimpleStreamListener nsSimpleStreamListener;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleStreamListener)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDirIndexParser, Init)
///////////////////////////////////////////////////////////////////////////////
@ -702,7 +700,6 @@ NS_DEFINE_NAMED_CID(NS_NAMEDPIPESERVICE_CID);
NS_DEFINE_NAMED_CID(NS_DASHBOARD_CID);
NS_DEFINE_NAMED_CID(NS_FTPDIRLISTINGCONVERTER_CID);
NS_DEFINE_NAMED_CID(NS_NSINDEXEDTOHTMLCONVERTER_CID);
NS_DEFINE_NAMED_CID(NS_DIRINDEXPARSER_CID);
NS_DEFINE_NAMED_CID(NS_MULTIMIXEDCONVERTER_CID);
NS_DEFINE_NAMED_CID(NS_UNKNOWNDECODER_CID);
NS_DEFINE_NAMED_CID(NS_BINARYDETECTOR_CID);
@ -821,7 +818,6 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
{ &kNS_DASHBOARD_CID, false, nullptr, mozilla::net::DashboardConstructor },
{ &kNS_FTPDIRLISTINGCONVERTER_CID, false, nullptr, CreateNewFTPDirListingConv },
{ &kNS_NSINDEXEDTOHTMLCONVERTER_CID, false, nullptr, nsIndexedToHTML::Create },
{ &kNS_DIRINDEXPARSER_CID, false, nullptr, nsDirIndexParserConstructor },
{ &kNS_MULTIMIXEDCONVERTER_CID, false, nullptr, CreateNewMultiMixedConvFactory },
{ &kNS_UNKNOWNDECODER_CID, false, nullptr, CreateNewUnknownDecoderFactory },
{ &kNS_BINARYDETECTOR_CID, false, nullptr, CreateNewBinaryDetectorFactory },
@ -939,7 +935,6 @@ static const mozilla::Module::ContractIDEntry kNeckoContracts[] = {
{ NS_DASHBOARD_CONTRACTID, &kNS_DASHBOARD_CID },
{ NS_ISTREAMCONVERTER_KEY FTP_TO_INDEX, &kNS_FTPDIRLISTINGCONVERTER_CID },
{ NS_ISTREAMCONVERTER_KEY INDEX_TO_HTML, &kNS_NSINDEXEDTOHTMLCONVERTER_CID },
{ NS_DIRINDEXPARSER_CONTRACTID, &kNS_DIRINDEXPARSER_CID },
{ NS_ISTREAMCONVERTER_KEY MULTI_MIXED_X, &kNS_MULTIMIXEDCONVERTER_CID },
{ NS_ISTREAMCONVERTER_KEY MULTI_BYTERANGES, &kNS_MULTIMIXEDCONVERTER_CID },
{ NS_ISTREAMCONVERTER_KEY MULTI_MIXED, &kNS_MULTIMIXEDCONVERTER_CID },

Просмотреть файл

@ -9,6 +9,7 @@
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsIDirIndexListener.h"
#include "mozilla/RefPtr.h"
class nsIDirIndex;
class nsITextToSubURI;
@ -20,14 +21,24 @@ class nsDirIndexParser : public nsIDirIndexParser {
private:
virtual ~nsDirIndexParser();
nsDirIndexParser();
nsresult Init();
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISTREAMLISTENER
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSIDIRINDEXPARSER
nsDirIndexParser();
nsresult Init();
static already_AddRefed<nsIDirIndexParser>
CreateInstance()
{
RefPtr<nsDirIndexParser> parser = new nsDirIndexParser();
if (NS_FAILED(parser->Init())) {
return nullptr;
}
return parser.forget();
}
enum fieldType {
FIELD_UNKNOWN = 0, // MUST be 0

Просмотреть файл

@ -22,6 +22,7 @@
#include "nsIPrefLocalizedString.h"
#include "nsIStringBundle.h"
#include "nsITextToSubURI.h"
#include "nsDirIndexParser.h"
#include "nsNativeCharsetUtils.h"
#include "nsString.h"
#include <algorithm>
@ -151,8 +152,8 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
channel->SetContentType(NS_LITERAL_CSTRING("text/html"));
mParser = do_CreateInstance("@mozilla.org/dirIndexParser;1",&rv);
if (NS_FAILED(rv)) return rv;
mParser = nsDirIndexParser::CreateInstance();
if (!mParser) return NS_ERROR_FAILURE;
rv = mParser->SetListener(this);
if (NS_FAILED(rv)) return rv;

Просмотреть файл

@ -65,15 +65,3 @@ interface nsIDirIndexParser : nsIStreamListener {
attribute string encoding;
};
%{C++
#define NS_DIRINDEXPARSER_CID \
{ /* a0d6ad32-1dd1-11b2-aa55-a40187b54036 */ \
0xa0d6ad32, \
0x1dd1, \
0x11b2, \
{ 0xaa, 0x55, 0xa4, 0x01, 0x87, 0xb5, 0x40, 0x36 } \
}
#define NS_DIRINDEXPARSER_CONTRACTID "@mozilla.org/dirIndexParser;1"
%}