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 | #ifndef nsDOMSerializer_h_ |
michael@0 | 7 | #define nsDOMSerializer_h_ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsIDOMSerializer.h" |
michael@0 | 10 | #include "nsWrapperCache.h" |
michael@0 | 11 | #include "mozilla/ErrorResult.h" |
michael@0 | 12 | #include "mozilla/dom/XMLSerializerBinding.h" |
michael@0 | 13 | #include "nsAutoPtr.h" |
michael@0 | 14 | |
michael@0 | 15 | class nsINode; |
michael@0 | 16 | |
michael@0 | 17 | class nsDOMSerializer MOZ_FINAL : public nsIDOMSerializer, |
michael@0 | 18 | public nsWrapperCache |
michael@0 | 19 | { |
michael@0 | 20 | public: |
michael@0 | 21 | nsDOMSerializer(); |
michael@0 | 22 | virtual ~nsDOMSerializer(); |
michael@0 | 23 | |
michael@0 | 24 | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
michael@0 | 25 | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMSerializer) |
michael@0 | 26 | |
michael@0 | 27 | // nsIDOMSerializer |
michael@0 | 28 | NS_DECL_NSIDOMSERIALIZER |
michael@0 | 29 | |
michael@0 | 30 | // WebIDL API |
michael@0 | 31 | static already_AddRefed<nsDOMSerializer> |
michael@0 | 32 | Constructor(const mozilla::dom::GlobalObject& aOwner, |
michael@0 | 33 | mozilla::ErrorResult& rv) |
michael@0 | 34 | { |
michael@0 | 35 | nsRefPtr<nsDOMSerializer> domSerializer = new nsDOMSerializer(aOwner.GetAsSupports()); |
michael@0 | 36 | return domSerializer.forget(); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | void |
michael@0 | 40 | SerializeToString(nsINode& aRoot, nsAString& aStr, |
michael@0 | 41 | mozilla::ErrorResult& rv); |
michael@0 | 42 | |
michael@0 | 43 | void |
michael@0 | 44 | SerializeToStream(nsINode& aRoot, nsIOutputStream* aStream, |
michael@0 | 45 | const nsAString& aCharset, mozilla::ErrorResult& rv); |
michael@0 | 46 | |
michael@0 | 47 | nsISupports* GetParentObject() const |
michael@0 | 48 | { |
michael@0 | 49 | return mOwner; |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE |
michael@0 | 53 | { |
michael@0 | 54 | return mozilla::dom::XMLSerializerBinding::Wrap(aCx, this); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | private: |
michael@0 | 58 | nsDOMSerializer(nsISupports* aOwner) : mOwner(aOwner) |
michael@0 | 59 | { |
michael@0 | 60 | MOZ_ASSERT(aOwner); |
michael@0 | 61 | SetIsDOMBinding(); |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | nsCOMPtr<nsISupports> mOwner; |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | |
michael@0 | 68 | #endif |
michael@0 | 69 |