aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorKagami Sascha Rosylight <saschanaz@outlook.com>2019-10-17 12:06:41 +0900
committerKagami Sascha Rosylight <saschanaz@outlook.com>2019-10-17 12:06:41 +0900
commite905a4606a089055be0f87afb62c1f4ccf2961c3 (patch)
tree7fbf3f8722e9268546942b2be5e2bbfaee3d06e0 /components/script/dom/bindings/codegen
parentc5d6bb604d8d03d775cfc59e8bf2afdda2301e7d (diff)
downloadservo-e905a4606a089055be0f87afb62c1f4ccf2961c3.tar.gz
servo-e905a4606a089055be0f87afb62c1f4ccf2961c3.zip
Support USVString as default value of a union argument
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 01b7fc698ba..5a6c453e0ce 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -732,6 +732,10 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
default = "%s::Boolean(%s)" % (
union_native_type(type),
"true" if defaultValue.value else "false")
+ elif tag is IDLType.Tags.usvstring:
+ default = '%s::USVString(USVString("%s".to_owned()))' % (
+ union_native_type(type),
+ defaultValue.value)
else:
raise("We don't currently support default values that aren't null, boolean or default dictionary")
elif dictionaries: