1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 sw=2 et tw=78: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_WindowNamedPropertiesHandler_h
8 #define mozilla_dom_WindowNamedPropertiesHandler_h
10 #include "mozilla/dom/DOMJSProxyHandler.h"
15 class WindowNamedPropertiesHandler
: public BaseDOMProxyHandler
18 WindowNamedPropertiesHandler() : BaseDOMProxyHandler(nullptr)
20 setHasPrototype(true);
23 preventExtensions(JSContext
* aCx
, JS::Handle
<JSObject
*> aProxy
) MOZ_OVERRIDE
25 // Throw a TypeError, per WebIDL.
26 JS_ReportErrorNumber(aCx
, js_GetErrorMessage
, nullptr,
27 JSMSG_CANT_CHANGE_EXTENSIBILITY
);
31 getOwnPropertyDescriptor(JSContext
* aCx
, JS::Handle
<JSObject
*> aProxy
,
33 JS::MutableHandle
<JSPropertyDescriptor
> aDesc
,
34 unsigned aFlags
) MOZ_OVERRIDE
;
36 defineProperty(JSContext
* aCx
, JS::Handle
<JSObject
*> aProxy
,
38 JS::MutableHandle
<JSPropertyDescriptor
> aDesc
) MOZ_OVERRIDE
;
40 getOwnPropertyNames(JSContext
* aCx
, JS::Handle
<JSObject
*> aProxy
,
41 JS::AutoIdVector
& aProps
) MOZ_OVERRIDE
;
43 delete_(JSContext
* aCx
, JS::Handle
<JSObject
*> aProxy
, JS::Handle
<jsid
> aId
,
44 bool* aBp
) MOZ_OVERRIDE
;
46 isExtensible(JSContext
* aCx
, JS::Handle
<JSObject
*> aProxy
,
47 bool* aIsExtensible
) MOZ_OVERRIDE
49 *aIsExtensible
= true;
53 className(JSContext
*aCx
, JS::Handle
<JSObject
*> aProxy
) MOZ_OVERRIDE
55 return "WindowProperties";
58 static WindowNamedPropertiesHandler
*
61 static WindowNamedPropertiesHandler instance
;
65 // For Install, aProto is the proto of the Window we're associated with.
67 Install(JSContext
*aCx
, JS::Handle
<JSObject
*> aProto
);
71 } // namespace mozilla
73 #endif /* mozilla_dom_WindowNamedPropertiesHandler_h */