mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1270746 part 4 - Inline Proxy::hasInstance call instead of using a class hook. r=iain
This can be changed more later on, but for now this ensures no change in behavior. Differential Revision: https://phabricator.services.mozilla.com/D141345
This commit is contained in:
parent
07e7d34e88
commit
b1c10b996e
@ -921,7 +921,7 @@ const JSClassOps js::ProxyClassOps = {
|
||||
nullptr, // mayResolve
|
||||
proxy_Finalize, // finalize
|
||||
nullptr, // call
|
||||
Proxy::hasInstance, // hasInstance
|
||||
nullptr, // hasInstance
|
||||
nullptr, // construct
|
||||
ProxyObject::trace, // trace
|
||||
};
|
||||
|
@ -839,12 +839,15 @@ extern bool JS::InstanceofOperator(JSContext* cx, HandleObject obj,
|
||||
}
|
||||
|
||||
bool js::HasInstance(JSContext* cx, HandleObject obj, HandleValue v, bool* bp) {
|
||||
const JSClass* clasp = obj->getClass();
|
||||
RootedValue local(cx, v);
|
||||
if (JSHasInstanceOp hasInstance = clasp->getHasInstance()) {
|
||||
if (MOZ_UNLIKELY(obj->is<ProxyObject>())) {
|
||||
RootedValue local(cx, v);
|
||||
return Proxy::hasInstance(cx, obj, &local, bp);
|
||||
}
|
||||
if (JSHasInstanceOp hasInstance = obj->getClass()->getHasInstance()) {
|
||||
RootedValue local(cx, v);
|
||||
return hasInstance(cx, obj, &local, bp);
|
||||
}
|
||||
return JS::InstanceofOperator(cx, obj, local, bp);
|
||||
return JS::InstanceofOperator(cx, obj, v, bp);
|
||||
}
|
||||
|
||||
JSType js::TypeOfObject(JSObject* obj) {
|
||||
|
Loading…
Reference in New Issue
Block a user