From 7757e03ccc550b030fb4d342f160ee30a940f23d Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 8 Jun 2019 21:33:39 -0400 Subject: 1320408 - Part 13: Change DebugEnvironmentProxy::getMaybeSentinelValue to static method. --- js/src/jsobj.cpp | 3 ++- js/src/vm/Debugger.cpp | 3 ++- js/src/vm/EnvironmentObject.cpp | 8 ++++---- js/src/vm/EnvironmentObject.h | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) (limited to 'js/src') diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 78efca8de..58be1a283 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -2198,7 +2198,8 @@ js::LookupNameUnqualified(JSContext* cx, HandlePropertyName name, HandleObject e // environments. if (env->is()) { RootedValue v(cx); - if (!env->as().getMaybeSentinelValue(cx, id, &v)) + Rooted envProxy(cx, &env->as()); + if (!DebugEnvironmentProxy::getMaybeSentinelValue(cx, envProxy, id, &v)) return false; isTDZ = IsUninitializedLexical(v); } else { diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index a4f1f3032..b959740ac 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -10774,7 +10774,8 @@ DebuggerEnvironment::getVariable(JSContext* cx, HandleDebuggerEnvironment enviro // // See wrapDebuggeeValue for how the sentinel values are wrapped. if (referent->is()) { - if (!referent->as().getMaybeSentinelValue(cx, id, result)) + Rooted env(cx, &referent->as()); + if (!DebugEnvironmentProxy::getMaybeSentinelValue(cx, env, id, result)) return false; } else { if (!GetProperty(cx, referent, referent, id, result)) diff --git a/js/src/vm/EnvironmentObject.cpp b/js/src/vm/EnvironmentObject.cpp index 611f0e194..a5aac2ab4 100644 --- a/js/src/vm/EnvironmentObject.cpp +++ b/js/src/vm/EnvironmentObject.cpp @@ -2234,11 +2234,11 @@ DebugEnvironmentProxy::isForDeclarative() const e.is(); } -bool -DebugEnvironmentProxy::getMaybeSentinelValue(JSContext* cx, HandleId id, MutableHandleValue vp) +/* static */ bool +DebugEnvironmentProxy::getMaybeSentinelValue(JSContext* cx, Handle env, + HandleId id, MutableHandleValue vp) { - Rooted self(cx, this); - return DebugEnvironmentProxyHandler::singleton.getMaybeSentinelValue(cx, self, id, vp); + return DebugEnvironmentProxyHandler::singleton.getMaybeSentinelValue(cx, env, id, vp); } bool diff --git a/js/src/vm/EnvironmentObject.h b/js/src/vm/EnvironmentObject.h index 032286116..c527cd1b0 100644 --- a/js/src/vm/EnvironmentObject.h +++ b/js/src/vm/EnvironmentObject.h @@ -872,7 +872,8 @@ class DebugEnvironmentProxy : public ProxyObject // Get a property by 'id', but returns sentinel values instead of throwing // on exceptional cases. - bool getMaybeSentinelValue(JSContext* cx, HandleId id, MutableHandleValue vp); + static bool getMaybeSentinelValue(JSContext* cx, Handle env, + HandleId id, MutableHandleValue vp); // Returns true iff this is a function environment with its own this-binding // (all functions except arrow functions and generator expression lambdas). -- cgit v1.2.3