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 nsXBLProtoImplProperty_h__
|
|
|
|
#define nsXBLProtoImplProperty_h__
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2017-10-03 01:05:19 +03:00
|
|
|
#include "nsAtom.h"
|
2001-11-13 07:09:56 +03:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsString.h"
|
2011-11-04 00:39:08 +04:00
|
|
|
#include "nsXBLSerialize.h"
|
2013-06-18 14:00:38 +04:00
|
|
|
#include "nsXBLMaybeCompiled.h"
|
2001-11-13 07:09:56 +03:00
|
|
|
#include "nsXBLProtoImplMember.h"
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2001-11-13 07:09:56 +03:00
|
|
|
class nsXBLProtoImplProperty : public nsXBLProtoImplMember {
|
2001-08-28 02:15:45 +04:00
|
|
|
public:
|
2014-01-04 19:02:17 +04:00
|
|
|
nsXBLProtoImplProperty(const char16_t* aName, const char16_t* aGetter,
|
|
|
|
const char16_t* aSetter, const char16_t* aReadOnly,
|
2012-12-18 00:22:38 +04:00
|
|
|
uint32_t aLineNumber);
|
2011-11-04 00:39:08 +04:00
|
|
|
|
2014-01-04 19:02:17 +04:00
|
|
|
nsXBLProtoImplProperty(const char16_t* aName, const bool aIsReadOnly);
|
2017-05-10 06:45:11 +03:00
|
|
|
|
2001-11-13 07:09:56 +03:00
|
|
|
virtual ~nsXBLProtoImplProperty();
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2002-03-24 01:46:13 +03:00
|
|
|
void AppendGetterText(const nsAString& aGetter);
|
|
|
|
void AppendSetterText(const nsAString& aSetter);
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetGetterLineNumber(uint32_t aLineNumber);
|
|
|
|
void SetSetterLineNumber(uint32_t aLineNumber);
|
2003-06-24 05:20:40 +04:00
|
|
|
|
2013-02-08 18:24:21 +04:00
|
|
|
virtual nsresult InstallMember(
|
2015-03-21 19:28:04 +03:00
|
|
|
JSContext* aCx, JS::Handle<JSObject*> aTargetClassObject) override;
|
2015-03-13 22:05:57 +03:00
|
|
|
virtual nsresult CompileMember(mozilla::dom::AutoJSAPI& jsapi,
|
|
|
|
const nsString& aClassStr,
|
2015-03-21 19:28:04 +03:00
|
|
|
JS::Handle<JSObject*> aClassObject) override;
|
2001-11-13 07:09:56 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void Trace(const TraceCallbacks& aCallback, void* aClosure) override;
|
2007-05-24 18:10:02 +04:00
|
|
|
|
2013-08-09 20:25:13 +04:00
|
|
|
nsresult Read(nsIObjectInputStream* aStream,
|
2011-11-04 00:39:08 +04:00
|
|
|
XBLBindingSerializeDetails aType);
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult Write(nsIObjectOutputStream* aStream) override;
|
2011-11-04 00:39:08 +04:00
|
|
|
|
2001-11-13 07:09:56 +03:00
|
|
|
protected:
|
2013-06-18 14:00:38 +04:00
|
|
|
typedef JS::Heap<nsXBLMaybeCompiled<nsXBLTextWithLineNumber> > PropertyOp;
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2013-06-18 14:00:38 +04:00
|
|
|
void EnsureUncompiledText(PropertyOp& aPropertyOp);
|
|
|
|
|
|
|
|
// The raw text for the getter, or the JS object (after compilation).
|
|
|
|
PropertyOp mGetter;
|
|
|
|
|
|
|
|
// The raw text for the setter, or the JS object (after compilation).
|
|
|
|
PropertyOp mSetter;
|
2017-05-10 06:45:11 +03:00
|
|
|
|
2013-06-18 14:00:38 +04:00
|
|
|
unsigned mJSAttributes; // A flag for all our JS properties
|
|
|
|
// (getter/setter/readonly/shared/enum)
|
2005-02-06 23:34:15 +03:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsCompiled;
|
2005-02-06 23:34:15 +03:00
|
|
|
#endif
|
2001-11-13 07:09:56 +03:00
|
|
|
};
|
2001-08-28 02:15:45 +04:00
|
|
|
|
2001-11-13 07:09:56 +03:00
|
|
|
#endif // nsXBLProtoImplProperty_h__
|