2001-09-26 00:40:45 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
2000-05-04 05:53:52 +00:00
|
|
|
|
2002-07-25 18:31:10 +00:00
|
|
|
#include "nsIAtom.h"
|
2000-01-24 21:28:28 +00:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nspr.h"
|
1999-09-28 00:44:47 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2010-06-10 18:11:40 +00:00
|
|
|
#include "mozilla/ModuleUtils.h"
|
1999-09-28 00:44:47 +00:00
|
|
|
#include "nsParserCIID.h"
|
|
|
|
#include "nsParser.h"
|
|
|
|
#include "CNavDTD.h"
|
1999-09-30 22:01:48 +00:00
|
|
|
#include "nsHTMLEntities.h"
|
1999-10-06 19:04:29 +00:00
|
|
|
#include "nsHTMLTokenizer.h"
|
1999-11-13 03:53:11 +00:00
|
|
|
//#include "nsTextTokenizer.h"
|
2000-09-10 02:28:11 +00:00
|
|
|
#include "nsElementTable.h"
|
2001-09-28 23:08:17 +00:00
|
|
|
#include "nsParserService.h"
|
2006-04-17 01:13:07 +00:00
|
|
|
#include "nsSAXAttributes.h"
|
|
|
|
#include "nsSAXLocator.h"
|
|
|
|
#include "nsSAXXMLReader.h"
|
2003-07-30 23:57:39 +00:00
|
|
|
|
2012-06-25 19:59:42 +00:00
|
|
|
#if defined(DEBUG)
|
2002-01-09 01:37:50 +00:00
|
|
|
#include "nsExpatDriver.h"
|
2001-08-03 21:15:15 +00:00
|
|
|
#endif
|
|
|
|
|
1999-09-30 22:01:48 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2012-06-25 19:59:42 +00:00
|
|
|
#if defined(DEBUG)
|
2002-01-09 01:37:50 +00:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsExpatDriver)
|
2001-08-03 21:15:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser)
|
1999-09-30 22:01:48 +00:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD)
|
2003-07-30 17:02:52 +00:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService)
|
2003-07-30 02:39:05 +00:00
|
|
|
|
2006-04-17 01:13:07 +00:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXAttributes)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXXMLReader)
|
|
|
|
|
2012-06-25 19:59:42 +00:00
|
|
|
#if defined(DEBUG)
|
2010-06-10 18:11:40 +00: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);
|
2001-08-03 21:15:15 +00:00
|
|
|
|
2010-06-10 18:11:40 +00:00
|
|
|
static const mozilla::Module::CIDEntry kParserCIDs[] = {
|
2012-06-25 19:59:42 +00:00
|
|
|
#if defined(DEBUG)
|
2013-07-31 15:43:28 +00:00
|
|
|
{ &kNS_EXPAT_DRIVER_CID, false, nullptr, nsExpatDriverConstructor },
|
2010-06-10 18:11:40 +00:00
|
|
|
#endif
|
2013-07-31 15:43:28 +00: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 18:11:40 +00: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 15:43:28 +00:00
|
|
|
{ nullptr }
|
2001-03-12 20:43:02 +00:00
|
|
|
};
|
|
|
|
|
2008-10-10 15:04:34 +00:00
|
|
|
static nsresult
|
2010-06-10 18:11:40 +00:00
|
|
|
Initialize()
|
1999-09-28 00:44:47 +00:00
|
|
|
{
|
2012-02-01 10:54:21 +00:00
|
|
|
nsresult rv = nsHTMLTags::AddRefTable();
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
rv = nsHTMLEntities::AddRefTable();
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
nsHTMLTags::ReleaseTable();
|
|
|
|
return rv;
|
|
|
|
}
|
2012-06-25 19:59:42 +00:00
|
|
|
#ifdef DEBUG
|
2012-02-01 10:54:21 +00:00
|
|
|
CheckElementTable();
|
2005-03-21 00:45:02 +00:00
|
|
|
#endif
|
2004-11-02 19:52:32 +00:00
|
|
|
|
2005-12-12 16:53:30 +00:00
|
|
|
#ifdef DEBUG
|
2006-10-09 22:08:45 +00:00
|
|
|
nsHTMLTags::TestTagTable();
|
2005-12-12 16:53:30 +00:00
|
|
|
#endif
|
|
|
|
|
2013-11-26 07:31:52 +00:00
|
|
|
return rv;
|
1999-09-28 00:44:47 +00:00
|
|
|
}
|
|
|
|
|
2008-10-10 15:04:34 +00:00
|
|
|
static void
|
2010-06-10 18:11:40 +00:00
|
|
|
Shutdown()
|
1999-09-28 00:44:47 +00:00
|
|
|
{
|
2012-02-01 10:54:21 +00:00
|
|
|
nsHTMLTags::ReleaseTable();
|
|
|
|
nsHTMLEntities::ReleaseTable();
|
1999-09-28 00:44:47 +00:00
|
|
|
}
|
|
|
|
|
2010-06-10 18:11:40 +00:00
|
|
|
static mozilla::Module kParserModule = {
|
|
|
|
mozilla::Module::kVersion,
|
|
|
|
kParserCIDs,
|
|
|
|
kParserContracts,
|
2013-07-31 15:43:28 +00:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2010-06-10 18:11:40 +00:00
|
|
|
Initialize,
|
|
|
|
Shutdown
|
|
|
|
};
|
|
|
|
|
|
|
|
NSMODULE_DEFN(nsParserModule) = &kParserModule;
|