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
parent 49f92aabe5
commit b1d077a87a
2 changed files with 4 additions and 3 deletions

View File

@ -414,7 +414,7 @@ def write_interface(iface, fd):
realtype = a.realtype.nativeType('in')
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"
tmpl = attr_refcnt_infallible_tmpl
realtype = realtype[:-2] # strip trailing pointer

View File

@ -1041,9 +1041,10 @@ class Attribute(object):
if self.infallible and self.realtype.kind not in ['builtin',
'interface',
'forward',
'webidl']:
'webidl',
'cenum']:
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)
if self.infallible and not iface.attributes.builtinclass:
raise IDLError('[infallible] attributes are only allowed on '