summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/wrappers/XrayWrapper.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-02-07 10:39:40 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-02-07 10:39:40 +0100
commit88db0108b14d58cf5d82ed7346f48f010feaaf0d (patch)
tree1d78ae8cd21d7d17293f66c166ca44718501d4aa /js/xpconnect/wrappers/XrayWrapper.cpp
parent8db772d2ca44ff44f32d434e7f62acba289b4155 (diff)
downloadUXP-88db0108b14d58cf5d82ed7346f48f010feaaf0d.tar
UXP-88db0108b14d58cf5d82ed7346f48f010feaaf0d.tar.gz
UXP-88db0108b14d58cf5d82ed7346f48f010feaaf0d.tar.lz
UXP-88db0108b14d58cf5d82ed7346f48f010feaaf0d.tar.xz
UXP-88db0108b14d58cf5d82ed7346f48f010feaaf0d.zip
Align `instanceof` with the final ES6 spec.
Diffstat (limited to 'js/xpconnect/wrappers/XrayWrapper.cpp')
-rw-r--r--js/xpconnect/wrappers/XrayWrapper.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp
index 48a9fdc68..6e5a2f5e5 100644
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -2309,6 +2309,20 @@ XrayWrapper<Base, Traits>::getBuiltinClass(JSContext* cx, JS::HandleObject wrapp
}
template <typename Base, typename Traits>
+bool
+XrayWrapper<Base, Traits>::hasInstance(JSContext* cx,
+ JS::HandleObject wrapper,
+ JS::MutableHandleValue v,
+ bool* bp) const {
+ assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::GET);
+
+ // CrossCompartmentWrapper::hasInstance unwraps |wrapper|'s Xrays and enters
+ // its compartment. Any present XrayWrappers should be preserved, so the
+ // standard "instanceof" implementation is called without unwrapping first.
+ return JS::InstanceofOperator(cx, wrapper, v, bp);
+}
+
+template <typename Base, typename Traits>
const char*
XrayWrapper<Base, Traits>::className(JSContext* cx, HandleObject wrapper) const
{