2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2001-11-13 07:09:56 +03:00
|
|
|
#ifndef nsXBLProtoImplMember_h__
|
|
|
|
#define nsXBLProtoImplMember_h__
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2001-11-13 07:09:56 +03:00
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsIServiceManager.h"
|
2013-02-01 14:56:02 +04:00
|
|
|
#include "nsContentUtils.h" // For NS_CONTENT_DELETE_LIST_MEMBER.
|
2007-10-29 16:45:07 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2013-03-17 11:55:15 +04:00
|
|
|
class nsIObjectOutputStream;
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2003-06-24 05:20:40 +04:00
|
|
|
struct nsXBLTextWithLineNumber
|
|
|
|
{
|
2014-01-04 19:02:17 +04:00
|
|
|
char16_t* mText;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mLineNumber;
|
2003-06-24 05:20:40 +04:00
|
|
|
|
|
|
|
nsXBLTextWithLineNumber() :
|
2012-07-30 18:20:58 +04:00
|
|
|
mText(nullptr),
|
2003-06-24 05:20:40 +04:00
|
|
|
mLineNumber(0)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(nsXBLTextWithLineNumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsXBLTextWithLineNumber() {
|
|
|
|
MOZ_COUNT_DTOR(nsXBLTextWithLineNumber);
|
|
|
|
if (mText) {
|
2015-03-27 03:01:12 +03:00
|
|
|
free(mText);
|
2003-06-24 05:20:40 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AppendText(const nsAString& aText) {
|
|
|
|
if (mText) {
|
2014-01-04 19:02:17 +04:00
|
|
|
char16_t* temp = mText;
|
2003-06-24 05:20:40 +04:00
|
|
|
mText = ToNewUnicode(nsDependentString(temp) + aText);
|
2015-03-27 03:01:12 +03:00
|
|
|
free(temp);
|
2003-06-24 05:20:40 +04:00
|
|
|
} else {
|
|
|
|
mText = ToNewUnicode(aText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-04 19:02:17 +04:00
|
|
|
char16_t* GetText() {
|
2003-06-24 05:20:40 +04:00
|
|
|
return mText;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetLineNumber(uint32_t aLineNumber) {
|
2003-06-24 05:20:40 +04:00
|
|
|
mLineNumber = aLineNumber;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t GetLineNumber() {
|
2003-06-24 05:20:40 +04:00
|
|
|
return mLineNumber;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2001-11-13 07:09:56 +03:00
|
|
|
class nsXBLProtoImplMember
|
2001-08-28 02:15:45 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit nsXBLProtoImplMember(const char16_t* aName)
|
2013-11-01 18:31:56 +04:00
|
|
|
: mNext(nullptr)
|
|
|
|
, mExposeToUntrustedContent(false)
|
|
|
|
{
|
|
|
|
mName = ToNewUnicode(nsDependentString(aName));
|
|
|
|
}
|
2008-12-15 14:33:56 +03:00
|
|
|
virtual ~nsXBLProtoImplMember() {
|
2015-03-27 03:01:12 +03:00
|
|
|
free(mName);
|
2008-12-15 14:33:56 +03:00
|
|
|
NS_CONTENT_DELETE_LIST_MEMBER(nsXBLProtoImplMember, this, mNext);
|
|
|
|
}
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2007-04-23 18:21:53 +04:00
|
|
|
nsXBLProtoImplMember* GetNext() { return mNext; }
|
|
|
|
void SetNext(nsXBLProtoImplMember* aNext) { mNext = aNext; }
|
2013-11-01 18:31:56 +04:00
|
|
|
bool ShouldExposeToUntrustedContent() { return mExposeToUntrustedContent; }
|
|
|
|
void SetExposeToUntrustedContent(bool aExpose) { mExposeToUntrustedContent = aExpose; }
|
2014-01-04 19:02:17 +04:00
|
|
|
const char16_t* GetName() { return mName; }
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2013-02-08 18:24:21 +04:00
|
|
|
virtual nsresult InstallMember(JSContext* aCx,
|
2013-04-05 17:21:02 +04:00
|
|
|
JS::Handle<JSObject*> aTargetClassObject) = 0;
|
2015-03-13 22:05:57 +03:00
|
|
|
virtual nsresult CompileMember(mozilla::dom::AutoJSAPI& jsapi, const nsString& aClassStr,
|
2013-04-05 17:21:02 +04:00
|
|
|
JS::Handle<JSObject*> aClassObject) = 0;
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2013-05-27 15:50:49 +04:00
|
|
|
virtual void Trace(const TraceCallbacks& aCallbacks, void *aClosure) = 0;
|
2007-05-24 18:10:02 +04:00
|
|
|
|
2013-08-09 20:25:13 +04:00
|
|
|
virtual nsresult Write(nsIObjectOutputStream* aStream)
|
2011-11-04 00:39:08 +04:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-11-13 07:09:56 +03:00
|
|
|
protected:
|
|
|
|
nsXBLProtoImplMember* mNext; // The members of an implementation are chained.
|
2014-01-04 19:02:17 +04:00
|
|
|
char16_t* mName; // The name of the field, method, or property.
|
2013-11-01 18:31:56 +04:00
|
|
|
|
|
|
|
bool mExposeToUntrustedContent; // If this binding is installed on an element
|
|
|
|
// in an untrusted scope, should this
|
|
|
|
// implementation member be accessible to the
|
|
|
|
// content?
|
2005-09-16 19:44:59 +04:00
|
|
|
};
|
|
|
|
|
2001-11-13 07:09:56 +03:00
|
|
|
#endif // nsXBLProtoImplMember_h__
|