Bug 792808 - Migrate BodyExtractor away from using nsIXHRSendable; r?baku draft
authorThomas Wisniewski <wisniewskit@gmail.com>
Tue, 19 Sep 2017 21:32:12 -0400
changeset 756156 6fb735da6d0786248f76a2e23299fe3e80f79156
parent 756155 10fcf1fad7be452131464889200b2f02234c7ecf
child 756157 75903afe8064aeb0dcfe20a969f080d5263d63a1
push id99394
push userwisniewskit@gmail.com
push dateFri, 16 Feb 2018 14:37:01 +0000
reviewersbaku
bugs792808
milestone60.0a1
Bug 792808 - Migrate BodyExtractor away from using nsIXHRSendable; r?baku MozReview-Commit-ID: 1fNcm1mPJJB
dom/base/FormData.cpp
dom/base/FormData.h
dom/base/Navigator.cpp
dom/fetch/BodyExtractor.cpp
dom/fetch/BodyExtractor.h
dom/fetch/Fetch.cpp
dom/file/Blob.cpp
dom/file/Blob.h
dom/url/URLSearchParams.cpp
dom/url/URLSearchParams.h
dom/xhr/XMLHttpRequestMainThread.cpp
--- a/dom/base/FormData.cpp
+++ b/dom/base/FormData.cpp
@@ -90,17 +90,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(FormData)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(FormData)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(FormData)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FormData)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsIDOMFormData)
-  NS_INTERFACE_MAP_ENTRY(nsIXHRSendable)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFormData)
 NS_INTERFACE_MAP_END
 
 // -------------------------------------------------------------------------
 // HTMLFormSubmission
 nsresult
 FormData::GetEncodedSubmission(nsIURI* aURI,
                                nsIInputStream** aPostDataStream,
@@ -391,22 +390,22 @@ FormData::Constructor(const GlobalObject
 {
   RefPtr<FormData> formData = new FormData(aGlobal.GetAsSupports());
   if (aFormElement.WasPassed()) {
     aRv = aFormElement.Value().WalkFormElements(formData);
   }
   return formData.forget();
 }
 
-// -------------------------------------------------------------------------
-// nsIXHRSendable
-
-NS_IMETHODIMP
+// contentTypeWithCharset can be set to the contentType or
+// contentType+charset based on what the spec says.
+// See: https://fetch.spec.whatwg.org/#concept-bodyinit-extract
+nsresult
 FormData::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
-                      nsACString& aContentTypeWithCharset, nsACString& aCharset)
+                      nsACString& aContentTypeWithCharset, nsACString& aCharset) const
 {
   FSMultipartFormData fs(UTF_8_ENCODING, nullptr);
 
   for (uint32_t i = 0; i < mFormData.Length(); ++i) {
     if (mFormData[i].wasNullBlob) {
       MOZ_ASSERT(mFormData[i].value.IsUSVString());
       fs.AddNameBlobOrNullPair(mFormData[i].name, nullptr);
     } else if (mFormData[i].value.IsUSVString()) {
--- a/dom/base/FormData.h
+++ b/dom/base/FormData.h
@@ -20,17 +20,16 @@
 
 namespace mozilla {
 namespace dom {
 
 class HTMLFormElement;
 class GlobalObject;
 
 class FormData final : public nsIDOMFormData,
-                       public nsIXHRSendable,
                        public HTMLFormSubmission,
                        public nsWrapperCache
 {
 private:
   ~FormData() {}
 
   struct FormDataTuple
   {
@@ -60,17 +59,16 @@ private:
 public:
   explicit FormData(nsISupports* aOwner = nullptr);
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(FormData,
                                                          nsIDOMFormData)
 
   NS_DECL_NSIDOMFORMDATA
-  NS_DECL_NSIXHRSENDABLE
 
   // nsWrapperCache
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   // WebIDL
   nsISupports*
   GetParentObject() const
   {
@@ -150,16 +148,20 @@ public:
       if (!aFunc(tuple.name, tuple.value, aClosure)) {
         return false;
       }
     }
 
     return true;
   }
 
+  nsresult
+  GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
+              nsACString& aContentTypeWithCharset, nsACString& aCharset) const;
+
 private:
   nsCOMPtr<nsISupports> mOwner;
 
   nsTArray<FormDataTuple> mFormData;
 };
 
 } // dom namespace
 } // mozilla namepsace
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -1066,32 +1066,32 @@ Navigator::SendBeacon(const nsAString& a
   }
 
   if (aData.Value().IsArrayBufferView()) {
     BodyExtractor<const ArrayBufferView> body(&aData.Value().GetAsArrayBufferView());
     return SendBeaconInternal(aUrl, &body, eBeaconTypeArrayBuffer, aRv);
   }
 
   if (aData.Value().IsBlob()) {
-    BodyExtractor<nsIXHRSendable> body(&aData.Value().GetAsBlob());
+    BodyExtractor<const Blob> body(&aData.Value().GetAsBlob());
     return SendBeaconInternal(aUrl, &body, eBeaconTypeBlob, aRv);
   }
 
   if (aData.Value().IsFormData()) {
-    BodyExtractor<nsIXHRSendable> body(&aData.Value().GetAsFormData());
+    BodyExtractor<const FormData> body(&aData.Value().GetAsFormData());
     return SendBeaconInternal(aUrl, &body, eBeaconTypeOther, aRv);
   }
 
   if (aData.Value().IsUSVString()) {
     BodyExtractor<const nsAString> body(&aData.Value().GetAsUSVString());
     return SendBeaconInternal(aUrl, &body, eBeaconTypeOther, aRv);
   }
 
   if (aData.Value().IsURLSearchParams()) {
-    BodyExtractor<nsIXHRSendable> body(&aData.Value().GetAsURLSearchParams());
+    BodyExtractor<const URLSearchParams> body(&aData.Value().GetAsURLSearchParams());
     return SendBeaconInternal(aUrl, &body, eBeaconTypeOther, aRv);
   }
 
   MOZ_CRASH("Invalid data type.");
   return false;
 }
 
 bool
--- a/dom/fetch/BodyExtractor.cpp
+++ b/dom/fetch/BodyExtractor.cpp
@@ -172,10 +172,40 @@ BodyExtractor<nsIXHRSendable>::GetAsStre
                                            uint64_t* aContentLength,
                                            nsACString& aContentTypeWithCharset,
                                            nsACString& aCharset) const
 {
   return mBody->GetSendInfo(aResult, aContentLength, aContentTypeWithCharset,
                             aCharset);
 }
 
+template<> nsresult
+BodyExtractor<const Blob>::GetAsStream(nsIInputStream** aResult,
+                                       uint64_t* aContentLength,
+                                       nsACString& aContentTypeWithCharset,
+                                       nsACString& aCharset) const
+{
+  return mBody->GetSendInfo(aResult, aContentLength, aContentTypeWithCharset,
+                            aCharset);
+}
+
+template<> nsresult
+BodyExtractor<const FormData>::GetAsStream(nsIInputStream** aResult,
+                                           uint64_t* aContentLength,
+                                           nsACString& aContentTypeWithCharset,
+                                           nsACString& aCharset) const
+{
+  return mBody->GetSendInfo(aResult, aContentLength, aContentTypeWithCharset,
+                            aCharset);
+}
+
+template<> nsresult
+BodyExtractor<const URLSearchParams>::GetAsStream(nsIInputStream** aResult,
+                                                  uint64_t* aContentLength,
+                                                  nsACString& aContentTypeWithCharset,
+                                                  nsACString& aCharset) const
+{
+  return mBody->GetSendInfo(aResult, aContentLength, aContentTypeWithCharset,
+                            aCharset);
+}
+
 } // dom namespace
 } // mozilla namespace
--- a/dom/fetch/BodyExtractor.h
+++ b/dom/fetch/BodyExtractor.h
@@ -21,18 +21,18 @@ class BodyExtractorBase
 public:
   virtual nsresult GetAsStream(nsIInputStream** aResult,
                                uint64_t* aContentLength,
                                nsACString& aContentTypeWithCharset,
                                nsACString& aCharset) const = 0;
 };
 
 // The implementation versions of this template are:
-// ArrayBuffer, ArrayBufferView, nsIXHRSendable (Blob, FormData,
-// URLSearchParams), nsAString, nsIDocument, nsIInputStream.
+// ArrayBuffer, ArrayBufferView, Blob, FormData,
+// URLSearchParams, nsAString, nsIDocument, nsIInputStream.
 template<typename Type>
 class BodyExtractor final : public BodyExtractorBase
 {
   Type* mBody;
 public:
   explicit BodyExtractor(Type* aBody) : mBody(aBody)
   {}
 
--- a/dom/fetch/Fetch.cpp
+++ b/dom/fetch/Fetch.cpp
@@ -909,37 +909,37 @@ ExtractByteStreamFromBody(const fetch::O
   if (aBodyInit.IsArrayBufferView()) {
     BodyExtractor<const ArrayBufferView> body(&aBodyInit.GetAsArrayBufferView());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsBlob()) {
     Blob& blob = aBodyInit.GetAsBlob();
-    BodyExtractor<nsIXHRSendable> body(&blob);
+    BodyExtractor<const Blob> body(&blob);
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsFormData()) {
     FormData& formData = aBodyInit.GetAsFormData();
-    BodyExtractor<nsIXHRSendable> body(&formData);
+    BodyExtractor<const FormData> body(&formData);
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsUSVString()) {
     BodyExtractor<const nsAString> body(&aBodyInit.GetAsUSVString());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsURLSearchParams()) {
     URLSearchParams& usp = aBodyInit.GetAsURLSearchParams();
-    BodyExtractor<nsIXHRSendable> body(&usp);
+    BodyExtractor<const URLSearchParams> body(&usp);
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   NS_NOTREACHED("Should never reach here");
   return NS_ERROR_FAILURE;
 }
 
@@ -963,35 +963,35 @@ ExtractByteStreamFromBody(const fetch::B
 
   if (aBodyInit.IsArrayBufferView()) {
     BodyExtractor<const ArrayBufferView> body(&aBodyInit.GetAsArrayBufferView());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsBlob()) {
-    BodyExtractor<nsIXHRSendable> body(&aBodyInit.GetAsBlob());
+    BodyExtractor<const Blob> body(&aBodyInit.GetAsBlob());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsFormData()) {
-    BodyExtractor<nsIXHRSendable> body(&aBodyInit.GetAsFormData());
+    BodyExtractor<const FormData> body(&aBodyInit.GetAsFormData());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsUSVString()) {
     BodyExtractor<const nsAString> body(&aBodyInit.GetAsUSVString());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsURLSearchParams()) {
-    BodyExtractor<nsIXHRSendable> body(&aBodyInit.GetAsURLSearchParams());
+    BodyExtractor<const URLSearchParams> body(&aBodyInit.GetAsURLSearchParams());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   NS_NOTREACHED("Should never reach here");
   return NS_ERROR_FAILURE;
 }
 
@@ -1019,35 +1019,35 @@ ExtractByteStreamFromBody(const fetch::R
 
   if (aBodyInit.IsArrayBufferView()) {
     BodyExtractor<const ArrayBufferView> body(&aBodyInit.GetAsArrayBufferView());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsBlob()) {
-    BodyExtractor<nsIXHRSendable> body(&aBodyInit.GetAsBlob());
+    BodyExtractor<const Blob> body(&aBodyInit.GetAsBlob());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsFormData()) {
-    BodyExtractor<nsIXHRSendable> body(&aBodyInit.GetAsFormData());
+    BodyExtractor<const FormData> body(&aBodyInit.GetAsFormData());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsUSVString()) {
     BodyExtractor<const nsAString> body(&aBodyInit.GetAsUSVString());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   if (aBodyInit.IsURLSearchParams()) {
-    BodyExtractor<nsIXHRSendable> body(&aBodyInit.GetAsURLSearchParams());
+    BodyExtractor<const URLSearchParams> body(&aBodyInit.GetAsURLSearchParams());
     return body.GetAsStream(aStream, &aContentLength, aContentTypeWithCharset,
                             charset);
   }
 
   NS_NOTREACHED("Should never reach here");
   return NS_ERROR_FAILURE;
 }
 
--- a/dom/file/Blob.cpp
+++ b/dom/file/Blob.cpp
@@ -31,17 +31,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Blob)
   NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Blob)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMBlob)
   NS_INTERFACE_MAP_ENTRY(nsIDOMBlob)
-  NS_INTERFACE_MAP_ENTRY(nsIXHRSendable)
   NS_INTERFACE_MAP_ENTRY(nsIMutable)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(Blob)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(Blob)
 
 void
@@ -199,21 +198,24 @@ Blob::Slice(const Optional<int64_t>& aSt
 }
 
 size_t
 Blob::GetAllocationSize() const
 {
   return mImpl->GetAllocationSize();
 }
 
-NS_IMETHODIMP
+// contentTypeWithCharset can be set to the contentType or
+// contentType+charset based on what the spec says.
+// See: https://fetch.spec.whatwg.org/#concept-bodyinit-extract
+nsresult
 Blob::GetSendInfo(nsIInputStream** aBody,
                   uint64_t* aContentLength,
                   nsACString& aContentType,
-                  nsACString& aCharset)
+                  nsACString& aCharset) const
 {
   return mImpl->GetSendInfo(aBody, aContentLength, aContentType, aCharset);
 }
 
 NS_IMETHODIMP
 Blob::GetMutable(bool* aMutable)
 {
   return mImpl->GetMutable(aMutable);
--- a/dom/file/Blob.h
+++ b/dom/file/Blob.h
@@ -24,24 +24,22 @@ class nsIInputStream;
 namespace mozilla {
 namespace dom {
 
 struct BlobPropertyBag;
 class File;
 class OwningArrayBufferViewOrArrayBufferOrBlobOrUSVString;
 
 class Blob : public nsIDOMBlob
-           , public nsIXHRSendable
            , public nsIMutable
            , public nsSupportsWeakReference
            , public nsWrapperCache
 {
 public:
   NS_DECL_NSIDOMBLOB
-  NS_DECL_NSIXHRSENDABLE
   NS_DECL_NSIMUTABLE
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Blob, nsIDOMBlob)
 
   typedef OwningArrayBufferViewOrArrayBufferOrBlobOrUSVString BlobPart;
 
   // This creates a Blob or a File based on the type of BlobImpl.
@@ -122,16 +120,22 @@ public:
 
   already_AddRefed<Blob> Slice(const Optional<int64_t>& aStart,
                                const Optional<int64_t>& aEnd,
                                const Optional<nsAString>& aContentType,
                                ErrorResult& aRv);
 
   size_t GetAllocationSize() const;
 
+  nsresult
+  GetSendInfo(nsIInputStream** aBody,
+              uint64_t* aContentLength,
+              nsACString& aContentType,
+              nsACString& aCharset) const;
+
 protected:
   // File constructor should never be used directly. Use Blob::Create instead.
   Blob(nsISupports* aParent, BlobImpl* aImpl);
   virtual ~Blob();
 
   virtual bool HasFileInterface() const { return false; }
 
   // The member is the real backend implementation of this File/Blob.
--- a/dom/url/URLSearchParams.cpp
+++ b/dom/url/URLSearchParams.cpp
@@ -335,17 +335,16 @@ URLParams::Serialize(nsAString& aValue) 
 }
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(URLSearchParams, mParent, mObserver)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(URLSearchParams)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(URLSearchParams)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(URLSearchParams)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsIXHRSendable)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 URLSearchParams::URLSearchParams(nsISupports* aParent,
                                  URLSearchParamsObserver* aObserver)
   : mParams(new URLParams())
   , mParent(aParent)
   , mObserver(aObserver)
@@ -606,20 +605,23 @@ URLSearchParams::WriteStructuredClone(JS
 }
 
 bool
 URLSearchParams::ReadStructuredClone(JSStructuredCloneReader* aReader)
 {
  return mParams->ReadStructuredClone(aReader);
 }
 
-NS_IMETHODIMP
+// contentTypeWithCharset can be set to the contentType or
+// contentType+charset based on what the spec says.
+// See: https://fetch.spec.whatwg.org/#concept-bodyinit-extract
+nsresult
 URLSearchParams::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
                              nsACString& aContentTypeWithCharset,
-                             nsACString& aCharset)
+                             nsACString& aCharset) const
 {
   aContentTypeWithCharset.AssignLiteral("application/x-www-form-urlencoded;charset=UTF-8");
   aCharset.AssignLiteral("UTF-8");
 
   nsAutoString serialized;
   Serialize(serialized);
   NS_ConvertUTF16toUTF8 converted(serialized);
   *aContentLength = converted.Length();
--- a/dom/url/URLSearchParams.h
+++ b/dom/url/URLSearchParams.h
@@ -8,17 +8,17 @@
 #define mozilla_dom_URLSearchParams_h
 
 #include "js/StructuredClone.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/ErrorResult.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsWrapperCache.h"
 #include "nsISupports.h"
-#include "nsIXMLHttpRequest.h"
+#include "nsIInputStream.h"
 
 namespace mozilla {
 namespace dom {
 
 class URLSearchParams;
 class USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString;
 
 class URLSearchParamsObserver : public nsISupports
@@ -111,24 +111,22 @@ private:
   {
     nsString mKey;
     nsString mValue;
   };
 
   nsTArray<Param> mParams;
 };
 
-class URLSearchParams final : public nsIXHRSendable,
+class URLSearchParams final : public nsISupports,
                               public nsWrapperCache
 {
   ~URLSearchParams();
 
 public:
-  NS_DECL_NSIXHRSENDABLE
-
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(URLSearchParams)
 
   explicit URLSearchParams(nsISupports* aParent,
                            URLSearchParamsObserver* aObserver=nullptr);
 
   // WebIDL methods
   nsISupports* GetParentObject() const
@@ -172,16 +170,21 @@ public:
   }
 
   bool
   ReadStructuredClone(JSStructuredCloneReader* aReader);
 
   bool
   WriteStructuredClone(JSStructuredCloneWriter* aWriter) const;
 
+  nsresult
+  GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
+              nsACString& aContentTypeWithCharset,
+              nsACString& aCharset) const;
+
 private:
   void AppendInternal(const nsAString& aName, const nsAString& aValue);
 
   void DeleteAll();
 
   void NotifyObserver();
 
   UniquePtr<URLParams> mParams;
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -2924,17 +2924,17 @@ XMLHttpRequestMainThread::Send(JSContext
 
   if (aData.Value().IsDocument()) {
     BodyExtractor<nsIDocument> body(&aData.Value().GetAsDocument());
     aRv = SendInternal(&body);
     return;
   }
 
   if (aData.Value().IsBlob()) {
-    BodyExtractor<nsIXHRSendable> body(&aData.Value().GetAsBlob());
+    BodyExtractor<const Blob> body(&aData.Value().GetAsBlob());
     aRv = SendInternal(&body);
     return;
   }
 
   if (aData.Value().IsArrayBuffer()) {
     BodyExtractor<const ArrayBuffer> body(&aData.Value().GetAsArrayBuffer());
     aRv = SendInternal(&body);
     return;
@@ -2943,23 +2943,23 @@ XMLHttpRequestMainThread::Send(JSContext
   if (aData.Value().IsArrayBufferView()) {
     BodyExtractor<const ArrayBufferView>
       body(&aData.Value().GetAsArrayBufferView());
     aRv = SendInternal(&body);
     return;
   }
 
   if (aData.Value().IsFormData()) {
-    BodyExtractor<nsIXHRSendable> body(&aData.Value().GetAsFormData());
+    BodyExtractor<const FormData> body(&aData.Value().GetAsFormData());
     aRv = SendInternal(&body);
     return;
   }
 
   if (aData.Value().IsURLSearchParams()) {
-    BodyExtractor<nsIXHRSendable> body(&aData.Value().GetAsURLSearchParams());
+    BodyExtractor<const URLSearchParams> body(&aData.Value().GetAsURLSearchParams());
     aRv = SendInternal(&body);
     return;
   }
 
   if (aData.Value().IsUSVString()) {
     BodyExtractor<const nsAString> body(&aData.Value().GetAsUSVString());
     aRv = SendInternal(&body);
     return;