Index: third_party/WebKit/LayoutTests/bindings/pair-iterators.html |
diff --git a/third_party/WebKit/LayoutTests/bindings/pair-iterators.html b/third_party/WebKit/LayoutTests/bindings/pair-iterators.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0cb7632b189442ec016760f1b8d58c24d28140b9 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/bindings/pair-iterators.html |
@@ -0,0 +1,34 @@ |
+<!DOCTYPE html> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script> |
+ test(() => { |
+ // Headers.idl has an iterable<k, v> declaration. |
+ let iterator = new Headers().entries(); |
+ let iteratorProto = Object.getPrototypeOf(iterator); |
+ let iteratorProtoProto = Object.getPrototypeOf(iteratorProto); |
+ |
+ assert_array_equals(Object.getOwnPropertyNames(iterator), [], |
+ "The default iterator object has no properties of its own."); |
+ assert_array_equals(Object.getOwnPropertySymbols(iterator), [], |
+ "The default iterator object has no symbols of its own."); |
+ |
+ assert_in_array("next", Object.getOwnPropertyNames(iteratorProto), |
+ "The iterator prototype object has a property called 'next'."); |
+ let nextProperty = Object.getOwnPropertyDescriptor(iteratorProto, "next"); |
+ assert_true(nextProperty.configurable, "The 'next' property must be configurable."); |
+ assert_true(nextProperty.enumerable, "The 'next' property must be enumerable."); |
+ assert_true(nextProperty.writable, "The 'next' property must be writable."); |
+ |
+ assert_equals(iteratorProtoProto, |
+ Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())), |
+ "The iterator prototype object's [[Prototype]] is %IteratorPrototype."); |
+ assert_array_equals(Object.getOwnPropertyNames(iteratorProtoProto), [], |
+ "%IteratorPrototype% has no properties of its own"); |
+ assert_array_equals(Object.getOwnPropertySymbols(iteratorProtoProto), |
+ [Symbol.iterator], |
+ "%IteratorPrototype% has defines @@iterator."); |
+ assert_equals(Object.getPrototypeOf(iteratorProtoProto), Object.prototype, |
+ "%IteratorPrototype% descends from %ObjectPrototype%."); |
+ }, "Iterators from pair-iterable interfaces inherit from %IteratorPrototype%"); |
+</script> |