2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nspr.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2010-06-10 11:11:40 -07:00
|
|
|
#include "mozilla/ModuleUtils.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsParserCIID.h"
|
|
|
|
#include "nsParser.h"
|
|
|
|
#include "CNavDTD.h"
|
|
|
|
#include "nsHTMLEntities.h"
|
|
|
|
#include "nsHTMLTokenizer.h"
|
|
|
|
//#include "nsTextTokenizer.h"
|
|
|
|
#include "nsElementTable.h"
|
|
|
|
#include "nsParserService.h"
|
|
|
|
#include "nsSAXAttributes.h"
|
|
|
|
#include "nsSAXLocator.h"
|
|
|
|
#include "nsSAXXMLReader.h"
|
|
|
|
|
2012-06-25 12:59:42 -07:00
|
|
|
#if defined(DEBUG)
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsExpatDriver.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2012-06-25 12:59:42 -07:00
|
|
|
#if defined(DEBUG)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsExpatDriver)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService)
|
|
|
|
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXAttributes)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXXMLReader)
|
|
|
|
|
2012-06-25 12:59:42 -07:00
|
|
|
#if defined(DEBUG)
|
2010-06-10 11:11:40 -07:00
|
|
|
NS_DEFINE_NAMED_CID(NS_EXPAT_DRIVER_CID);
|
|
|
|
#endif
|
|
|
|
NS_DEFINE_NAMED_CID(NS_PARSER_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_CNAVDTD_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_PARSERSERVICE_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_SAXATTRIBUTES_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_SAXXMLREADER_CID);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-06-10 11:11:40 -07:00
|
|
|
static const mozilla::Module::CIDEntry kParserCIDs[] = {
|
2012-06-25 12:59:42 -07:00
|
|
|
#if defined(DEBUG)
|
2013-07-31 08:43:28 -07:00
|
|
|
{ &kNS_EXPAT_DRIVER_CID, false, nullptr, nsExpatDriverConstructor },
|
2010-06-10 11:11:40 -07:00
|
|
|
#endif
|
2013-07-31 08:43:28 -07:00
|
|
|
{ &kNS_PARSER_CID, false, nullptr, nsParserConstructor },
|
|
|
|
{ &kNS_CNAVDTD_CID, false, nullptr, CNavDTDConstructor },
|
|
|
|
{ &kNS_PARSERSERVICE_CID, false, nullptr, nsParserServiceConstructor },
|
|
|
|
{ &kNS_SAXATTRIBUTES_CID, false, nullptr, nsSAXAttributesConstructor },
|
|
|
|
{ &kNS_SAXXMLREADER_CID, false, nullptr, nsSAXXMLReaderConstructor },
|
|
|
|
{ nullptr }
|
2010-06-10 11:11:40 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static const mozilla::Module::ContractIDEntry kParserContracts[] = {
|
|
|
|
{ NS_PARSERSERVICE_CONTRACTID, &kNS_PARSERSERVICE_CID },
|
|
|
|
{ NS_SAXATTRIBUTES_CONTRACTID, &kNS_SAXATTRIBUTES_CID },
|
|
|
|
{ NS_SAXXMLREADER_CONTRACTID, &kNS_SAXXMLREADER_CID },
|
2013-07-31 08:43:28 -07:00
|
|
|
{ nullptr }
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2008-10-10 08:04:34 -07:00
|
|
|
static nsresult
|
2010-06-10 11:11:40 -07:00
|
|
|
Initialize()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-02-01 02:54:21 -08:00
|
|
|
nsresult rv = nsHTMLTags::AddRefTable();
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
rv = nsHTMLEntities::AddRefTable();
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
nsHTMLTags::ReleaseTable();
|
|
|
|
return rv;
|
|
|
|
}
|
2012-06-25 12:59:42 -07:00
|
|
|
#ifdef DEBUG
|
2012-02-01 02:54:21 -08:00
|
|
|
CheckElementTable();
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
nsHTMLTags::TestTagTable();
|
|
|
|
#endif
|
|
|
|
|
2013-11-25 23:31:52 -08:00
|
|
|
return rv;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2008-10-10 08:04:34 -07:00
|
|
|
static void
|
2010-06-10 11:11:40 -07:00
|
|
|
Shutdown()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-02-01 02:54:21 -08:00
|
|
|
nsHTMLTags::ReleaseTable();
|
|
|
|
nsHTMLEntities::ReleaseTable();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2010-06-10 11:11:40 -07:00
|
|
|
static mozilla::Module kParserModule = {
|
|
|
|
mozilla::Module::kVersion,
|
|
|
|
kParserCIDs,
|
|
|
|
kParserContracts,
|
2013-07-31 08:43:28 -07:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2010-06-10 11:11:40 -07:00
|
|
|
Initialize,
|
|
|
|
Shutdown
|
|
|
|
};
|
|
|
|
|
|
|
|
NSMODULE_DEFN(nsParserModule) = &kParserModule;
|