From 29b14d4b3d9e1c78d50c70545dcef771eb93fb3a Mon Sep 17 00:00:00 2001 From: Fernando Martins Date: Fri, 15 Jan 2016 22:40:55 +0000 Subject: [PATCH] Implement URLSearchParams::getAll --- components/script/dom/urlsearchparams.rs | 12 ++++++++++++ components/script/dom/webidls/URLSearchParams.webidl | 2 +- tests/wpt/metadata/url/interfaces.html.ini | 7 ------- .../wpt/metadata/url/urlsearchparams-getall.html.ini | 8 -------- 4 files changed, 13 insertions(+), 16 deletions(-) delete mode 100644 tests/wpt/metadata/url/urlsearchparams-getall.html.ini diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs index 246924c061d..161d088834d 100644 --- a/components/script/dom/urlsearchparams.rs +++ b/components/script/dom/urlsearchparams.rs @@ -87,6 +87,18 @@ impl URLSearchParamsMethods for URLSearchParams { }).next() } + // https://url.spec.whatwg.org/#dom-urlsearchparams-getall + fn GetAll(&self, name: USVString) -> Vec { + 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(); diff --git a/components/script/dom/webidls/URLSearchParams.webidl b/components/script/dom/webidls/URLSearchParams.webidl index 4804056273f..e2075d96a6d 100644 --- a/components/script/dom/webidls/URLSearchParams.webidl +++ b/components/script/dom/webidls/URLSearchParams.webidl @@ -12,7 +12,7 @@ interface URLSearchParams { void append(USVString name, USVString value); void delete(USVString name); USVString? get(USVString name); - // sequence getAll(USVString name); + sequence getAll(USVString name); boolean has(USVString name); void set(USVString name, USVString value); // iterable; diff --git a/tests/wpt/metadata/url/interfaces.html.ini b/tests/wpt/metadata/url/interfaces.html.ini index 1b3c30bdfb3..505f15c5a9b 100644 --- a/tests/wpt/metadata/url/interfaces.html.ini +++ b/tests/wpt/metadata/url/interfaces.html.ini @@ -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 - diff --git a/tests/wpt/metadata/url/urlsearchparams-getall.html.ini b/tests/wpt/metadata/url/urlsearchparams-getall.html.ini deleted file mode 100644 index c2205806057..00000000000 --- a/tests/wpt/metadata/url/urlsearchparams-getall.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[urlsearchparams-getall.html] - type: testharness - [getAll() basics] - expected: FAIL - - [getAll() multiples] - expected: FAIL -