script: Ensure promises are considered DOM interfaces when generating bindings. (#36107)

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-03-23 13:53:57 -04:00 committed by GitHub
parent 8c2ac88ad0
commit 4814cbdb1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -74,7 +74,7 @@ def isDomInterface(t, logging=False):
t = t.inner
if isinstance(t, IDLInterface):
return True
if t.isCallback():
if t.isCallback() or t.isPromise():
return True
return t.isInterface() and (t.isGeckoInterface() or (t.isSpiderMonkeyInterface() and not t.isBufferSource()))
@ -88,12 +88,12 @@ def containsDomInterface(t, logging=False):
t = t.inner
if t.isEnum():
return False
if isDomInterface(t):
return True
if t.isUnion():
return any(map(lambda x: containsDomInterface(x), t.flatMemberTypes))
if t.isDictionary():
return any(map(lambda x: containsDomInterface(x), t.members)) or (t.parent and containsDomInterface(t.parent))
if isDomInterface(t):
return True
if t.isSequence():
return containsDomInterface(t.inner)
return False