* InterfaceBase::has_instance: * * JSNative implementation of `[Symbol.hasInstance]()`. This method is never * called directly, but instead is called indirectly by the JS engine as part of * an `instanceof` expression. */
| 107 | * an `instanceof` expression. |
| 108 | */ |
| 109 | bool InterfaceBase::has_instance(JSContext* cx, unsigned argc, JS::Value* vp) { |
| 110 | GJS_GET_THIS(cx, argc, vp, args, interface_constructor); |
| 111 | |
| 112 | JS::RootedObject interface_proto(cx); |
| 113 | const GjsAtoms& atoms = GjsContextPrivate::atoms(cx); |
| 114 | if (!gjs_object_require_property(cx, interface_constructor, |
| 115 | "interface constructor", atoms.prototype(), |
| 116 | &interface_proto)) |
| 117 | return false; |
| 118 | |
| 119 | InterfaceBase* priv; |
| 120 | if (!for_js_typecheck(cx, interface_proto, &priv)) |
| 121 | return false; |
| 122 | |
| 123 | return priv->to_prototype()->has_instance_impl(cx, args); |
| 124 | } |
| 125 | |
| 126 | // See InterfaceBase::has_instance(). |
| 127 | bool InterfacePrototype::has_instance_impl(JSContext* cx, |
nothing calls this directly
no test coverage detected