[X2Go-Commits] [pale-moon] 110/294: Construct URLSearchParams from record<>

git-admin at x2go.org git-admin at x2go.org
Sat Apr 27 08:57:56 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch upstream/28.5.0
in repository pale-moon.

commit cd0e94ceb1031a76dc8e9f70bb9cdab691fb8866
Author: JustOff <Off.Just.Off at gmail.com>
Date:   Wed Mar 13 21:22:29 2019 +0200

    Construct URLSearchParams from record<>
---
 dom/url/URLSearchParams.cpp       | 8 +++++++-
 dom/url/URLSearchParams.h         | 4 ++--
 dom/webidl/URLSearchParams.webidl | 2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/dom/url/URLSearchParams.cpp b/dom/url/URLSearchParams.cpp
index 8303272..ad23460 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.");
   }
diff --git a/dom/url/URLSearchParams.h b/dom/url/URLSearchParams.h
index 5eef1b1..9fefd78 100644
--- a/dom/url/URLSearchParams.h
+++ b/dom/url/URLSearchParams.h
@@ -20,7 +20,7 @@ namespace mozilla {
 namespace dom {
 
 class URLSearchParams;
-class USVStringSequenceSequenceOrUSVString;
+class USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString;
 
 class URLSearchParamsObserver : public nsISupports
 {
@@ -148,7 +148,7 @@ public:
 
   static already_AddRefed<URLSearchParams>
   Constructor(const GlobalObject& aGlobal,
-              const USVStringSequenceSequenceOrUSVString& aInit,
+              const USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString& aInit,
               ErrorResult& aRv);
 
   void ParseInput(const nsACString& aInput);
diff --git a/dom/webidl/URLSearchParams.webidl b/dom/webidl/URLSearchParams.webidl
index e445656..b93f4e8 100644
--- a/dom/webidl/URLSearchParams.webidl
+++ b/dom/webidl/URLSearchParams.webidl
@@ -13,7 +13,7 @@
  * 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)]
 interface URLSearchParams {
   void append(USVString name, USVString value);

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pale-moon.git


More information about the x2go-commits mailing list