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: */
|
2013-07-09 18:45:13 +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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_WindowNamedPropertiesHandler_h
|
2013-08-10 09:10:18 +04:00
|
|
|
#define mozilla_dom_WindowNamedPropertiesHandler_h
|
2013-07-09 18:45:13 +04:00
|
|
|
|
|
|
|
#include "mozilla/dom/DOMJSProxyHandler.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class WindowNamedPropertiesHandler : public BaseDOMProxyHandler
|
|
|
|
{
|
|
|
|
public:
|
2014-08-29 00:47:16 +04:00
|
|
|
MOZ_CONSTEXPR WindowNamedPropertiesHandler()
|
2014-06-27 15:44:02 +04:00
|
|
|
: BaseDOMProxyHandler(nullptr, /* hasPrototype = */ true)
|
2013-07-09 18:45:13 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
virtual bool
|
2014-08-02 07:37:14 +04:00
|
|
|
getOwnPropDescriptor(JSContext* aCx, JS::Handle<JSObject*> aProxy,
|
|
|
|
JS::Handle<jsid> aId,
|
|
|
|
bool /* unused */,
|
2016-01-28 13:28:04 +03:00
|
|
|
JS::MutableHandle<JS::PropertyDescriptor> aDesc)
|
2015-03-21 19:28:04 +03:00
|
|
|
const override;
|
2013-07-09 18:45:13 +04:00
|
|
|
virtual bool
|
|
|
|
defineProperty(JSContext* aCx, JS::Handle<JSObject*> aProxy,
|
|
|
|
JS::Handle<jsid> aId,
|
2016-01-28 13:28:04 +03:00
|
|
|
JS::Handle<JS::PropertyDescriptor> aDesc,
|
2015-03-21 19:28:04 +03:00
|
|
|
JS::ObjectOpResult &result) const override;
|
2013-07-09 18:45:13 +04:00
|
|
|
virtual bool
|
2014-04-16 06:58:44 +04:00
|
|
|
ownPropNames(JSContext* aCx, JS::Handle<JSObject*> aProxy, unsigned flags,
|
2015-03-21 19:28:04 +03:00
|
|
|
JS::AutoIdVector& aProps) const override;
|
2013-07-09 18:45:13 +04:00
|
|
|
virtual bool
|
|
|
|
delete_(JSContext* aCx, JS::Handle<JSObject*> aProxy, JS::Handle<jsid> aId,
|
2015-03-21 19:28:04 +03:00
|
|
|
JS::ObjectOpResult &aResult) const override;
|
2016-02-24 00:42:30 +03:00
|
|
|
|
2016-03-19 02:45:31 +03:00
|
|
|
// No need for getPrototypeIfOrdinary here: window named-properties objects
|
2016-04-30 05:59:40 +03:00
|
|
|
// have static prototypes, so the version inherited from BaseDOMProxyHandler
|
|
|
|
// will do the right thing.
|
2016-02-24 00:42:30 +03:00
|
|
|
|
2013-07-09 18:45:13 +04:00
|
|
|
virtual bool
|
2014-10-21 22:40:04 +04:00
|
|
|
preventExtensions(JSContext* aCx, JS::Handle<JSObject*> aProxy,
|
2015-03-21 19:28:04 +03:00
|
|
|
JS::ObjectOpResult& aResult) const override
|
2014-10-21 22:40:04 +04:00
|
|
|
{
|
2015-02-04 21:01:01 +03:00
|
|
|
return aResult.failCantPreventExtensions();
|
2014-10-21 22:40:04 +04:00
|
|
|
}
|
|
|
|
virtual bool
|
2013-07-09 18:45:13 +04:00
|
|
|
isExtensible(JSContext* aCx, JS::Handle<JSObject*> aProxy,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool* aIsExtensible) const override
|
2013-07-09 18:45:13 +04:00
|
|
|
{
|
|
|
|
*aIsExtensible = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual const char*
|
2015-03-21 19:28:04 +03:00
|
|
|
className(JSContext *aCx, JS::Handle<JSObject*> aProxy) const override
|
2013-07-09 18:45:13 +04:00
|
|
|
{
|
|
|
|
return "WindowProperties";
|
|
|
|
}
|
|
|
|
|
2014-06-27 15:44:04 +04:00
|
|
|
static const WindowNamedPropertiesHandler*
|
2013-07-09 18:45:13 +04:00
|
|
|
getInstance()
|
|
|
|
{
|
2014-06-27 15:44:04 +04:00
|
|
|
static const WindowNamedPropertiesHandler instance;
|
2013-07-09 18:45:13 +04:00
|
|
|
return &instance;
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:36:36 +04:00
|
|
|
// For Create, aProto is the parent of the interface prototype object of the
|
|
|
|
// Window we're associated with.
|
|
|
|
static JSObject*
|
|
|
|
Create(JSContext *aCx, JS::Handle<JSObject*> aProto);
|
2013-07-09 18:45:13 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_WindowNamedPropertiesHandler_h */
|