diff options
author | Kagami Sascha Rosylight <saschanaz@outlook.com> | 2019-10-17 12:06:41 +0900 |
---|---|---|
committer | Kagami Sascha Rosylight <saschanaz@outlook.com> | 2019-10-17 12:06:41 +0900 |
commit | e905a4606a089055be0f87afb62c1f4ccf2961c3 (patch) | |
tree | 7fbf3f8722e9268546942b2be5e2bbfaee3d06e0 /components/script/dom/urlsearchparams.rs | |
parent | c5d6bb604d8d03d775cfc59e8bf2afdda2301e7d (diff) | |
download | servo-e905a4606a089055be0f87afb62c1f4ccf2961c3.tar.gz servo-e905a4606a089055be0f87afb62c1f4ccf2961c3.zip |
Support USVString as default value of a union argument
Diffstat (limited to 'components/script/dom/urlsearchparams.rs')
-rw-r--r-- | components/script/dom/urlsearchparams.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs index 57c86898482..3664d30d1f7 100644 --- a/components/script/dom/urlsearchparams.rs +++ b/components/script/dom/urlsearchparams.rs @@ -47,12 +47,12 @@ impl URLSearchParams { // https://url.spec.whatwg.org/#dom-urlsearchparams-urlsearchparams pub fn Constructor( global: &GlobalScope, - init: Option<USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString>, + init: USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString, ) -> Fallible<DomRoot<URLSearchParams>> { // Step 1. let query = URLSearchParams::new(global, None); match init { - Some(USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::USVStringSequenceSequence(init)) => { + USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::USVStringSequenceSequence(init) => { // Step 2. // Step 2-1. @@ -64,12 +64,12 @@ impl URLSearchParams { *query.list.borrow_mut() = init.iter().map(|pair| (pair[0].to_string(), pair[1].to_string())).collect::<Vec<_>>(); }, - Some(USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::USVStringUSVStringRecord(init)) => { + USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::USVStringUSVStringRecord(init) => { // Step 3. *query.list.borrow_mut() = (*init).iter().map(|(name, value)| (name.to_string(), value.to_string())).collect::<Vec<_>>(); }, - Some(USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::USVString(init)) => { + USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString::USVString(init) => { // Step 4. let init_bytes = match init.0.chars().next() { Some(first_char) if first_char == '?' => { @@ -82,8 +82,7 @@ impl URLSearchParams { *query.list.borrow_mut() = form_urlencoded::parse(init_bytes).into_owned().collect(); - }, - None => {}, + } } // Step 5. |