gecko/js/xpconnect/wrappers/AddonWrapper.h
Jason Orendorff 2999d4406e Bug 1081255 - Rewrite comments in jsproxy.h; reclassify the methods a bit. No change in behavior. r=efaust, r=bz, r=jwalden.
--HG--
extra : rebase_source : b3440548322d65b2bd01862fb863e6197eb263c6
2014-10-08 12:09:08 -05:00

48 lines
2.0 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=99: */
/* 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/. */
#ifndef AddonWrapper_h
#define AddonWrapper_h
#include "mozilla/Attributes.h"
#include "nsID.h"
#include "jswrapper.h"
namespace xpc {
bool
Interpose(JSContext *cx, JS::HandleObject target, const nsIID *iid, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> descriptor);
template<typename Base>
class AddonWrapper : public Base {
public:
explicit MOZ_CONSTEXPR AddonWrapper(unsigned flags) : Base(flags) { }
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
virtual bool defineProperty(JSContext *cx, JS::HandleObject proxy, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
virtual bool delete_(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, bool *bp) const MOZ_OVERRIDE;
virtual bool get(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> receiver,
JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) const MOZ_OVERRIDE;
virtual bool set(JSContext *cx, JS::HandleObject wrapper, JS::HandleObject receiver,
JS::HandleId id, bool strict, JS::MutableHandleValue vp) const MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
static const AddonWrapper singleton;
};
} // namespace xpc
#endif // AddonWrapper_h