diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 2dd77427590..11bcbfc5bd7 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -293,6 +293,14 @@ impl TestBindingMethods for TestBinding { fn ReceiveInterfaceSequence(&self) -> Vec> { vec![Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned())] } + #[allow(unsafe_code)] + unsafe fn ReceiveUnionIdentity( + &self, + _: *mut JSContext, + arg: UnionTypes::StringOrObject, + ) -> UnionTypes::StringOrObject { + arg + } fn ReceiveNullableBoolean(&self) -> Option { Some(false) } fn ReceiveNullableByte(&self) -> Option { Some(0) } diff --git a/components/script/dom/webidls/TestBinding.webidl b/components/script/dom/webidls/TestBinding.webidl index 25292953d60..22c22f43dae 100644 --- a/components/script/dom/webidls/TestBinding.webidl +++ b/components/script/dom/webidls/TestBinding.webidl @@ -228,6 +228,8 @@ interface TestBinding { TestDictionary receiveTestDictionaryWithSuccessOnKeyword(); boolean dictMatchesPassedValues(TestDictionary arg); + (DOMString or object) receiveUnionIdentity((DOMString or object) arg); + void passBoolean(boolean arg); void passByte(byte arg); void passOctet(octet arg); diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index c8778734319..c0d45b5f2f7 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -31972,6 +31972,12 @@ {} ] ], + "mozilla/codegen_unions.html": [ + [ + "/_mozilla/mozilla/codegen_unions.html", + {} + ] + ], "mozilla/collections.html": [ [ "/_mozilla/mozilla/collections.html", @@ -64751,6 +64757,10 @@ "5183977a0d29ba4d74d049c9391090e3c27264a8", "testharness" ], + "mozilla/codegen_unions.html": [ + "7f772fffb75acc92f9c949a482d387b3ed18d0ed", + "testharness" + ], "mozilla/collections.html": [ "d0bebe808ebb45b6c853f4b88e1a6ebbf9b91345", "testharness" diff --git a/tests/wpt/mozilla/meta/mozilla/codegen_unions.html.ini b/tests/wpt/mozilla/meta/mozilla/codegen_unions.html.ini new file mode 100644 index 00000000000..6a8744c375d --- /dev/null +++ b/tests/wpt/mozilla/meta/mozilla/codegen_unions.html.ini @@ -0,0 +1,3 @@ +[codegen_unions.html] + type: testharness + prefs: [dom.testbinding.enabled:true] diff --git a/tests/wpt/mozilla/tests/mozilla/codegen_unions.html b/tests/wpt/mozilla/tests/mozilla/codegen_unions.html new file mode 100644 index 00000000000..1fff0e01c89 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/codegen_unions.html @@ -0,0 +1,21 @@ + + + +WebIDL conversions are performed correctly and don't lose values + + + + + +