Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / js / src / vm / CallNonGenericMethod.cpp
blob2164f7162b5597fac4c66646fb2775488d7ec6a3
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 #include "js/CallNonGenericMethod.h"
9 #include "proxy/Proxy.h"
10 #include "vm/JSFunction.h"
11 #include "vm/JSObject.h"
12 #include "vm/ProxyObject.h"
13 #include "vm/SelfHosting.h"
15 using namespace js;
17 bool JS::detail::CallMethodIfWrapped(JSContext* cx, IsAcceptableThis test,
18 NativeImpl impl, const CallArgs& args) {
19 HandleValue thisv = args.thisv();
20 MOZ_ASSERT(!test(thisv));
22 if (thisv.isObject()) {
23 JSObject& thisObj = args.thisv().toObject();
24 if (thisObj.is<ProxyObject>()) {
25 return Proxy::nativeCall(cx, test, impl, args);
29 if (IsCallSelfHostedNonGenericMethod(impl)) {
30 return ReportIncompatibleSelfHostedMethod(cx, thisv);
33 ReportIncompatible(cx, args);
34 return false;