diff options
Diffstat (limited to 'js/src/jsapi.cpp')
-rw-r--r-- | js/src/jsapi.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index cb3945152..d75a3c33a 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -1029,13 +1029,17 @@ JS_ResolveStandardClass(JSContext* cx, HandleObject obj, HandleId id, bool* reso /* Check whether we're resolving 'undefined', and define it if so. */ JSAtom* idAtom = JSID_TO_ATOM(id); - JSAtom* undefinedAtom = cx->names().undefined; - if (idAtom == undefinedAtom) { + if (idAtom == cx->names().undefined) { *resolved = true; return DefineProperty(cx, global, id, UndefinedHandleValue, nullptr, nullptr, JSPROP_PERMANENT | JSPROP_READONLY | JSPROP_RESOLVING); } + // Resolve a "globalThis" self-referential property if necessary. + if (idAtom == cx->names().globalThis) { + return GlobalObject::maybeResolveGlobalThis(cx, global, resolved); + } + /* Try for class constructors/prototypes named by well-known atoms. */ stdnm = LookupStdName(cx->names(), idAtom, standard_class_names); @@ -1088,6 +1092,7 @@ JS_MayResolveStandardClass(const JSAtomState& names, jsid id, JSObject* maybeObj // better, we need a JSContext here; it's fine as it is.) return atom == names.undefined || + atom == names.globalThis || LookupStdName(names, atom, standard_class_names) || LookupStdName(names, atom, builtin_property_names); } |