Bug 1436308 - Generate a ToJSON() method for WebIDL types with records r=bz

We currently don't generate a ::ToJSON() method for WebIDL types with record<K,V>
members. These types should be safe to convert to JSON, as long as type V itself
is. Per spec, type K is always a DOMString, USVString, or ByteString.
This commit is contained in:
Tim Taubert 2018-02-07 12:01:00 +01:00
Родитель 081a738eb4
Коммит 1d2ba2eb2b
1 изменённых файлов: 5 добавлений и 0 удалений

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

@ -13823,6 +13823,11 @@ class CGDictionary(CGThing):
# they're not unrestricted float/double.
return not type.isFloat() or not type.isUnrestricted()
if type.isRecord():
# Records are okay, as long as the value type is.
# Per spec, only strings are allowed as keys.
return CGDictionary.typeSafeToJSONify(type.inner)
return False
@staticmethod