Bug 1394490 - Handle NSVO like Global for js::ComputeImplicitThis
ComputeImplicitThis is used when invoking a function in a |with| block.
An NSVO should behave like a GlobalObject and return |undefined|.
MozReview-Commit-ID: InjojinxPuF
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -1487,16 +1487,19 @@ JS_STATIC_ASSERT(JSOP_IFNE == JSOP_IFEQ
* global.
*/
static inline Value
ComputeImplicitThis(JSObject* obj)
{
if (obj->is<GlobalObject>())
return UndefinedValue();
+ if (obj->is<NonSyntacticVariablesObject>())
+ return UndefinedValue();
+
if (IsCacheableEnvironment(obj))
return UndefinedValue();
// Debugger environments need special casing, as despite being
// non-syntactic, they wrap syntactic environments and should not be
// treated like other embedding-specific non-syntactic environments.
if (obj->is<DebugEnvironmentProxy>())
return ComputeImplicitThis(&obj->as<DebugEnvironmentProxy>().environment());