mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 07:07:30 +09:00
Construct URLSearchParams from record<>
This commit is contained in:
parent
5fc488fe61
commit
1729192b5d
3 changed files with 10 additions and 4 deletions
|
|
@ -327,7 +327,7 @@ URLSearchParams::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||||
|
|
||||||
/* static */ already_AddRefed<URLSearchParams>
|
/* static */ already_AddRefed<URLSearchParams>
|
||||||
URLSearchParams::Constructor(const GlobalObject& aGlobal,
|
URLSearchParams::Constructor(const GlobalObject& aGlobal,
|
||||||
const USVStringSequenceSequenceOrUSVString& aInit,
|
const USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString& aInit,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
RefPtr<URLSearchParams> sp =
|
RefPtr<URLSearchParams> sp =
|
||||||
|
|
@ -351,6 +351,12 @@ URLSearchParams::Constructor(const GlobalObject& aGlobal,
|
||||||
}
|
}
|
||||||
sp->Append(item[0], item[1]);
|
sp->Append(item[0], item[1]);
|
||||||
}
|
}
|
||||||
|
} else if (aInit.IsUSVStringUSVStringRecord()) {
|
||||||
|
const Record<nsString, nsString>& record =
|
||||||
|
aInit.GetAsUSVStringUSVStringRecord();
|
||||||
|
for (auto& entry : record.Entries()) {
|
||||||
|
sp->Append(entry.mKey, entry.mValue);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MOZ_CRASH("This should not happen.");
|
MOZ_CRASH("This should not happen.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class URLSearchParams;
|
class URLSearchParams;
|
||||||
class USVStringSequenceSequenceOrUSVString;
|
class USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString;
|
||||||
|
|
||||||
class URLSearchParamsObserver : public nsISupports
|
class URLSearchParamsObserver : public nsISupports
|
||||||
{
|
{
|
||||||
|
|
@ -148,7 +148,7 @@ public:
|
||||||
|
|
||||||
static already_AddRefed<URLSearchParams>
|
static already_AddRefed<URLSearchParams>
|
||||||
Constructor(const GlobalObject& aGlobal,
|
Constructor(const GlobalObject& aGlobal,
|
||||||
const USVStringSequenceSequenceOrUSVString& aInit,
|
const USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString& aInit,
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
|
|
||||||
void ParseInput(const nsACString& aInput);
|
void ParseInput(const nsACString& aInput);
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
|
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[Constructor(optional (sequence<sequence<USVString>> or USVString) init = ""),
|
[Constructor(optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init = ""),
|
||||||
Exposed=(Window,Worker,WorkerDebugger,System)]
|
Exposed=(Window,Worker,WorkerDebugger,System)]
|
||||||
interface URLSearchParams {
|
interface URLSearchParams {
|
||||||
void append(USVString name, USVString value);
|
void append(USVString name, USVString value);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue