LCOV - code coverage report
Current view: top level - dom/xslt/xslt - txMozillaXSLTProcessor.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 11 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 12 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       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/. */
       5             : 
       6             : #ifndef TRANSFRMX_TXMOZILLAXSLTPROCESSOR_H
       7             : #define TRANSFRMX_TXMOZILLAXSLTPROCESSOR_H
       8             : 
       9             : #include "nsAutoPtr.h"
      10             : #include "nsStubMutationObserver.h"
      11             : #include "nsIDocumentTransformer.h"
      12             : #include "nsIXSLTProcessor.h"
      13             : #include "nsIXSLTProcessorPrivate.h"
      14             : #include "txExpandedNameMap.h"
      15             : #include "txNamespaceMap.h"
      16             : #include "nsCycleCollectionParticipant.h"
      17             : #include "nsWrapperCache.h"
      18             : #include "mozilla/Attributes.h"
      19             : #include "mozilla/ErrorResult.h"
      20             : #include "mozilla/dom/BindingDeclarations.h"
      21             : #include "mozilla/net/ReferrerPolicy.h"
      22             : 
      23             : class nsINode;
      24             : class nsIDOMNode;
      25             : class nsIURI;
      26             : class txStylesheet;
      27             : class txResultRecycler;
      28             : class txIGlobalParameter;
      29             : 
      30             : namespace mozilla {
      31             : namespace dom {
      32             : 
      33             : class Document;
      34             : class DocumentFragment;
      35             : class GlobalObject;
      36             : 
      37             : } // namespace dom
      38             : } // namespace mozilla
      39             : 
      40             : /* bacd8ad0-552f-11d3-a9f7-000064657374 */
      41             : #define TRANSFORMIIX_XSLT_PROCESSOR_CID   \
      42             : { 0x618ee71d, 0xd7a7, 0x41a1, {0xa3, 0xfb, 0xc2, 0xbe, 0xdc, 0x6a, 0x21, 0x7e} }
      43             : 
      44             : #define TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID \
      45             : "@mozilla.org/document-transformer;1?type=xslt"
      46             : 
      47             : #define XSLT_MSGS_URL  "chrome://global/locale/xslt/xslt.properties"
      48             : 
      49             : /**
      50             :  * txMozillaXSLTProcessor is a front-end to the XSLT Processor.
      51             :  */
      52             : class txMozillaXSLTProcessor final : public nsIXSLTProcessor,
      53             :                                      public nsIXSLTProcessorPrivate,
      54             :                                      public nsIDocumentTransformer,
      55             :                                      public nsStubMutationObserver,
      56             :                                      public nsWrapperCache
      57             : {
      58             : public:
      59             :     /**
      60             :      * Creates a new txMozillaXSLTProcessor
      61             :      */
      62             :     txMozillaXSLTProcessor();
      63             : 
      64             :     // nsISupports interface
      65             :     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      66           0 :     NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(txMozillaXSLTProcessor,
      67             :                                                            nsIXSLTProcessor)
      68             : 
      69             :     // nsIXSLTProcessor interface
      70             :     NS_DECL_NSIXSLTPROCESSOR
      71             : 
      72             :     // nsIXSLTProcessorPrivate interface
      73             :     NS_DECL_NSIXSLTPROCESSORPRIVATE
      74             : 
      75             :     // nsIDocumentTransformer interface
      76             :     NS_IMETHOD SetTransformObserver(nsITransformObserver* aObserver) override;
      77             :     NS_IMETHOD LoadStyleSheet(nsIURI* aUri, nsIDocument* aLoaderDocument) override;
      78             :     NS_IMETHOD SetSourceContentModel(nsIDOMNode* aSource) override;
      79           0 :     NS_IMETHOD CancelLoads() override {return NS_OK;}
      80             :     NS_IMETHOD AddXSLTParamNamespace(const nsString& aPrefix,
      81             :                                      const nsString& aNamespace) override;
      82             :     NS_IMETHOD AddXSLTParam(const nsString& aName,
      83             :                             const nsString& aNamespace,
      84             :                             const nsString& aSelect,
      85             :                             const nsString& aValue,
      86             :                             nsIDOMNode* aContext) override;
      87             : 
      88             :     // nsIMutationObserver interface
      89             :     NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
      90             :     NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
      91             :     NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
      92             :     NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
      93             :     NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
      94             :     NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
      95             : 
      96             :     // nsWrapperCache
      97             :     virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      98             : 
      99             :     // WebIDL
     100             :     nsISupports*
     101           0 :     GetParentObject() const
     102             :     {
     103           0 :         return mOwner;
     104             :     }
     105             : 
     106             :     static already_AddRefed<txMozillaXSLTProcessor>
     107             :     Constructor(const mozilla::dom::GlobalObject& aGlobal,
     108             :                 mozilla::ErrorResult& aRv);
     109             : 
     110             :     void ImportStylesheet(nsINode& stylesheet,
     111             :                           mozilla::ErrorResult& aRv);
     112             :     already_AddRefed<mozilla::dom::DocumentFragment>
     113             :     TransformToFragment(nsINode& source, nsIDocument& docVal, mozilla::ErrorResult& aRv);
     114             :     already_AddRefed<nsIDocument>
     115             :     TransformToDocument(nsINode& source, mozilla::ErrorResult& aRv);
     116             : 
     117             :     void SetParameter(JSContext* aCx,
     118             :                       const nsAString& aNamespaceURI,
     119             :                       const nsAString& aLocalName,
     120             :                       JS::Handle<JS::Value> aValue,
     121             :                       mozilla::ErrorResult& aRv);
     122             :     nsIVariant* GetParameter(const nsAString& aNamespaceURI,
     123             :                              const nsAString& aLocalName,
     124             :                              mozilla::ErrorResult& aRv);
     125           0 :     void RemoveParameter(const nsAString& aNamespaceURI,
     126             :                          const nsAString& aLocalName,
     127             :                          mozilla::ErrorResult& aRv)
     128             :     {
     129           0 :         aRv = RemoveParameter(aNamespaceURI, aLocalName);
     130           0 :     }
     131             : 
     132             :     uint32_t Flags(mozilla::dom::SystemCallerGuarantee);
     133             :     void SetFlags(uint32_t aFlags, mozilla::dom::SystemCallerGuarantee);
     134             : 
     135             :     nsresult setStylesheet(txStylesheet* aStylesheet);
     136             :     void reportError(nsresult aResult, const char16_t *aErrorText,
     137             :                      const char16_t *aSourceText);
     138             : 
     139           0 :     nsIDOMNode *GetSourceContentModel()
     140             :     {
     141           0 :         return mSource;
     142             :     }
     143             : 
     144             :     nsresult TransformToDoc(nsIDOMDocument **aResult,
     145             :                             bool aCreateDataDocument);
     146             : 
     147           0 :     bool IsLoadDisabled()
     148             :     {
     149           0 :         return (mFlags & DISABLE_ALL_LOADS) != 0;
     150             :     }
     151             : 
     152             :     static nsresult Startup();
     153             :     static void Shutdown();
     154             : 
     155             : private:
     156             :     explicit txMozillaXSLTProcessor(nsISupports* aOwner);
     157             :     /**
     158             :      * Default destructor for txMozillaXSLTProcessor
     159             :      */
     160             :     ~txMozillaXSLTProcessor();
     161             : 
     162             :     nsresult DoTransform();
     163             :     void notifyError();
     164             :     nsresult ensureStylesheet();
     165             : 
     166             :     nsCOMPtr<nsISupports> mOwner;
     167             : 
     168             :     RefPtr<txStylesheet> mStylesheet;
     169             :     nsIDocument* mStylesheetDocument; // weak
     170             :     nsCOMPtr<nsIContent> mEmbeddedStylesheetRoot;
     171             : 
     172             :     nsCOMPtr<nsIDOMNode> mSource;
     173             :     nsresult mTransformResult;
     174             :     nsresult mCompileResult;
     175             :     nsString mErrorText, mSourceText;
     176             :     nsCOMPtr<nsITransformObserver> mObserver;
     177             :     txOwningExpandedNameMap<txIGlobalParameter> mVariables;
     178             :     txNamespaceMap mParamNamespaceMap;
     179             :     RefPtr<txResultRecycler> mRecycler;
     180             : 
     181             :     uint32_t mFlags;
     182             : };
     183             : 
     184             : extern nsresult TX_LoadSheet(nsIURI* aUri, txMozillaXSLTProcessor* aProcessor,
     185             :                              nsIDocument* aLoaderDocument,
     186             :                              mozilla::net::ReferrerPolicy aReferrerPolicy);
     187             : 
     188             : extern nsresult TX_CompileStylesheet(nsINode* aNode,
     189             :                                      txMozillaXSLTProcessor* aProcessor,
     190             :                                      txStylesheet** aStylesheet);
     191             : 
     192             : #endif

Generated by: LCOV version 1.13