зеркало из https://github.com/mozilla/gecko-dev.git
Bug 959684 - Implement URLSearchParams stringifier. r=ehsan
This commit is contained in:
Родитель
0ff701333b
Коммит
79ba26d29f
|
@ -348,7 +348,7 @@ public:
|
|||
};
|
||||
|
||||
void
|
||||
URLSearchParams::Serialize(nsAString& aValue)
|
||||
URLSearchParams::Serialize(nsAString& aValue) const
|
||||
{
|
||||
MOZ_ASSERT(mValid);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
return mValid;
|
||||
}
|
||||
|
||||
void Serialize(nsAString& aValue);
|
||||
void Serialize(nsAString& aValue) const;
|
||||
|
||||
void Get(const nsAString& aName, nsString& aRetval);
|
||||
|
||||
|
@ -87,6 +87,12 @@ public:
|
|||
|
||||
uint32_t Size();
|
||||
|
||||
void Stringify(nsString& aRetval)
|
||||
{
|
||||
Validate();
|
||||
Serialize(aRetval);
|
||||
}
|
||||
|
||||
private:
|
||||
void AppendInternal(const nsAString& aName, const nsAString& aValue);
|
||||
|
||||
|
|
|
@ -45,6 +45,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
|||
is(u.getAll('foo').length, 1, 'URLSearchParams.getAll(foo)');
|
||||
is(u.size, 1, 'URLSearchParams.size()');
|
||||
|
||||
is(u + "", "foo=bar2", "stringifier");
|
||||
|
||||
u.delete('foo');
|
||||
is(u.size, 0, 'URLSearchParams.size()');
|
||||
|
||||
|
|
|
@ -16,11 +16,12 @@
|
|||
[Constructor(optional DOMString init = ""),
|
||||
Constructor(URLSearchParams init)]
|
||||
interface URLSearchParams {
|
||||
void append(DOMString name, DOMString value);
|
||||
void delete(DOMString name);
|
||||
DOMString? get(DOMString name);
|
||||
sequence<DOMString> getAll(DOMString name);
|
||||
void set(DOMString name, DOMString value);
|
||||
void append(DOMString name, DOMString value);
|
||||
boolean has(DOMString name);
|
||||
void delete(DOMString name);
|
||||
void set(DOMString name, DOMString value);
|
||||
readonly attribute unsigned long size;
|
||||
stringifier;
|
||||
};
|
||||
|
|
|
@ -42,6 +42,8 @@ onmessage = function() {
|
|||
is(u.getAll('foo').length, 1, 'URLSearchParams.getAll(foo)');
|
||||
is(u.size, 1, 'URLSearchParams.size()');
|
||||
|
||||
is(u + "", "foo=bar2", "stringify");
|
||||
|
||||
u.delete('foo');
|
||||
is(u.size, 0, 'URLSearchParams.size()');
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ URLSearchParams::SetObserver(URLSearchParamsObserver* aObserver)
|
|||
}
|
||||
|
||||
void
|
||||
URLSearchParams::Serialize(nsAString& aValue)
|
||||
URLSearchParams::Serialize(nsAString& aValue) const
|
||||
{
|
||||
NS_NOTREACHED("Unexpected call to URLSearchParams::Serialize");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче