Bug 1211624. document.all should be iterable, and so should be various other things that have an anonymous indexed getter. r=qdot

This commit is contained in:
Boris Zbarsky 2015-10-07 09:31:32 -04:00
Родитель 006ecb6285
Коммит 8a61b380af
3 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -851,3 +851,4 @@ skip-if = e10s || os != 'linux' || buildapp != 'browser'
[test_explicit_user_agent.html]
[test_change_policy.html]
skip-if = buildapp == 'b2g' #no ssl support
[test_document.all_iteration.html]

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test for document.all iteration behavior</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
assert_array_equals([...document.all], document.getElementsByTagName("*"));
}, "document.all should be iterable");
</script>

Просмотреть файл

@ -2222,7 +2222,14 @@ class MethodDefiner(PropertyDefiner):
return (any("@@iterator" in m.aliases for m in methods) or
any("@@iterator" == r["name"] for r in regular))
if (any(m.isGetter() and m.isIndexed() for m in methods)):
# Check whether we need to output an @@iterator due to having an indexed
# getter. We only do this while outputting non-static and
# non-unforgeable methods, since the @@iterator function will be
# neither.
if (not static and
not unforgeable and
descriptor.supportsIndexedProperties() and
isMaybeExposedIn(descriptor.operations['IndexedGetter'], descriptor)):
if hasIterator(methods, self.regular):
raise TypeError("Cannot have indexed getter/attr on "
"interface %s with other members "