Use the url crate without its query_encoding feature

This commit is contained in:
Simon Sapin 2017-10-31 17:30:01 +01:00
parent 43a4f01647
commit a3ac21d23d
5 changed files with 44 additions and 39 deletions

View file

@ -15,7 +15,6 @@ use dom::bindings::weakref::MutableWeakRef;
use dom::globalscope::GlobalScope;
use dom::url::URL;
use dom_struct::dom_struct;
use encoding::types::EncodingRef;
use url::form_urlencoded;
// https://url.spec.whatwg.org/#interface-urlsearchparams
@ -140,17 +139,16 @@ impl URLSearchParamsMethods for URLSearchParams {
// https://url.spec.whatwg.org/#stringification-behavior
fn Stringifier(&self) -> DOMString {
DOMString::from(self.serialize(None))
DOMString::from(self.serialize_utf8())
}
}
impl URLSearchParams {
// https://url.spec.whatwg.org/#concept-urlencoded-serializer
pub fn serialize(&self, encoding: Option<EncodingRef>) -> String {
pub fn serialize_utf8(&self) -> String {
let list = self.list.borrow();
form_urlencoded::Serializer::new(String::new())
.encoding_override(encoding)
.extend_pairs(&*list)
.finish()
}