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 #ifndef nsDOMSerializer_h_
7 #define nsDOMSerializer_h_
9 #include "nsIDOMSerializer.h"
10 #include "nsWrapperCache.h"
11 #include "mozilla/ErrorResult.h"
12 #include "mozilla/dom/XMLSerializerBinding.h"
13 #include "nsAutoPtr.h"
17 class nsDOMSerializer MOZ_FINAL
: public nsIDOMSerializer
,
23 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
24 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMSerializer
)
27 NS_DECL_NSIDOMSERIALIZER
30 static already_AddRefed
<nsDOMSerializer
>
31 Constructor(const mozilla::dom::GlobalObject
& aOwner
,
32 mozilla::ErrorResult
& rv
)
34 nsRefPtr
<nsDOMSerializer
> domSerializer
= new nsDOMSerializer(aOwner
.GetAsSupports());
35 return domSerializer
.forget();
39 SerializeToString(nsINode
& aRoot
, nsAString
& aStr
,
40 mozilla::ErrorResult
& rv
);
43 SerializeToStream(nsINode
& aRoot
, nsIOutputStream
* aStream
,
44 const nsAString
& aCharset
, mozilla::ErrorResult
& rv
);
46 nsISupports
* GetParentObject() const
51 virtual JSObject
* WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
53 return mozilla::dom::XMLSerializerBinding::Wrap(aCx
, this);
57 virtual ~nsDOMSerializer();
59 explicit nsDOMSerializer(nsISupports
* aOwner
) : mOwner(aOwner
)
64 nsCOMPtr
<nsISupports
> mOwner
;