Bug 1424160 part 3. Set up @@toStringTag on our synthesized iterator interfaces. r=qdot
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 17 May 2018 23:45:45 -0400
changeset 418802 e5e68461d391
parent 418801 b0d319aaafbe
child 418803 11ee70f24ea5
child 418846 7fa8db24a617
push id34013
push userdluca@mozilla.com
push date2018-05-18 09:56 +0000
treeherdermozilla-central@11ee70f24ea5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1424160
milestone62.0a1
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
Bug 1424160 part 3. Set up @@toStringTag on our synthesized iterator interfaces. r=qdot
dom/bindings/parser/WebIDL.py
dom/bindings/test/test_iterable.html
testing/web-platform/meta/WebIDL/ecmascript-binding/default-iterator-object.html.ini
testing/web-platform/meta/WebIDL/ecmascript-binding/iterator-prototype-object.html.ini
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -6962,19 +6962,22 @@ class Parser(Tokenizer):
                     return IDLExtendedAttribute(iface.location, (str, ))
                 nextMethod = IDLMethod(
                     iface.location,
                     IDLUnresolvedIdentifier(iface.location, "next"),
                     BuiltinTypes[IDLBuiltinType.Types.object], [])
                 nextMethod.addExtendedAttributes([simpleExtendedAttr("Throws")])
                 itr_ident = IDLUnresolvedIdentifier(iface.location,
                                                     iface.identifier.name + "Iterator")
+                toStringTag = iface.identifier.name + " Iterator"
                 itr_iface = IDLInterface(iface.location, self.globalScope(),
                                          itr_ident, None, [nextMethod],
-                                         isKnownNonPartial=True)
+                                         isKnownNonPartial=True,
+                                         classNameOverride=toStringTag,
+                                         toStringTag=toStringTag)
                 itr_iface.addExtendedAttributes([simpleExtendedAttr("NoInterfaceObject")])
                 # Make sure the exposure set for the iterator interface is the
                 # same as the exposure set for the iterable interface, because
                 # we're going to generate methods on the iterable that return
                 # instances of the iterator.
                 itr_iface._exposureGlobalNames = set(iface._exposureGlobalNames)
                 # Always append generated iterable interfaces after the
                 # interface they're a member of, otherwise nativeType generation
--- a/dom/bindings/test/test_iterable.html
+++ b/dom/bindings/test/test_iterable.html
@@ -166,17 +166,17 @@
        var entry = entries_itr.next()
        is(key.value, undefined, "IterableDouble: Key iterator value should be undefined");
        is(key.done, true, "IterableDouble: Key iterator done should be true");
        is(value.value, undefined, "IterableDouble: Value iterator value should be undefined");
        is(value.done, true, "IterableDouble: Value iterator done should be true");
        is(entry.value, undefined, "IterableDouble: Entry iterator value should be undefined");
        is(entry.done, true, "IterableDouble: Entry iterator done should be true");
        is(Object.prototype.toString.call(Object.getPrototypeOf(key_itr)),
-          "[object TestInterfaceIterableDoubleIteratorPrototype]",
+          "[object TestInterfaceIterableDouble Iterator]",
           "iterator prototype should have the right brand");
 
        // Simple dual type iterable creation and functionality test
        info("IterableDoubleUnion: Testing simple iterable creation and functionality");
        itr = new TestInterfaceIterableDoubleUnion();
        testExistence("IterableDoubleUnion: ", itr, base_properties);
        is(itr.entries, itr[Symbol.iterator],
           "IterableDoubleUnion: Should be using @@iterator for 'entries'");
@@ -226,16 +226,16 @@
        var entry = entries_itr.next()
        is(key.value, undefined, "IterableDoubleUnion: Key iterator value should be undefined");
        is(key.done, true, "IterableDoubleUnion: Key iterator done should be true");
        is(value.value, undefined, "IterableDoubleUnion: Value iterator value should be undefined");
        is(value.done, true, "IterableDoubleUnion: Value iterator done should be true");
        is(entry.value, undefined, "IterableDoubleUnion: Entry iterator value should be undefined");
        is(entry.done, true, "IterableDoubleUnion: Entry iterator done should be true");
        is(Object.prototype.toString.call(Object.getPrototypeOf(key_itr)),
-          "[object TestInterfaceIterableDoubleUnionIteratorPrototype]",
+          "[object TestInterfaceIterableDoubleUnion Iterator]",
           "iterator prototype should have the right brand");
 
        SimpleTest.finish();
      });
     </script>
   </body>
 </html>
deleted file mode 100644
--- a/testing/web-platform/meta/WebIDL/ecmascript-binding/default-iterator-object.html.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[default-iterator-object.html]
-  [Object.prototype.toString returns correct value]
-    expected: FAIL
-
-  [@@toStringTag has correct value from prototype]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/WebIDL/ecmascript-binding/iterator-prototype-object.html.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[iterator-prototype-object.html]
-  [Object.prototype.toString returns correct value]
-    expected: FAIL
-
-  [@@toStringTag has correct value]
-    expected: FAIL
-