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 nsXBLProtoImplMember_h__
7 #define nsXBLProtoImplMember_h__
12 #include "nsIServiceManager.h"
13 #include "nsContentUtils.h" // For NS_CONTENT_DELETE_LIST_MEMBER.
14 #include "nsCycleCollectionParticipant.h"
17 class nsIObjectOutputStream
;
19 struct nsXBLTextWithLineNumber
24 nsXBLTextWithLineNumber() :
28 MOZ_COUNT_CTOR(nsXBLTextWithLineNumber
);
31 ~nsXBLTextWithLineNumber() {
32 MOZ_COUNT_DTOR(nsXBLTextWithLineNumber
);
34 nsMemory::Free(mText
);
38 void AppendText(const nsAString
& aText
) {
40 char16_t
* temp
= mText
;
41 mText
= ToNewUnicode(nsDependentString(temp
) + aText
);
44 mText
= ToNewUnicode(aText
);
52 void SetLineNumber(uint32_t aLineNumber
) {
53 mLineNumber
= aLineNumber
;
56 uint32_t GetLineNumber() {
61 class nsXBLProtoImplMember
64 explicit nsXBLProtoImplMember(const char16_t
* aName
)
66 , mExposeToUntrustedContent(false)
68 mName
= ToNewUnicode(nsDependentString(aName
));
70 virtual ~nsXBLProtoImplMember() {
71 nsMemory::Free(mName
);
72 NS_CONTENT_DELETE_LIST_MEMBER(nsXBLProtoImplMember
, this, mNext
);
75 nsXBLProtoImplMember
* GetNext() { return mNext
; }
76 void SetNext(nsXBLProtoImplMember
* aNext
) { mNext
= aNext
; }
77 bool ShouldExposeToUntrustedContent() { return mExposeToUntrustedContent
; }
78 void SetExposeToUntrustedContent(bool aExpose
) { mExposeToUntrustedContent
= aExpose
; }
79 const char16_t
* GetName() { return mName
; }
81 virtual nsresult
InstallMember(JSContext
* aCx
,
82 JS::Handle
<JSObject
*> aTargetClassObject
) = 0;
83 virtual nsresult
CompileMember(mozilla::dom::AutoJSAPI
& jsapi
, const nsCString
& aClassStr
,
84 JS::Handle
<JSObject
*> aClassObject
) = 0;
86 virtual void Trace(const TraceCallbacks
& aCallbacks
, void *aClosure
) = 0;
88 virtual nsresult
Write(nsIObjectOutputStream
* aStream
)
94 nsXBLProtoImplMember
* mNext
; // The members of an implementation are chained.
95 char16_t
* mName
; // The name of the field, method, or property.
97 bool mExposeToUntrustedContent
; // If this binding is installed on an element
98 // in an untrusted scope, should this
99 // implementation member be accessible to the
103 #endif // nsXBLProtoImplMember_h__