Auto merge of #22666 - CYBAI:urlsearchparams-no-trailing-q, r=nox

Remove trailing ? when updating URLSearchParams

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22639
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22666)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-01-11 15:00:31 -05:00 committed by GitHub
commit f2b224d610
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 26 deletions

View file

@ -57,11 +57,16 @@ impl URL {
pub fn set_query_pairs(&self, pairs: &[(String, String)]) {
let mut url = self.url.borrow_mut();
if pairs.is_empty() {
url.as_mut_url().set_query(None);
} else {
url.as_mut_url()
.query_pairs_mut()
.clear()
.extend_pairs(pairs);
}
}
}
impl URL {

View file

@ -1,15 +0,0 @@
[urlsearchparams-delete.any.worker.html]
[Removing non-existent param removes ? from URL]
expected: FAIL
[Deleting all params removes ? from URL]
expected: FAIL
[urlsearchparams-delete.any.html]
[Removing non-existent param removes ? from URL]
expected: FAIL
[Deleting all params removes ? from URL]
expected: FAIL

View file

@ -1,7 +0,0 @@
[urlsearchparams-sort.any.html]
[Sorting non-existent params removes ? from URL]
expected: FAIL
[urlsearchparams-sort.any.worker.html]
[Sorting non-existent params removes ? from URL]
expected: FAIL