Bug 1237674 - Rename nsFormData to mozilla::dom::FormData, r=smaug

This commit is contained in:
Andrea Marchesini 2016-01-07 19:30:36 +00:00
parent f25ca3b068
commit 496a5cfe38
15 changed files with 130 additions and 126 deletions

View File

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsFormData.h"
#include "FormData.h"
#include "nsIVariant.h"
#include "nsIInputStream.h"
#include "mozilla/dom/File.h"
@ -15,7 +15,7 @@
using namespace mozilla;
using namespace mozilla::dom;
nsFormData::nsFormData(nsISupports* aOwner)
FormData::FormData(nsISupports* aOwner)
: nsFormSubmission(NS_LITERAL_CSTRING("UTF-8"), nullptr)
, mOwner(aOwner)
{
@ -61,9 +61,9 @@ CreateNewFileInstance(Blob& aBlob, const Optional<nsAString>& aFilename,
// -------------------------------------------------------------------------
// nsISupports
NS_IMPL_CYCLE_COLLECTION_CLASS(nsFormData)
NS_IMPL_CYCLE_COLLECTION_CLASS(FormData)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsFormData)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FormData)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOwner)
for (uint32_t i = 0, len = tmp->mFormData.Length(); i < len; ++i) {
@ -73,7 +73,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsFormData)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFormData)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(FormData)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOwner)
for (uint32_t i = 0, len = tmp->mFormData.Length(); i < len; ++i) {
@ -84,12 +84,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFormData)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsFormData)
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(FormData)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFormData)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFormData)
NS_IMPL_CYCLE_COLLECTING_ADDREF(FormData)
NS_IMPL_CYCLE_COLLECTING_RELEASE(FormData)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFormData)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FormData)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIDOMFormData)
NS_INTERFACE_MAP_ENTRY(nsIXHRSendable)
@ -99,23 +99,23 @@ NS_INTERFACE_MAP_END
// -------------------------------------------------------------------------
// nsFormSubmission
nsresult
nsFormData::GetEncodedSubmission(nsIURI* aURI,
nsIInputStream** aPostDataStream)
FormData::GetEncodedSubmission(nsIURI* aURI,
nsIInputStream** aPostDataStream)
{
NS_NOTREACHED("Shouldn't call nsFormData::GetEncodedSubmission");
NS_NOTREACHED("Shouldn't call FormData::GetEncodedSubmission");
return NS_OK;
}
void
nsFormData::Append(const nsAString& aName, const nsAString& aValue,
ErrorResult& aRv)
FormData::Append(const nsAString& aName, const nsAString& aValue,
ErrorResult& aRv)
{
AddNameValuePair(aName, aValue);
}
void
nsFormData::Append(const nsAString& aName, Blob& aBlob,
const Optional<nsAString>& aFilename,
FormData::Append(const nsAString& aName, Blob& aBlob,
const Optional<nsAString>& aFilename,
ErrorResult& aRv)
{
RefPtr<File> file = CreateNewFileInstance(aBlob, aFilename, aRv);
@ -127,7 +127,7 @@ nsFormData::Append(const nsAString& aName, Blob& aBlob,
}
void
nsFormData::Delete(const nsAString& aName)
FormData::Delete(const nsAString& aName)
{
// We have to use this slightly awkward for loop since uint32_t >= 0 is an
// error for being always true.
@ -139,8 +139,8 @@ nsFormData::Delete(const nsAString& aName)
}
void
nsFormData::Get(const nsAString& aName,
Nullable<OwningFileOrUSVString>& aOutValue)
FormData::Get(const nsAString& aName,
Nullable<OwningFileOrUSVString>& aOutValue)
{
for (uint32_t i = 0; i < mFormData.Length(); ++i) {
if (aName.Equals(mFormData[i].name)) {
@ -153,8 +153,8 @@ nsFormData::Get(const nsAString& aName,
}
void
nsFormData::GetAll(const nsAString& aName,
nsTArray<OwningFileOrUSVString>& aValues)
FormData::GetAll(const nsAString& aName,
nsTArray<OwningFileOrUSVString>& aValues)
{
for (uint32_t i = 0; i < mFormData.Length(); ++i) {
if (aName.Equals(mFormData[i].name)) {
@ -165,7 +165,7 @@ nsFormData::GetAll(const nsAString& aName,
}
bool
nsFormData::Has(const nsAString& aName)
FormData::Has(const nsAString& aName)
{
for (uint32_t i = 0; i < mFormData.Length(); ++i) {
if (aName.Equals(mFormData[i].name)) {
@ -177,15 +177,15 @@ nsFormData::Has(const nsAString& aName)
}
nsresult
nsFormData::AddNameFilePair(const nsAString& aName, File* aFile)
FormData::AddNameFilePair(const nsAString& aName, File* aFile)
{
FormDataTuple* data = mFormData.AppendElement();
SetNameFilePair(data, aName, aFile);
return NS_OK;
}
nsFormData::FormDataTuple*
nsFormData::RemoveAllOthersAndGetFirstFormDataTuple(const nsAString& aName)
FormData::FormDataTuple*
FormData::RemoveAllOthersAndGetFirstFormDataTuple(const nsAString& aName)
{
FormDataTuple* lastFoundTuple = nullptr;
uint32_t lastFoundIndex = mFormData.Length();
@ -207,9 +207,9 @@ nsFormData::RemoveAllOthersAndGetFirstFormDataTuple(const nsAString& aName)
}
void
nsFormData::Set(const nsAString& aName, Blob& aBlob,
const Optional<nsAString>& aFilename,
ErrorResult& aRv)
FormData::Set(const nsAString& aName, Blob& aBlob,
const Optional<nsAString>& aFilename,
ErrorResult& aRv)
{
FormDataTuple* tuple = RemoveAllOthersAndGetFirstFormDataTuple(aName);
if (tuple) {
@ -225,8 +225,8 @@ nsFormData::Set(const nsAString& aName, Blob& aBlob,
}
void
nsFormData::Set(const nsAString& aName, const nsAString& aValue,
ErrorResult& aRv)
FormData::Set(const nsAString& aName, const nsAString& aValue,
ErrorResult& aRv)
{
FormDataTuple* tuple = RemoveAllOthersAndGetFirstFormDataTuple(aName);
if (tuple) {
@ -237,29 +237,29 @@ nsFormData::Set(const nsAString& aName, const nsAString& aValue,
}
uint32_t
nsFormData::GetIterableLength() const
FormData::GetIterableLength() const
{
return mFormData.Length();
}
const nsAString&
nsFormData::GetKeyAtIndex(uint32_t aIndex) const
FormData::GetKeyAtIndex(uint32_t aIndex) const
{
MOZ_ASSERT(aIndex < mFormData.Length());
return mFormData[aIndex].name;
}
const OwningFileOrUSVString&
nsFormData::GetValueAtIndex(uint32_t aIndex) const
FormData::GetValueAtIndex(uint32_t aIndex) const
{
MOZ_ASSERT(aIndex < mFormData.Length());
return mFormData[aIndex].value;
}
void
nsFormData::SetNameValuePair(FormDataTuple* aData,
const nsAString& aName,
const nsAString& aValue)
FormData::SetNameValuePair(FormDataTuple* aData,
const nsAString& aName,
const nsAString& aValue)
{
MOZ_ASSERT(aData);
aData->name = aName;
@ -267,9 +267,9 @@ nsFormData::SetNameValuePair(FormDataTuple* aData,
}
void
nsFormData::SetNameFilePair(FormDataTuple* aData,
const nsAString& aName,
File* aFile)
FormData::SetNameFilePair(FormDataTuple* aData,
const nsAString& aName,
File* aFile)
{
MOZ_ASSERT(aData);
aData->name = aName;
@ -284,7 +284,7 @@ nsFormData::SetNameFilePair(FormDataTuple* aData,
// nsIDOMFormData
NS_IMETHODIMP
nsFormData::Append(const nsAString& aName, nsIVariant* aValue)
FormData::Append(const nsAString& aName, nsIVariant* aValue)
{
uint16_t dataType;
nsresult rv = aValue->GetDataType(&dataType);
@ -331,17 +331,17 @@ nsFormData::Append(const nsAString& aName, nsIVariant* aValue)
}
/* virtual */ JSObject*
nsFormData::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
FormData::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return FormDataBinding::Wrap(aCx, this, aGivenProto);
}
/* static */ already_AddRefed<nsFormData>
nsFormData::Constructor(const GlobalObject& aGlobal,
const Optional<NonNull<HTMLFormElement> >& aFormElement,
ErrorResult& aRv)
/* static */ already_AddRefed<FormData>
FormData::Constructor(const GlobalObject& aGlobal,
const Optional<NonNull<HTMLFormElement> >& aFormElement,
ErrorResult& aRv)
{
RefPtr<nsFormData> formData = new nsFormData(aGlobal.GetAsSupports());
RefPtr<FormData> formData = new FormData(aGlobal.GetAsSupports());
if (aFormElement.WasPassed()) {
aRv = aFormElement.Value().WalkFormElements(formData);
}
@ -352,8 +352,8 @@ nsFormData::Constructor(const GlobalObject& aGlobal,
// nsIXHRSendable
NS_IMETHODIMP
nsFormData::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
nsACString& aContentType, nsACString& aCharset)
FormData::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
nsACString& aContentType, nsACString& aCharset)
{
nsFSMultipartFormData fs(NS_LITERAL_CSTRING("UTF-8"), nullptr);

View File

@ -4,40 +4,33 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsFormData_h__
#define nsFormData_h__
#ifndef mozilla_dom_FormData_h
#define mozilla_dom_FormData_h
#include "mozilla/Attributes.h"
#include "nsIDOMFormData.h"
#include "nsIXMLHttpRequest.h"
#include "nsFormSubmission.h"
#include "nsWrapperCache.h"
#include "nsTArray.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FormDataBinding.h"
#include "nsIDOMFormData.h"
#include "nsIXMLHttpRequest.h"
#include "nsFormSubmission.h"
#include "nsTArray.h"
#include "nsWrapperCache.h"
namespace mozilla {
class ErrorResult;
namespace dom {
class HTMLFormElement;
class GlobalObject;
} // namespace dom
} // namespace mozilla
class nsFormData final : public nsIDOMFormData,
public nsIXHRSendable,
public nsFormSubmission,
public nsWrapperCache
class FormData final : public nsIDOMFormData,
public nsIXHRSendable,
public nsFormSubmission,
public nsWrapperCache
{
private:
~nsFormData() {}
typedef mozilla::dom::Blob Blob;
typedef mozilla::dom::File File;
typedef mozilla::dom::OwningFileOrUSVString OwningFileOrUSVString;
~FormData() {}
struct FormDataTuple
{
@ -59,10 +52,10 @@ private:
File* aFile);
public:
explicit nsFormData(nsISupports* aOwner = nullptr);
explicit FormData(nsISupports* aOwner = nullptr);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsFormData,
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(FormData,
nsIDOMFormData)
NS_DECL_NSIDOMFORMDATA
@ -77,32 +70,42 @@ public:
{
return mOwner;
}
static already_AddRefed<nsFormData>
Constructor(const mozilla::dom::GlobalObject& aGlobal,
const mozilla::dom::Optional<mozilla::dom::NonNull<mozilla::dom::HTMLFormElement> >& aFormElement,
mozilla::ErrorResult& aRv);
static already_AddRefed<FormData>
Constructor(const GlobalObject& aGlobal,
const Optional<NonNull<HTMLFormElement> >& aFormElement,
ErrorResult& aRv);
void Append(const nsAString& aName, const nsAString& aValue,
mozilla::ErrorResult& aRv);
ErrorResult& aRv);
void Append(const nsAString& aName, Blob& aBlob,
const mozilla::dom::Optional<nsAString>& aFilename,
mozilla::ErrorResult& aRv);
const Optional<nsAString>& aFilename,
ErrorResult& aRv);
void Delete(const nsAString& aName);
void Get(const nsAString& aName, mozilla::dom::Nullable<OwningFileOrUSVString>& aOutValue);
void Get(const nsAString& aName, Nullable<OwningFileOrUSVString>& aOutValue);
void GetAll(const nsAString& aName, nsTArray<OwningFileOrUSVString>& aValues);
bool Has(const nsAString& aName);
void Set(const nsAString& aName, Blob& aBlob,
const mozilla::dom::Optional<nsAString>& aFilename,
mozilla::ErrorResult& aRv);
const Optional<nsAString>& aFilename,
ErrorResult& aRv);
void Set(const nsAString& aName, const nsAString& aValue,
mozilla::ErrorResult& aRv);
ErrorResult& aRv);
uint32_t GetIterableLength() const;
const nsAString& GetKeyAtIndex(uint32_t aIndex) const;
const OwningFileOrUSVString& GetValueAtIndex(uint32_t aIndex) const;
// nsFormSubmission
virtual nsresult GetEncodedSubmission(nsIURI* aURI,
nsIInputStream** aPostDataStream) override;
virtual nsresult
GetEncodedSubmission(nsIURI* aURI, nsIInputStream** aPostDataStream) override;
virtual nsresult AddNameValuePair(const nsAString& aName,
const nsAString& aValue) override
{
@ -110,6 +113,7 @@ public:
SetNameValuePair(data, aName, aValue);
return NS_OK;
}
virtual nsresult AddNameFilePair(const nsAString& aName,
File* aFile) override;
@ -144,4 +148,7 @@ private:
nsTArray<FormDataTuple> mFormData;
};
#endif // nsFormData_h__
} // dom namespace
} // mozilla namepsace
#endif // mozilla_dom_FormData_h

View File

@ -106,7 +106,7 @@
#include "mozilla/dom/Promise.h"
#include "nsIUploadChannel2.h"
#include "nsFormData.h"
#include "mozilla/dom/FormData.h"
#include "nsIDocShell.h"
#include "WorkerPrivate.h"
@ -1292,7 +1292,7 @@ Navigator::SendBeacon(const nsAString& aUrl,
mimeType = NS_ConvertUTF16toUTF8(type);
} else if (aData.Value().IsFormData()) {
nsFormData& form = aData.Value().GetAsFormData();
FormData& form = aData.Value().GetAsFormData();
uint64_t len;
nsAutoCString charset;
form.GetSendInfo(getter_AddRefs(in),

View File

@ -13,6 +13,7 @@
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileList.h"
#include "mozilla/dom/FileListBinding.h"
#include "mozilla/dom/FormData.h"
#include "mozilla/dom/ImageBitmap.h"
#include "mozilla/dom/ImageBitmapBinding.h"
#include "mozilla/dom/ImageData.h"
@ -33,7 +34,6 @@
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/ipc/PBackgroundSharedTypes.h"
#include "MultipartBlobImpl.h"
#include "nsFormData.h"
#include "nsIRemoteBlob.h"
#include "nsQueryObject.h"
@ -816,8 +816,8 @@ ReadFormData(JSContext* aCx,
// See the serialization of the FormData for the format.
JS::Rooted<JS::Value> val(aCx);
{
RefPtr<nsFormData> formData =
new nsFormData(aHolder->ParentDuringRead());
RefPtr<FormData> formData =
new FormData(aHolder->ParentDuringRead());
Optional<nsAString> thirdArg;
for (uint32_t i = 0; i < aCount; ++i) {
@ -887,7 +887,7 @@ ReadFormData(JSContext* aCx,
// - value string
bool
WriteFormData(JSStructuredCloneWriter* aWriter,
nsFormData* aFormData,
FormData* aFormData,
StructuredCloneHolder* aHolder)
{
MOZ_ASSERT(aWriter);
@ -1010,7 +1010,7 @@ StructuredCloneHolder::CustomWriteHandler(JSContext* aCx,
// See if this is a FormData object.
{
nsFormData* formData = nullptr;
FormData* formData = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(FormData, aObj, formData))) {
return WriteFormData(aWriter, formData, this);
}

View File

@ -75,7 +75,6 @@ EXPORTS += [
'nsDOMNavigationTiming.h',
'nsDOMString.h',
'nsFocusManager.h',
'nsFormData.h',
'nsFrameMessageManager.h',
'nsGenericDOMDataNode.h',
'nsGkAtomList.h',
@ -180,6 +179,7 @@ EXPORTS.mozilla.dom += [
'File.h',
'FileList.h',
'FileReader.h',
'FormData.h',
'FragmentOrElement.h',
'FromParser.h',
'ImageEncoder.h',
@ -246,6 +246,7 @@ UNIFIED_SOURCES += [
'File.cpp',
'FileList.cpp',
'FileReader.cpp',
'FormData.cpp',
'FragmentOrElement.cpp',
'ImageEncoder.cpp',
'ImportManager.cpp',
@ -280,7 +281,6 @@ UNIFIED_SOURCES += [
'nsDOMTokenList.cpp',
'nsDOMWindowList.cpp',
'nsFocusManager.cpp',
'nsFormData.cpp',
'nsFrameLoader.cpp',
'nsGenConImageContent.cpp',
'nsGenericDOMDataNode.cpp',

View File

@ -14,6 +14,7 @@
#include "mozilla/dom/BlobSet.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FetchUtil.h"
#include "mozilla/dom/FormData.h"
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventListenerManager.h"
@ -73,7 +74,6 @@
#include "nsIHttpChannelInternal.h"
#include "nsIClassOfService.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsFormData.h"
#include "nsStreamListenerWrapper.h"
#include "xpcjsid.h"
#include "nsITimedChannel.h"

View File

@ -41,7 +41,6 @@
#undef Status
#endif
class nsFormData;
class nsIJARChannel;
class nsILoadGroup;
class nsIUnicodeDecoder;
@ -52,6 +51,7 @@ namespace mozilla {
namespace dom {
class Blob;
class BlobSet;
class FormData;
} // namespace dom
// A helper for building up an ArrayBuffer object's data
@ -363,7 +363,7 @@ private:
{
mValue.mString = &aString;
}
explicit RequestBody(nsFormData& aFormData) : mType(FormData)
explicit RequestBody(mozilla::dom::FormData& aFormData) : mType(FormData)
{
mValue.mFormData = &aFormData;
}
@ -388,7 +388,7 @@ private:
mozilla::dom::Blob* mBlob;
nsIDocument* mDocument;
const nsAString* mString;
nsFormData* mFormData;
mozilla::dom::FormData* mFormData;
nsIInputStream* mStream;
};
@ -467,7 +467,8 @@ public:
aRv = Send(RequestBody(aString));
}
}
void Send(JSContext* /*aCx*/, nsFormData& aFormData, ErrorResult& aRv)
void Send(JSContext* /*aCx*/, mozilla::dom::FormData& aFormData,
ErrorResult& aRv)
{
aRv = Send(RequestBody(aFormData));
}

View File

@ -529,10 +529,6 @@ DOMInterfaces = {
'wrapperCache': False,
},
'FormData': {
'nativeType': 'nsFormData'
},
'Geolocation': {
'headerFile': 'nsGeolocation.h'
},

View File

@ -25,6 +25,7 @@
#include "mozilla/dom/Exceptions.h"
#include "mozilla/dom/FetchDriver.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FormData.h"
#include "mozilla/dom/Headers.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/PromiseWorkerProxy.h"
@ -37,7 +38,6 @@
#include "InternalRequest.h"
#include "InternalResponse.h"
#include "nsFormData.h"
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#include "WorkerScope.h"
@ -393,7 +393,7 @@ ExtractFromBlob(const Blob& aBlob, nsIInputStream** aStream,
}
nsresult
ExtractFromFormData(nsFormData& aFormData, nsIInputStream** aStream,
ExtractFromFormData(FormData& aFormData, nsIInputStream** aStream,
nsCString& aContentType)
{
uint64_t unusedContentLength;
@ -468,7 +468,7 @@ ExtractByteStreamFromBody(const OwningArrayBufferOrArrayBufferViewOrBlobOrFormDa
const Blob& blob = aBodyInit.GetAsBlob();
return ExtractFromBlob(blob, aStream, aContentType);
} else if (aBodyInit.IsFormData()) {
nsFormData& form = aBodyInit.GetAsFormData();
FormData& form = aBodyInit.GetAsFormData();
return ExtractFromFormData(form, aStream, aContentType);
} else if (aBodyInit.IsUSVString()) {
nsAutoString str;
@ -500,7 +500,7 @@ ExtractByteStreamFromBody(const ArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUS
const Blob& blob = aBodyInit.GetAsBlob();
return ExtractFromBlob(blob, aStream, aContentType);
} else if (aBodyInit.IsFormData()) {
nsFormData& form = aBodyInit.GetAsFormData();
FormData& form = aBodyInit.GetAsFormData();
return ExtractFromFormData(form, aStream, aContentType);
} else if (aBodyInit.IsUSVString()) {
nsAutoString str;
@ -1039,7 +1039,7 @@ FetchBody<Derived>::ContinueConsumeBody(nsresult aStatus, uint32_t aResultLength
data.Adopt(reinterpret_cast<char*>(aResult), aResultLength);
autoFree.Reset();
RefPtr<nsFormData> fd = FetchUtil::ConsumeFormData(
RefPtr<dom::FormData> fd = FetchUtil::ConsumeFormData(
DerivedClass()->GetParentObject(),
mMimeType, data, error);
if (!error.Failed()) {

View File

@ -194,7 +194,7 @@ class MOZ_STACK_CLASS FillFormIterator final
: public URLSearchParams::ForEachIterator
{
public:
explicit FillFormIterator(nsFormData* aFormData)
explicit FillFormIterator(FormData* aFormData)
: mFormData(aFormData)
{
MOZ_ASSERT(aFormData);
@ -210,7 +210,7 @@ public:
}
private:
nsFormData* mFormData;
FormData* mFormData;
};
/**
@ -224,7 +224,7 @@ private:
* never return a partially filled FormData.
* The content-disposition header is used to figure out the name and filename
* entries. The inclusion of the filename parameter decides if the entry is
* inserted into the nsFormData as a string or a File.
* inserted into the FormData as a string or a File.
*
* File blobs are copies of the underlying data string since we cannot adopt
* char* chunks embedded within the larger body without significant effort.
@ -235,7 +235,7 @@ private:
class MOZ_STACK_CLASS FormDataParser
{
private:
RefPtr<nsFormData> mFormData;
RefPtr<FormData> mFormData;
nsCString mMimeType;
nsCString mData;
@ -388,7 +388,7 @@ private:
aStart.advance(2);
if (!mFormData) {
mFormData = new nsFormData();
mFormData = new FormData();
}
NS_ConvertUTF8toUTF16 name(mName);
@ -488,7 +488,7 @@ public:
if (start != end && *start == '-') {
// End of data.
if (!mFormData) {
mFormData = new nsFormData();
mFormData = new FormData();
}
return true;
}
@ -535,7 +535,7 @@ public:
return false;
}
already_AddRefed<nsFormData> FormData()
already_AddRefed<FormData> GetFormData()
{
return mFormData.forget();
}
@ -543,7 +543,7 @@ public:
}
// static
already_AddRefed<nsFormData>
already_AddRefed<FormData>
FetchUtil::ConsumeFormData(nsIGlobalObject* aParent, const nsCString& aMimeType,
const nsCString& aStr, ErrorResult& aRv)
{
@ -564,7 +564,7 @@ FetchUtil::ConsumeFormData(nsIGlobalObject* aParent, const nsCString& aMimeType,
return nullptr;
}
RefPtr<nsFormData> fd = parser.FormData();
RefPtr<FormData> fd = parser.GetFormData();
MOZ_ASSERT(fd);
return fd.forget();
}
@ -580,7 +580,7 @@ FetchUtil::ConsumeFormData(nsIGlobalObject* aParent, const nsCString& aMimeType,
URLParams params;
params.ParseInput(aStr);
RefPtr<nsFormData> fd = new nsFormData(aParent);
RefPtr<FormData> fd = new FormData(aParent);
FillFormIterator iterator(fd);
DebugOnly<bool> status = params.ForEach(iterator);
MOZ_ASSERT(status);

View File

@ -3,10 +3,10 @@
#include "nsString.h"
#include "nsError.h"
#include "nsFormData.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FormData.h"
namespace mozilla {
namespace dom {
@ -47,7 +47,7 @@ public:
* Creates a form data object from a UTF-8 encoded |aStr|. Returns |nullptr|
* and sets |aRv| to MSG_BAD_FORMDATA if |aStr| contains invalid data.
*/
static already_AddRefed<nsFormData>
static already_AddRefed<FormData>
ConsumeFormData(nsIGlobalObject* aParent, const nsCString& aMimeType,
const nsCString& aStr, ErrorResult& aRv);

View File

@ -36,6 +36,7 @@
#include "nsQueryObject.h"
// form submission
#include "mozilla/dom/FormData.h"
#include "mozilla/Telemetry.h"
#include "nsIFormSubmitObserver.h"
#include "nsIObserverService.h"
@ -49,7 +50,6 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsIWebProgress.h"
#include "nsIDocShell.h"
#include "nsFormData.h"
#include "nsFormSubmissionConstants.h"
#include "nsIPrompt.h"
#include "nsISecurityUITelemetry.h"

View File

@ -16,11 +16,11 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/Exceptions.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FormData.h"
#include "mozilla/dom/ProgressEvent.h"
#include "mozilla/dom/StructuredCloneHolder.h"
#include "nsComponentManagerUtils.h"
#include "nsContentUtils.h"
#include "nsFormData.h"
#include "nsJSUtils.h"
#include "nsThreadUtils.h"
#include "nsVariant.h"
@ -2203,7 +2203,7 @@ XMLHttpRequest::Send(Blob& aBody, ErrorResult& aRv)
}
void
XMLHttpRequest::Send(nsFormData& aBody, ErrorResult& aRv)
XMLHttpRequest::Send(FormData& aBody, ErrorResult& aRv)
{
mWorkerPrivate->AssertIsOnWorkerThread();
JSContext* cx = mWorkerPrivate->GetJSContext();

View File

@ -174,7 +174,7 @@ public:
Send(Blob& aBody, ErrorResult& aRv);
void
Send(nsFormData& aBody, ErrorResult& aRv);
Send(FormData& aBody, ErrorResult& aRv);
void
Send(const ArrayBuffer& aBody, ErrorResult& aRv);

View File

@ -67,7 +67,7 @@
// view stuff
#include "nsContentCreatorFunctions.h"
#include "nsFormData.h"
#include "mozilla/dom/FormData.h"
#include "nsHostObjectProtocolHandler.h"
#include "nsHostObjectURI.h"
#include "nsGlobalWindowCommands.h"
@ -299,7 +299,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(XPathEvaluator)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsXMLHttpRequest, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormData)
NS_GENERIC_FACTORY_CONSTRUCTOR(FormData)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlobProtocolHandler)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMediaStreamProtocolHandler)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMediaSourceProtocolHandler)
@ -1054,7 +1054,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kTRANSFORMIIX_XPATH_EVALUATOR_CID, false, nullptr, XPathEvaluatorConstructor },
{ &kTRANSFORMIIX_NODESET_CID, false, nullptr, txNodeSetAdaptorConstructor },
{ &kNS_XMLSERIALIZER_CID, false, nullptr, nsDOMSerializerConstructor },
{ &kNS_FORMDATA_CID, false, nullptr, nsFormDataConstructor },
{ &kNS_FORMDATA_CID, false, nullptr, FormDataConstructor },
{ &kNS_BLOBPROTOCOLHANDLER_CID, false, nullptr, nsBlobProtocolHandlerConstructor },
{ &kNS_MEDIASTREAMPROTOCOLHANDLER_CID, false, nullptr, nsMediaStreamProtocolHandlerConstructor },
{ &kNS_MEDIASOURCEPROTOCOLHANDLER_CID, false, nullptr, nsMediaSourceProtocolHandlerConstructor },