mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Backed out 2 changesets (bug 1396482) for failing dom/tests/mochitest/general/test_interfaces.html on a CLOSED TREE
Backed out changeset 8c9b27320d6e (bug 1396482) Backed out changeset c23086c12393 (bug 1396482)
This commit is contained in:
parent
97b3aca03a
commit
b49640be9b
@ -32,8 +32,6 @@ function checkXrayProperty(obj, name, values)
|
||||
ok(!obj.hasOwnProperty(name), "hasOwnProperty shouldn't see \"" + name + "\" through Xrays");
|
||||
is(Object.getOwnPropertyDescriptor(obj, name), undefined, "getOwnPropertyDescriptor shouldn't see \"" + name + "\" through Xrays");
|
||||
ok(!Object.keys(obj).includes(name), "Enumerating the Xray should not return \"" + name + "\"");
|
||||
ok(!Object.getOwnPropertyNames(obj).includes(name),
|
||||
`The Xray's property names should not include ${name}`)
|
||||
} else {
|
||||
ok(obj.hasOwnProperty(name), "hasOwnProperty should see \"" + name + "\" through Xrays");
|
||||
var pd = Object.getOwnPropertyDescriptor(obj, name);
|
||||
@ -43,12 +41,8 @@ function checkXrayProperty(obj, name, values)
|
||||
} else {
|
||||
is(obj[name], value, "Should get the right value for \"" + name + "\" through Xrays");
|
||||
}
|
||||
if (pd) {
|
||||
if (pd.enumerable) {
|
||||
ok(Object.keys(obj).indexOf("" + name) > -1, "Enumerating the Xray should return \"" + name + "\"");
|
||||
}
|
||||
ok(Object.getOwnPropertyNames(obj).indexOf("" + name) > -1,
|
||||
`The Xray's property names should include ${name}`)
|
||||
if (pd && pd.enumerable) {
|
||||
ok(Object.keys(obj).indexOf("" + name) > -1, "Enumerating the Xray should return \"" + name + "\"");
|
||||
}
|
||||
}
|
||||
} while ((obj = Object.getPrototypeOf(obj)));
|
||||
@ -107,13 +101,6 @@ function test()
|
||||
|
||||
is(win.toString, win.Object.prototype.toString, "Named properties shouldn't shadow ECMAScript-defined properties");
|
||||
|
||||
// WebIDL interface names should be exposed.
|
||||
var waivedWin = Cu.waiveXrays(win);
|
||||
checkWindowXrayProperty(win, "Element", Cu.unwaiveXrays(waivedWin.Element))
|
||||
|
||||
// JS standard classes should be exposed.
|
||||
checkWindowXrayProperty(win, "Array", Cu.unwaiveXrays(waivedWin.Array))
|
||||
|
||||
// HTMLDocument
|
||||
// Unforgeable properties live on the instance.
|
||||
checkXrayProperty(doc, "location", [ win.location ]);
|
||||
|
@ -1091,9 +1091,8 @@ JS_EnumerateStandardClasses(JSContext* cx, HandleObject obj)
|
||||
}
|
||||
|
||||
static bool
|
||||
EnumerateStandardClassesInTable(JSContext* cx, Handle<GlobalObject*> global,
|
||||
AutoIdVector& properties, const JSStdName* table,
|
||||
bool includeResolved)
|
||||
EnumerateUnresolvedStandardClasses(JSContext* cx, Handle<GlobalObject*> global,
|
||||
AutoIdVector& properties, const JSStdName* table)
|
||||
{
|
||||
for (unsigned i = 0; !table[i].isSentinel(); i++) {
|
||||
if (table[i].isDummy()) {
|
||||
@ -1104,7 +1103,7 @@ EnumerateStandardClassesInTable(JSContext* cx, Handle<GlobalObject*> global,
|
||||
|
||||
// If the standard class has been resolved, the properties have been
|
||||
// defined on the global so we don't need to add them here.
|
||||
if (!includeResolved && global->isStandardClassResolved(key)) {
|
||||
if (global->isStandardClassResolved(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1130,13 +1129,12 @@ EnumerateStandardClassesInTable(JSContext* cx, Handle<GlobalObject*> global,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
EnumerateStandardClasses(JSContext* cx, JS::HandleObject obj, JS::AutoIdVector& properties,
|
||||
bool enumerableOnly, bool includeResolved)
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_NewEnumerateStandardClasses(JSContext* cx, JS::HandleObject obj, JS::AutoIdVector& properties,
|
||||
bool enumerableOnly)
|
||||
{
|
||||
if (enumerableOnly) {
|
||||
// There are no enumerable standard classes and "undefined" is
|
||||
// not enumerable.
|
||||
// There are no enumerable lazy properties.
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1148,33 +1146,16 @@ EnumerateStandardClasses(JSContext* cx, JS::HandleObject obj, JS::AutoIdVector&
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EnumerateStandardClassesInTable(cx, global, properties, standard_class_names,
|
||||
includeResolved)) {
|
||||
if (!EnumerateUnresolvedStandardClasses(cx, global, properties, standard_class_names)) {
|
||||
return false;
|
||||
}
|
||||
if (!EnumerateStandardClassesInTable(cx, global, properties, builtin_property_names,
|
||||
includeResolved)) {
|
||||
if (!EnumerateUnresolvedStandardClasses(cx, global, properties, builtin_property_names)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_NewEnumerateStandardClasses(JSContext* cx, JS::HandleObject obj, JS::AutoIdVector& properties,
|
||||
bool enumerableOnly)
|
||||
{
|
||||
return EnumerateStandardClasses(cx, obj, properties, enumerableOnly, false);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_NewEnumerateStandardClassesIncludingResolved(JSContext* cx, JS::HandleObject obj,
|
||||
JS::AutoIdVector& properties,
|
||||
bool enumerableOnly)
|
||||
{
|
||||
return EnumerateStandardClasses(cx, obj, properties, enumerableOnly, true);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_GetClassObject(JSContext* cx, JSProtoKey key, MutableHandleObject objp)
|
||||
{
|
||||
|
@ -957,27 +957,10 @@ JS_MayResolveStandardClass(const JSAtomState& names, jsid id, JSObject* maybeObj
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_EnumerateStandardClasses(JSContext* cx, JS::HandleObject obj);
|
||||
|
||||
/**
|
||||
* Fill "properties" with a list of standard class names that have not yet been
|
||||
* resolved on "obj". This can be used as (part of) a newEnumerate class hook on a
|
||||
* global. Already-resolved things are excluded because they might have been deleted
|
||||
* by script after being resolved and enumeration considers already-defined
|
||||
* properties anyway.
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_NewEnumerateStandardClasses(JSContext* cx, JS::HandleObject obj, JS::AutoIdVector& properties,
|
||||
bool enumerableOnly);
|
||||
|
||||
/**
|
||||
* Fill "properties" with a list of standard class names. This can be used for
|
||||
* proxies that want to define behavior that looks like enumerating a global without
|
||||
* touching the global itself.
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_NewEnumerateStandardClassesIncludingResolved(JSContext* cx, JS::HandleObject obj,
|
||||
JS::AutoIdVector& properties,
|
||||
bool enumerableOnly);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_GetClassObject(JSContext* cx, JSProtoKey key, JS::MutableHandle<JSObject*> objp);
|
||||
|
||||
|
@ -1742,15 +1742,6 @@ DOMXrayTraits::enumerateNames(JSContext* cx, HandleObject wrapper, unsigned flag
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, getTargetObject(wrapper));
|
||||
if (JS_IsGlobalObject(obj)) {
|
||||
// We could do this in a shared enumerateNames with JSXrayTraits, but we
|
||||
// don't really have globals we expose via those.
|
||||
JSAutoRealm ar(cx, obj);
|
||||
if (!JS_NewEnumerateStandardClassesIncludingResolved(
|
||||
cx, obj, props, !(flags & JSITER_HIDDEN))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return XrayOwnPropertyKeys(cx, wrapper, obj, flags, props);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user