diff options
author | JustOff <Off.Just.Off@gmail.com> | 2019-03-13 21:22:29 +0200 |
---|---|---|
committer | JustOff <Off.Just.Off@gmail.com> | 2019-03-13 21:22:29 +0200 |
commit | cd0e94ceb1031a76dc8e9f70bb9cdab691fb8866 (patch) | |
tree | c95b7e4047a0c6e9f000769ba20b4c1ddd144c0d /dom/url/URLSearchParams.cpp | |
parent | 04c16841227708a6037acb14ba506f0981481e37 (diff) | |
download | UXP-cd0e94ceb1031a76dc8e9f70bb9cdab691fb8866.tar UXP-cd0e94ceb1031a76dc8e9f70bb9cdab691fb8866.tar.gz UXP-cd0e94ceb1031a76dc8e9f70bb9cdab691fb8866.tar.lz UXP-cd0e94ceb1031a76dc8e9f70bb9cdab691fb8866.tar.xz UXP-cd0e94ceb1031a76dc8e9f70bb9cdab691fb8866.zip |
Construct URLSearchParams from record<>
Diffstat (limited to 'dom/url/URLSearchParams.cpp')
-rw-r--r-- | dom/url/URLSearchParams.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/dom/url/URLSearchParams.cpp b/dom/url/URLSearchParams.cpp index 8303272e1..ad23460f3 100644 --- a/dom/url/URLSearchParams.cpp +++ b/dom/url/URLSearchParams.cpp @@ -327,7 +327,7 @@ URLSearchParams::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) /* static */ already_AddRefed<URLSearchParams> URLSearchParams::Constructor(const GlobalObject& aGlobal, - const USVStringSequenceSequenceOrUSVString& aInit, + const USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString& aInit, ErrorResult& aRv) { RefPtr<URLSearchParams> sp = @@ -351,6 +351,12 @@ URLSearchParams::Constructor(const GlobalObject& aGlobal, } 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 { MOZ_CRASH("This should not happen."); } |