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