Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsIAtom.h" |
michael@0 | 7 | #include "nsString.h" |
michael@0 | 8 | #include "nspr.h" |
michael@0 | 9 | #include "nsCOMPtr.h" |
michael@0 | 10 | #include "mozilla/ModuleUtils.h" |
michael@0 | 11 | #include "nsParserCIID.h" |
michael@0 | 12 | #include "nsParser.h" |
michael@0 | 13 | #include "CNavDTD.h" |
michael@0 | 14 | #include "nsHTMLEntities.h" |
michael@0 | 15 | #include "nsHTMLTokenizer.h" |
michael@0 | 16 | //#include "nsTextTokenizer.h" |
michael@0 | 17 | #include "nsElementTable.h" |
michael@0 | 18 | #include "nsParserService.h" |
michael@0 | 19 | #include "nsSAXAttributes.h" |
michael@0 | 20 | #include "nsSAXLocator.h" |
michael@0 | 21 | #include "nsSAXXMLReader.h" |
michael@0 | 22 | |
michael@0 | 23 | #if defined(DEBUG) |
michael@0 | 24 | #include "nsExpatDriver.h" |
michael@0 | 25 | #endif |
michael@0 | 26 | |
michael@0 | 27 | //---------------------------------------------------------------------- |
michael@0 | 28 | |
michael@0 | 29 | #if defined(DEBUG) |
michael@0 | 30 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsExpatDriver) |
michael@0 | 31 | #endif |
michael@0 | 32 | |
michael@0 | 33 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser) |
michael@0 | 34 | NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD) |
michael@0 | 35 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService) |
michael@0 | 36 | |
michael@0 | 37 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXAttributes) |
michael@0 | 38 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXXMLReader) |
michael@0 | 39 | |
michael@0 | 40 | #if defined(DEBUG) |
michael@0 | 41 | NS_DEFINE_NAMED_CID(NS_EXPAT_DRIVER_CID); |
michael@0 | 42 | #endif |
michael@0 | 43 | NS_DEFINE_NAMED_CID(NS_PARSER_CID); |
michael@0 | 44 | NS_DEFINE_NAMED_CID(NS_CNAVDTD_CID); |
michael@0 | 45 | NS_DEFINE_NAMED_CID(NS_PARSERSERVICE_CID); |
michael@0 | 46 | NS_DEFINE_NAMED_CID(NS_SAXATTRIBUTES_CID); |
michael@0 | 47 | NS_DEFINE_NAMED_CID(NS_SAXXMLREADER_CID); |
michael@0 | 48 | |
michael@0 | 49 | static const mozilla::Module::CIDEntry kParserCIDs[] = { |
michael@0 | 50 | #if defined(DEBUG) |
michael@0 | 51 | { &kNS_EXPAT_DRIVER_CID, false, nullptr, nsExpatDriverConstructor }, |
michael@0 | 52 | #endif |
michael@0 | 53 | { &kNS_PARSER_CID, false, nullptr, nsParserConstructor }, |
michael@0 | 54 | { &kNS_CNAVDTD_CID, false, nullptr, CNavDTDConstructor }, |
michael@0 | 55 | { &kNS_PARSERSERVICE_CID, false, nullptr, nsParserServiceConstructor }, |
michael@0 | 56 | { &kNS_SAXATTRIBUTES_CID, false, nullptr, nsSAXAttributesConstructor }, |
michael@0 | 57 | { &kNS_SAXXMLREADER_CID, false, nullptr, nsSAXXMLReaderConstructor }, |
michael@0 | 58 | { nullptr } |
michael@0 | 59 | }; |
michael@0 | 60 | |
michael@0 | 61 | static const mozilla::Module::ContractIDEntry kParserContracts[] = { |
michael@0 | 62 | { NS_PARSERSERVICE_CONTRACTID, &kNS_PARSERSERVICE_CID }, |
michael@0 | 63 | { NS_SAXATTRIBUTES_CONTRACTID, &kNS_SAXATTRIBUTES_CID }, |
michael@0 | 64 | { NS_SAXXMLREADER_CONTRACTID, &kNS_SAXXMLREADER_CID }, |
michael@0 | 65 | { nullptr } |
michael@0 | 66 | }; |
michael@0 | 67 | |
michael@0 | 68 | static nsresult |
michael@0 | 69 | Initialize() |
michael@0 | 70 | { |
michael@0 | 71 | nsresult rv = nsHTMLTags::AddRefTable(); |
michael@0 | 72 | NS_ENSURE_SUCCESS(rv, rv); |
michael@0 | 73 | |
michael@0 | 74 | rv = nsHTMLEntities::AddRefTable(); |
michael@0 | 75 | if (NS_FAILED(rv)) { |
michael@0 | 76 | nsHTMLTags::ReleaseTable(); |
michael@0 | 77 | return rv; |
michael@0 | 78 | } |
michael@0 | 79 | #ifdef DEBUG |
michael@0 | 80 | CheckElementTable(); |
michael@0 | 81 | #endif |
michael@0 | 82 | |
michael@0 | 83 | #ifdef DEBUG |
michael@0 | 84 | nsHTMLTags::TestTagTable(); |
michael@0 | 85 | #endif |
michael@0 | 86 | |
michael@0 | 87 | return rv; |
michael@0 | 88 | } |
michael@0 | 89 | |
michael@0 | 90 | static void |
michael@0 | 91 | Shutdown() |
michael@0 | 92 | { |
michael@0 | 93 | nsHTMLTags::ReleaseTable(); |
michael@0 | 94 | nsHTMLEntities::ReleaseTable(); |
michael@0 | 95 | } |
michael@0 | 96 | |
michael@0 | 97 | static mozilla::Module kParserModule = { |
michael@0 | 98 | mozilla::Module::kVersion, |
michael@0 | 99 | kParserCIDs, |
michael@0 | 100 | kParserContracts, |
michael@0 | 101 | nullptr, |
michael@0 | 102 | nullptr, |
michael@0 | 103 | Initialize, |
michael@0 | 104 | Shutdown |
michael@0 | 105 | }; |
michael@0 | 106 | |
michael@0 | 107 | NSMODULE_DEFN(nsParserModule) = &kParserModule; |