From 4814cbdb1f09e97be70f7c72defee19e67fff473 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sun, 23 Mar 2025 13:53:57 -0400 Subject: [PATCH] script: Ensure promises are considered DOM interfaces when generating bindings. (#36107) Signed-off-by: Josh Matthews --- components/script_bindings/codegen/CodegenRust.py | 6 +++--- components/script_bindings/webidls/TestBinding.webidl | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/components/script_bindings/codegen/CodegenRust.py b/components/script_bindings/codegen/CodegenRust.py index aef6b670fd2..f7539d5b24d 100644 --- a/components/script_bindings/codegen/CodegenRust.py +++ b/components/script_bindings/codegen/CodegenRust.py @@ -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 diff --git a/components/script_bindings/webidls/TestBinding.webidl b/components/script_bindings/webidls/TestBinding.webidl index 95364345aec..88f1b4d51f7 100644 --- a/components/script_bindings/webidls/TestBinding.webidl +++ b/components/script_bindings/webidls/TestBinding.webidl @@ -616,3 +616,5 @@ namespace TestNS { const unsigned long ONE = 1; const unsigned long TWO = 0x2; }; + +typedef Promise PromiseUndefined;