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. -->
This commit is contained in:
bors-servo 2019-10-18 04:02:13 -04:00 committed by GitHub
commit 32eb858a6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 8 deletions

View file

@ -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: