1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
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 /* DOM proxy-related functionality, including expando support. */
9 #include "js/friend/DOMProxy.h" // JS::DOMProxyShadowsCheck
10 #include "proxy/DOMProxy.h"
12 #include "js/Proxy.h" // js::GetProxyHandler, js::IsProxy
14 using JS::DOMProxyShadowsCheck
;
16 static const void* gDOMProxyHandlerFamily
= nullptr;
17 static DOMProxyShadowsCheck gDOMProxyShadowsCheck
= nullptr;
18 static const void* gDOMRemoteProxyHandlerFamily
= nullptr;
20 void JS::SetDOMProxyInformation(const void* domProxyHandlerFamily
,
21 DOMProxyShadowsCheck domProxyShadowsCheck
,
22 const void* domRemoteProxyHandlerFamily
) {
23 gDOMProxyHandlerFamily
= domProxyHandlerFamily
;
24 gDOMProxyShadowsCheck
= domProxyShadowsCheck
;
25 gDOMRemoteProxyHandlerFamily
= domRemoteProxyHandlerFamily
;
28 const void* js::GetDOMProxyHandlerFamily() { return gDOMProxyHandlerFamily
; }
30 DOMProxyShadowsCheck
js::GetDOMProxyShadowsCheck() {
31 return gDOMProxyShadowsCheck
;
34 const void* js::GetDOMRemoteProxyHandlerFamily() {
35 return gDOMRemoteProxyHandlerFamily
;
38 bool js::IsDOMRemoteProxyObject(JSObject
* object
) {
39 return js::IsProxy(object
) && js::GetProxyHandler(object
)->family() ==
40 js::GetDOMRemoteProxyHandlerFamily();