mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #9337 - fmmartins:urlsearchparams-getall, r=nox
Implement URLSearchParams::getAll Fixes #5439. Please tell me if anything is wrong or needs some change! <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9337) <!-- Reviewable:end -->
This commit is contained in:
commit
a4e805d909
4 changed files with 13 additions and 16 deletions
|
@ -87,6 +87,18 @@ impl URLSearchParamsMethods for URLSearchParams {
|
|||
}).next()
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-getall
|
||||
fn GetAll(&self, name: USVString) -> Vec<USVString> {
|
||||
let list = self.list.borrow();
|
||||
list.iter().filter_map(|&(ref k, ref v)| {
|
||||
if k == &name.0 {
|
||||
Some(USVString(v.clone()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}).collect()
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-has
|
||||
fn Has(&self, name: USVString) -> bool {
|
||||
let list = self.list.borrow();
|
||||
|
|
|
@ -12,7 +12,7 @@ interface URLSearchParams {
|
|||
void append(USVString name, USVString value);
|
||||
void delete(USVString name);
|
||||
USVString? get(USVString name);
|
||||
// sequence<USVString> getAll(USVString name);
|
||||
sequence<USVString> getAll(USVString name);
|
||||
boolean has(USVString name);
|
||||
void set(USVString name, USVString value);
|
||||
// iterable<USVString, USVString>;
|
||||
|
|
|
@ -15,12 +15,5 @@
|
|||
[URL interface: new URL("http://foo") must inherit property "searchParams" with the proper type (12)]
|
||||
expected: FAIL
|
||||
|
||||
[URLSearchParams interface: operation getAll(ScalarValueString)]
|
||||
expected: FAIL
|
||||
|
||||
[URL interface: operation domainToUnicode(USVString)]
|
||||
expected: FAIL
|
||||
|
||||
[URLSearchParams interface: operation getAll(USVString)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
[urlsearchparams-getall.html]
|
||||
type: testharness
|
||||
[getAll() basics]
|
||||
expected: FAIL
|
||||
|
||||
[getAll() multiples]
|
||||
expected: FAIL
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue