зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1552632 - Resolve globalThis when querying all properties of the global object. r=jandem
globalThis was already handled specially in JS_ResolveStandardClass, JS_MayResolveStandardClass, and various other places, but not in JS_NewEnumerateStandardClasses. Differential Revision: https://phabricator.services.mozilla.com/D32045 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cf20f54068
Коммит
3961c47023
|
@ -972,6 +972,16 @@ static bool EnumerateStandardClasses(JSContext* cx, JS::HandleObject obj,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool resolved = false;
|
||||
if (!GlobalObject::maybeResolveGlobalThis(cx, global, &resolved)) {
|
||||
return false;
|
||||
}
|
||||
if (resolved || includeResolved) {
|
||||
if (!properties.append(NameToId(cx->names().globalThis))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!EnumerateStandardClassesInTable(cx, global, properties,
|
||||
standard_class_names, includeResolved)) {
|
||||
return false;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
assertEq(Object.getOwnPropertyNames(this).includes('globalThis'), true);
|
||||
|
||||
if (typeof reportCompare === "function") {
|
||||
reportCompare(0, 0);
|
||||
}
|
Загрузка…
Ссылка в новой задаче