Bug 1338417. Make @@iterator properties on DOM prototypes not enumerable, to match IDL spec. r=qdot

This commit is contained in:
Boris Zbarsky 2017-02-10 23:06:14 -05:00
Родитель 0cb08702ba
Коммит e1a9c1904b
1 изменённых файлов: 7 добавлений и 4 удалений

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

@ -2389,7 +2389,7 @@ class MethodDefiner(PropertyDefiner):
"methodInfo": False,
"selfHostedName": "ArrayValues",
"length": 0,
"flags": "JSPROP_ENUMERATE",
"flags": "0", # Not enumerable, per spec.
"condition": MemberCondition()
})
@ -3073,25 +3073,28 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
symbolJSID=symbolJSID))
defineFn = "JS_DefinePropertyById"
prop = "iteratorId"
enumFlags = "0" # Not enumerable, per spec.
elif alias.startswith("@@"):
raise TypeError("Can't handle any well-known Symbol other than @@iterator")
else:
getSymbolJSID = None
defineFn = "JS_DefineProperty"
prop = '"%s"' % alias
return CGList([
getSymbolJSID,
# XXX If we ever create non-enumerable properties that can
# be aliased, we should consider making the aliases
# match the enumerability of the property being aliased.
enumFlags = "JSPROP_ENUMERATE"
return CGList([
getSymbolJSID,
CGGeneric(fill(
"""
if (!${defineFn}(aCx, proto, ${prop}, aliasedVal, JSPROP_ENUMERATE)) {
if (!${defineFn}(aCx, proto, ${prop}, aliasedVal, ${enumFlags})) {
$*{failureCode}
}
""",
defineFn=defineFn,
prop=prop,
enumFlags=enumFlags,
failureCode=failureCode))
], "\n")