2014-07-15 09:10:05 +04:00
|
|
|
/* -*- 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"
|
|
|
|
|
2014-07-15 09:49:09 +04:00
|
|
|
#include "nsID.h"
|
|
|
|
|
2014-07-15 09:10:05 +04:00
|
|
|
#include "jswrapper.h"
|
|
|
|
|
|
|
|
namespace xpc {
|
|
|
|
|
|
|
|
bool
|
2015-05-07 15:03:24 +03:00
|
|
|
InterposeProperty(JSContext* cx, JS::HandleObject target, const nsIID* iid, JS::HandleId id,
|
2016-01-28 13:28:04 +03:00
|
|
|
JS::MutableHandle<JS::PropertyDescriptor> descriptor);
|
2015-05-07 15:03:24 +03:00
|
|
|
|
|
|
|
bool
|
|
|
|
InterposeCall(JSContext* cx, JS::HandleObject wrapper,
|
|
|
|
const JS::CallArgs& args, bool& done);
|
2014-07-15 09:10:05 +04:00
|
|
|
|
|
|
|
template<typename Base>
|
|
|
|
class AddonWrapper : public Base {
|
|
|
|
public:
|
2016-07-09 00:39:53 +03:00
|
|
|
explicit constexpr AddonWrapper(unsigned flags) : Base(flags) { }
|
2014-07-15 09:10:05 +04:00
|
|
|
|
2015-03-29 01:22:11 +03:00
|
|
|
virtual bool getOwnPropertyDescriptor(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
2014-07-15 09:10:05 +04:00
|
|
|
JS::Handle<jsid> id,
|
2016-01-28 13:28:04 +03:00
|
|
|
JS::MutableHandle<JS::PropertyDescriptor> desc) const override;
|
2015-03-29 01:22:11 +03:00
|
|
|
virtual bool defineProperty(JSContext* cx, JS::HandleObject proxy, JS::HandleId id,
|
2016-01-28 13:28:04 +03:00
|
|
|
JS::Handle<JS::PropertyDescriptor> desc,
|
2015-03-29 01:22:11 +03:00
|
|
|
JS::ObjectOpResult& result) const override;
|
|
|
|
virtual bool delete_(JSContext* cx, JS::HandleObject proxy, JS::HandleId id,
|
|
|
|
JS::ObjectOpResult& result) const override;
|
2015-09-18 01:14:41 +03:00
|
|
|
virtual bool get(JSContext* cx, JS::Handle<JSObject*> wrapper, JS::Handle<JS::Value> receiver,
|
2015-03-21 19:28:04 +03:00
|
|
|
JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) const override;
|
2015-03-29 01:22:11 +03:00
|
|
|
virtual bool set(JSContext* cx, JS::HandleObject wrapper, JS::HandleId id, JS::HandleValue v,
|
|
|
|
JS::HandleValue receiver, JS::ObjectOpResult& result) const override;
|
2015-05-07 15:03:24 +03:00
|
|
|
virtual bool call(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|
|
|
const JS::CallArgs& args) const override;
|
2014-07-15 09:10:05 +04:00
|
|
|
|
2015-03-29 01:22:11 +03:00
|
|
|
virtual bool getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
2014-10-08 21:09:08 +04:00
|
|
|
JS::Handle<jsid> id,
|
2016-01-28 13:28:04 +03:00
|
|
|
JS::MutableHandle<JS::PropertyDescriptor> desc) const override;
|
2014-07-15 09:10:05 +04:00
|
|
|
|
2014-08-14 02:23:28 +04:00
|
|
|
static const AddonWrapper singleton;
|
2014-07-15 09:10:05 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace xpc
|
|
|
|
|
|
|
|
#endif // AddonWrapper_h
|