Bug 1505891 - Allow XPIDL CEnums to be infallible; r=froydnj

They're just integers, so there's no reason they need to be fallible
since they're basically a built-in anyways.

Differential Revision: https://phabricator.services.mozilla.com/D11363

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kyle Machulis 2018-11-08 20:46:27 +00:00
Родитель 49f92aabe5
Коммит b1d077a87a
2 изменённых файлов: 4 добавлений и 3 удалений

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

@ -414,7 +414,7 @@ def write_interface(iface, fd):
realtype = a.realtype.nativeType('in') realtype = a.realtype.nativeType('in')
tmpl = attr_builtin_infallible_tmpl tmpl = attr_builtin_infallible_tmpl
if a.realtype.kind != 'builtin': if a.realtype.kind != 'builtin' and a.realtype.kind != 'cenum':
assert realtype.endswith(' *'), "bad infallible type" assert realtype.endswith(' *'), "bad infallible type"
tmpl = attr_refcnt_infallible_tmpl tmpl = attr_refcnt_infallible_tmpl
realtype = realtype[:-2] # strip trailing pointer realtype = realtype[:-2] # strip trailing pointer

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

@ -1041,9 +1041,10 @@ class Attribute(object):
if self.infallible and self.realtype.kind not in ['builtin', if self.infallible and self.realtype.kind not in ['builtin',
'interface', 'interface',
'forward', 'forward',
'webidl']: 'webidl',
'cenum']:
raise IDLError('[infallible] only works on interfaces, domobjects, and builtin types ' raise IDLError('[infallible] only works on interfaces, domobjects, and builtin types '
'(numbers, booleans, and raw char types)', '(numbers, booleans, cenum, and raw char types)',
self.location) self.location)
if self.infallible and not iface.attributes.builtinclass: if self.infallible and not iface.attributes.builtinclass:
raise IDLError('[infallible] attributes are only allowed on ' raise IDLError('[infallible] attributes are only allowed on '