Backed out 2 changesets (bug 1396482) for failing dom/tests/mochitest/general/test_interfaces.html on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Fri, 28 Sep 2018 19:45:27 +0300
changeset 494496 59496d5915844c01b3aa71894e35cfedf347443f
parent 494495 2f6a1098cf9e7f4a6ee60809f30b046896151006
child 494497 fbe8eaa6dbb39d5b7eb96d238123511150883995
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1396482
milestone64.0a1
backs out8c9b27320d6e37b77631980d19607d5c58717896
c23086c123932c3e3ae24a39285ccad83bc03a99
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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)
dom/bindings/test/test_dom_xrays.html
js/src/jsapi.cpp
js/src/jsapi.h
js/xpconnect/wrappers/XrayWrapper.cpp
--- a/dom/bindings/test/test_dom_xrays.html
+++ b/dom/bindings/test/test_dom_xrays.html
@@ -27,33 +27,27 @@ function checkXrayProperty(obj, name, va
 {
   var instance = obj;
   do {
     var value = values.shift();
     if (typeof value == "undefined") {
       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);
       ok(pd, "getOwnPropertyDescriptor should see \"" + name + "\" through Xrays");
       if (pd && pd.get) {
         is(pd.get.call(instance), value, "Should get the right value for \"" + name + "\" through Xrays");
       } 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)));
 }
 
 function checkWindowXrayProperty(obj, name, windowValue, windowPrototypeValue, namedPropertiesValue, eventTargetValue)
 {
   checkXrayProperty(obj, name, [ windowValue, windowPrototypeValue, namedPropertiesValue, eventTargetValue ]);
@@ -102,23 +96,16 @@ function test()
   is(obj, win.Object.prototype, "Object.prototype should be at the end of the prototype chain");
 
   // Named properties shouldn't shadow WebIDL- or ECMAScript-defined properties.
   checkWindowXrayProperty(win, "addEventListener", undefined, undefined, undefined, eventTargetProto.addEventListener);
   is(win.addEventListener, eventTargetProto.addEventListener, "Named properties shouldn't shadow WebIDL-defined properties");
 
   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 ]);
   is(String(win.location), document.getElementById("t").src,
      "Should have the right stringification");
 
   // HTMLHtmlElement
   var elem = doc.documentElement;
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -1086,30 +1086,29 @@ JS_EnumerateStandardClasses(JSContext* c
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(obj);
     Handle<GlobalObject*> global = obj.as<GlobalObject>();
     return GlobalObject::initStandardClasses(cx, global);
 }
 
 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()) {
             continue;
         }
 
         JSProtoKey key = table[i].key;
 
         // 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;
         }
 
         if (GlobalObject::skipDeselectedConstructor(cx, key)) {
             continue;
         }
 
         if (const Class* clasp = ProtoKeyToClass(key)) {
@@ -1125,62 +1124,44 @@ EnumerateStandardClassesInTable(JSContex
         if (!properties.append(id)) {
             return false;
         }
     }
 
     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;
     }
 
     Handle<GlobalObject*> global = obj.as<GlobalObject>();
 
     // It's fine to always append |undefined| here, it's non-configurable and
     // the enumeration code filters duplicates.
     if (!properties.append(NameToId(cx->names().undefined))) {
         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)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     JSObject* obj = GlobalObject::getOrCreateConstructor(cx, key);
     if (!obj) {
         return false;
     }
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -952,37 +952,20 @@ extern JS_PUBLIC_API(bool)
 JS_ResolveStandardClass(JSContext* cx, JS::HandleObject obj, JS::HandleId id, bool* resolved);
 
 extern JS_PUBLIC_API(bool)
 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);
 
 extern JS_PUBLIC_API(bool)
 JS_GetClassPrototype(JSContext* cx, JSProtoKey key, JS::MutableHandle<JSObject*> objp);
 
 namespace JS {
 
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -1737,25 +1737,16 @@ DOMXrayTraits::enumerateNames(JSContext*
             if (!JS_IndexToId(cx, i, &indexId)) {
                 return false;
             }
             props.infallibleAppend(indexId);
         }
     }
 
     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);
 }
 
 bool
 DOMXrayTraits::call(JSContext* cx, HandleObject wrapper,
                     const JS::CallArgs& args, const js::Wrapper& baseInstance)
 {
     RootedObject obj(cx, getTargetObject(wrapper));