aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-10-18 04:02:13 -0400
committerGitHub <noreply@github.com>2019-10-18 04:02:13 -0400
commit32eb858a6a0534d8acdd5184a50a22d90c18b2a8 (patch)
tree663535559aa69999a1c617f2ef963c8781ae2510 /components/script/dom/bindings/codegen/CodegenRust.py
parent578d9a7fb9beb7c035be589f2d01b56462964829 (diff)
parente905a4606a089055be0f87afb62c1f4ccf2961c3 (diff)
downloadservo-32eb858a6a0534d8acdd5184a50a22d90c18b2a8.tar.gz
servo-32eb858a6a0534d8acdd5184a50a22d90c18b2a8.zip
Auto merge of #24469 - saschanaz:urp-default, r=Manishearth
Support USVString as default value of a union argument <!-- Please describe your changes on the following line: --> I don't expect this fixes any test though... --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #22543 <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-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 c80e8a0697b..17ec39913d6 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: