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:
bors-servo 2016-01-17 18:13:17 +05:30
commit a4e805d909
4 changed files with 13 additions and 16 deletions

View file

@ -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();

View file

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

View file

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

View file

@ -1,8 +0,0 @@
[urlsearchparams-getall.html]
type: testharness
[getAll() basics]
expected: FAIL
[getAll() multiples]
expected: FAIL