parser/htmlparser/src/nsParserModule.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial