mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Add WPT test for WebIDL union conversion containing object values
This commit is contained in:
parent
17ecbaf8ff
commit
712812d441
5 changed files with 44 additions and 0 deletions
|
@ -293,6 +293,14 @@ impl TestBindingMethods for TestBinding {
|
|||
fn ReceiveInterfaceSequence(&self) -> Vec<DomRoot<Blob>> {
|
||||
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<bool> { Some(false) }
|
||||
fn ReceiveNullableByte(&self) -> Option<i8> { Some(0) }
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"
|
||||
|
|
3
tests/wpt/mozilla/meta/mozilla/codegen_unions.html.ini
Normal file
3
tests/wpt/mozilla/meta/mozilla/codegen_unions.html.ini
Normal file
|
@ -0,0 +1,3 @@
|
|||
[codegen_unions.html]
|
||||
type: testharness
|
||||
prefs: [dom.testbinding.enabled:true]
|
21
tests/wpt/mozilla/tests/mozilla/codegen_unions.html
Normal file
21
tests/wpt/mozilla/tests/mozilla/codegen_unions.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<title>WebIDL conversions are performed correctly and don't lose values</title>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = new TestBinding;
|
||||
|
||||
// (DOMString or object) receiveUnionIdentity((DOMString or object) arg)
|
||||
var obj = { 'some': 'key', 'num': 42 };
|
||||
assert_equals(t.receiveUnionIdentity(obj), obj);
|
||||
|
||||
var str = "myString";
|
||||
assert_equals(t.receiveUnionIdentity(str), str);
|
||||
}, "(DOMString or object) conversion is performed correctly");
|
||||
</script>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue