diff options
Diffstat (limited to 'js/src/jsobj.cpp')
-rw-r--r-- | js/src/jsobj.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 730805e038..46f89e547e 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -2066,6 +2066,10 @@ JSObject::isCallable() const { if (is<JSFunction>()) return true; + if (is<js::ProxyObject>()) { + const js::ProxyObject& p = as<js::ProxyObject>(); + return p.handler()->isCallable(const_cast<JSObject*>(this)); + } return callHook() != nullptr; } @@ -2076,39 +2080,23 @@ JSObject::isConstructor() const const JSFunction& fun = as<JSFunction>(); return fun.isConstructor(); } + if (is<js::ProxyObject>()) { + const js::ProxyObject& p = as<js::ProxyObject>(); + return p.handler()->isConstructor(const_cast<JSObject*>(this)); + } return constructHook() != nullptr; } JSNative JSObject::callHook() const { - const js::Class* clasp = getClass(); - - if (JSNative call = clasp->getCall()) - return call; - - if (is<js::ProxyObject>()) { - const js::ProxyObject& p = as<js::ProxyObject>(); - if (p.handler()->isCallable(const_cast<JSObject*>(this))) - return js::proxy_Call; - } - return nullptr; + return getClass()->getCall(); } JSNative JSObject::constructHook() const { - const js::Class* clasp = getClass(); - - if (JSNative construct = clasp->getConstruct()) - return construct; - - if (is<js::ProxyObject>()) { - const js::ProxyObject& p = as<js::ProxyObject>(); - if (p.handler()->isConstructor(const_cast<JSObject*>(this))) - return js::proxy_Construct; - } - return nullptr; + return getClass()->getConstruct(); } bool |