--- a/dom/base/FormData.cpp
+++ b/dom/base/FormData.cpp
@@ -1,16 +1,15 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "FormData.h"
-#include "nsIVariant.h"
#include "nsIInputStream.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/Directory.h"
#include "mozilla/dom/HTMLFormElement.h"
#include "mozilla/Encoding.h"
#include "MultipartBlobImpl.h"
@@ -89,18 +88,17 @@ 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_AMBIGUOUS(nsISupports, nsIDOMFormData)
+ NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
// -------------------------------------------------------------------------
// HTMLFormSubmission
nsresult
FormData::GetEncodedSubmission(nsIURI* aURI,
nsIInputStream** aPostDataStream,
int64_t* aPostDataStreamLength)
@@ -322,66 +320,16 @@ FormData::SetNameDirectoryPair(FormDataT
MOZ_ASSERT(aData);
MOZ_ASSERT(aDirectory);
aData->name = aName;
aData->wasNullBlob = false;
aData->value.SetAsDirectory() = aDirectory;
}
-// -------------------------------------------------------------------------
-// nsIDOMFormData
-
-NS_IMETHODIMP
-FormData::Append(const nsAString& aName, nsIVariant* aValue)
-{
- uint16_t dataType;
- nsresult rv = aValue->GetDataType(&dataType);
- NS_ENSURE_SUCCESS(rv, rv);
-
- if (dataType == nsIDataType::VTYPE_INTERFACE ||
- dataType == nsIDataType::VTYPE_INTERFACE_IS) {
- nsCOMPtr<nsISupports> supports;
- nsID *iid;
- rv = aValue->GetAsInterface(&iid, getter_AddRefs(supports));
- NS_ENSURE_SUCCESS(rv, rv);
-
- free(iid);
-
- nsCOMPtr<nsIDOMBlob> domBlob = do_QueryInterface(supports);
- RefPtr<Blob> blob = static_cast<Blob*>(domBlob.get());
- if (domBlob) {
- Optional<nsAString> temp;
- ErrorResult rv;
- Append(aName, *blob, temp, rv);
- if (NS_WARN_IF(rv.Failed())) {
- return rv.StealNSResult();
- }
-
- return NS_OK;
- }
- }
-
- char16_t* stringData = nullptr;
- uint32_t stringLen = 0;
- rv = aValue->GetAsWStringWithSize(&stringLen, &stringData);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsString valAsString;
- valAsString.Adopt(stringData, stringLen);
-
- ErrorResult error;
- Append(aName, valAsString, error);
- if (NS_WARN_IF(error.Failed())) {
- return error.StealNSResult();
- }
-
- return NS_OK;
-}
-
/* virtual */ JSObject*
FormData::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return FormDataBinding::Wrap(aCx, this, aGivenProto);
}
/* static */ already_AddRefed<FormData>
FormData::Constructor(const GlobalObject& aGlobal,
--- a/dom/base/FormData.h
+++ b/dom/base/FormData.h
@@ -8,27 +8,26 @@
#define mozilla_dom_FormData_h
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/HTMLFormSubmission.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FormDataBinding.h"
-#include "nsIDOMFormData.h"
#include "nsTArray.h"
#include "nsWrapperCache.h"
namespace mozilla {
namespace dom {
class HTMLFormElement;
class GlobalObject;
-class FormData final : public nsIDOMFormData,
+class FormData final : public nsISupports,
public HTMLFormSubmission,
public nsWrapperCache
{
private:
~FormData() {}
struct FormDataTuple
{
@@ -54,20 +53,17 @@ private:
void SetNameDirectoryPair(FormDataTuple* aData,
const nsAString& aName,
Directory* aDirectory);
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_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FormData)
// nsWrapperCache
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
// WebIDL
nsISupports*
GetParentObject() const
{
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -14,17 +14,16 @@ TEST_DIRS += ['test']
XPIDL_SOURCES += [
'mozIDOMWindow.idl',
'nsIContentPolicy.idl',
'nsIDocumentEncoder.idl',
'nsIDOMDataChannel.idl',
'nsIDOMDOMCursor.idl',
'nsIDOMDOMRequest.idl',
- 'nsIDOMFormData.idl',
'nsIDOMParser.idl',
'nsIDOMSerializer.idl',
'nsIDroppedLinkHandler.idl',
'nsIFrameLoader.idl',
'nsIImageLoadingContent.idl',
'nsIMessageManager.idl',
'nsIObjectLoadingContent.idl',
'nsIRemoteWindowContext.idl',
deleted file mode 100644
--- a/dom/base/nsIDOMFormData.idl
+++ /dev/null
@@ -1,22 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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 "nsISupports.idl"
-
-interface nsIVariant;
-
-[uuid(256c9139-5a29-41e1-8698-f9f9aae7d6cf)]
-interface nsIDOMFormData : nsISupports
-{
- void append(in DOMString name, in nsIVariant value);
-};
-
-%{ C++
-#define NS_FORMDATA_CID \
-{ 0x6b192618, 0x26f2, 0x426e, \
- { 0xa7, 0xac, 0x1e, 0x13, 0xa6, 0xa4, 0x52, 0x2b } }
-
-#define NS_FORMDATA_CONTRACTID "@mozilla.org/files/formdata;1"
-%}
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -51,16 +51,17 @@
#include "mozilla/dom/FileReaderBinding.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/TextDecoderBinding.h"
#include "mozilla/dom/TextEncoderBinding.h"
#include "mozilla/dom/UnionConversions.h"
#include "mozilla/dom/URLBinding.h"
#include "mozilla/dom/URLSearchParamsBinding.h"
#include "mozilla/dom/XMLHttpRequest.h"
+#include "mozilla/dom/FormDataBinding.h"
#include "mozilla/DeferredFinalize.h"
using namespace mozilla;
using namespace JS;
using namespace xpc;
using mozilla::dom::DestroyProtoAndIfaceCache;
using mozilla::dom::IndexedDatabaseManager;
@@ -933,16 +934,18 @@ xpc::GlobalProperties::Parse(JSContext*
} else if (!strcmp(name.ptr(), "CSSRule")) {
CSSRule = true;
} else if (!strcmp(name.ptr(), "Directory")) {
Directory = true;
} else if (!strcmp(name.ptr(), "File")) {
File = true;
} else if (!strcmp(name.ptr(), "FileReader")) {
FileReader = true;
+ } else if (!strcmp(name.ptr(), "FormData")) {
+ FormData = true;
} else if (!strcmp(name.ptr(), "InspectorUtils")) {
InspectorUtils = true;
} else if (!strcmp(name.ptr(), "MessageChannel")) {
MessageChannel = true;
} else if (!strcmp(name.ptr(), "NodeFilter")) {
NodeFilter = true;
} else if (!strcmp(name.ptr(), "TextDecoder")) {
TextDecoder = true;
@@ -1006,16 +1009,20 @@ xpc::GlobalProperties::Define(JSContext*
if (File &&
!dom::FileBinding::GetConstructorObject(cx))
return false;
if (FileReader && !dom::FileReaderBinding::GetConstructorObject(cx))
return false;
+ if (FormData &&
+ !dom::FormDataBinding::GetConstructorObject(cx))
+ return false;
+
if (InspectorUtils &&
!dom::InspectorUtilsBinding::GetConstructorObject(cx))
return false;
if (MessageChannel &&
(!dom::MessageChannelBinding::GetConstructorObject(cx) ||
!dom::MessagePortBinding::GetConstructorObject(cx)))
return false;
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -2680,16 +2680,17 @@ struct GlobalProperties {
// Interface objects we can expose.
bool Blob : 1;
bool ChromeUtils : 1;
bool CSS : 1;
bool CSSRule : 1;
bool Directory : 1;
bool File : 1;
bool FileReader: 1;
+ bool FormData : 1;
bool InspectorUtils : 1;
bool MessageChannel: 1;
bool NodeFilter : 1;
bool TextDecoder : 1;
bool TextEncoder : 1;
bool URL : 1;
bool URLSearchParams : 1;
bool XMLHttpRequest : 1;
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -62,17 +62,16 @@
#include "txNodeSetAdaptor.h"
#include "mozilla/dom/DOMParser.h"
#include "nsDOMSerializer.h"
// view stuff
#include "nsContentCreatorFunctions.h"
-#include "mozilla/dom/FormData.h"
#include "nsHostObjectURI.h"
#include "nsGlobalWindowCommands.h"
#include "nsIControllerCommandTable.h"
#include "nsJSProtocolHandler.h"
#include "nsScriptNameSpaceManager.h"
#include "nsIControllerContext.h"
#include "nsZipArchive.h"
#include "mozilla/Attributes.h"
@@ -218,17 +217,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(HTMLEdito
#define PRESENTATION_TCP_SESSION_TRANSPORT_CID \
{ 0xc9d023f4, 0x6228, 0x4c07, { 0x8b, 0x1d, 0x9c, 0x19, 0x57, 0x3f, 0xaa, 0x27 } }
already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
// Factory Constructor
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
-NS_GENERIC_FACTORY_CONSTRUCTOR(FormData)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHostObjectURI)
NS_GENERIC_FACTORY_CONSTRUCTOR(DOMParser)
NS_GENERIC_FACTORY_CONSTRUCTOR(LocalStorageManager)
NS_GENERIC_FACTORY_CONSTRUCTOR(SessionStorageManager)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(DOMRequestService,
DOMRequestService::FactoryCreate)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(QuotaManagerService,
QuotaManagerService::FactoryCreate)
@@ -586,17 +584,16 @@ NS_DEFINE_NAMED_CID(NS_JSURI_CID);
NS_DEFINE_NAMED_CID(NS_WINDOWCOMMANDTABLE_CID);
NS_DEFINE_NAMED_CID(NS_WINDOWCONTROLLER_CID);
NS_DEFINE_NAMED_CID(NS_PLUGINDOCLOADERFACTORY_CID);
NS_DEFINE_NAMED_CID(NS_PLUGINDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_VIDEODOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_STYLESHEETSERVICE_CID);
NS_DEFINE_NAMED_CID(TRANSFORMIIX_NODESET_CID);
NS_DEFINE_NAMED_CID(NS_XMLSERIALIZER_CID);
-NS_DEFINE_NAMED_CID(NS_FORMDATA_CID);
NS_DEFINE_NAMED_CID(NS_HOSTOBJECTURI_CID);
NS_DEFINE_NAMED_CID(NS_DOMPARSER_CID);
NS_DEFINE_NAMED_CID(NS_DOMSESSIONSTORAGEMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_DOMLOCALSTORAGEMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_TEXTEDITOR_CID);
NS_DEFINE_NAMED_CID(DOMREQUEST_SERVICE_CID);
NS_DEFINE_NAMED_CID(QUOTAMANAGER_SERVICE_CID);
NS_DEFINE_NAMED_CID(SERVICEWORKERMANAGER_CID);
@@ -835,17 +832,16 @@ static const mozilla::Module::CIDEntry k
{ &kNS_WINDOWCOMMANDTABLE_CID, false, nullptr, CreateWindowCommandTableConstructor },
{ &kNS_WINDOWCONTROLLER_CID, false, nullptr, CreateWindowControllerWithSingletonCommandTable },
{ &kNS_PLUGINDOCLOADERFACTORY_CID, false, nullptr, CreateContentDLF },
{ &kNS_PLUGINDOCUMENT_CID, false, nullptr, CreatePluginDocument },
{ &kNS_VIDEODOCUMENT_CID, false, nullptr, CreateVideoDocument },
{ &kNS_STYLESHEETSERVICE_CID, false, nullptr, nsStyleSheetServiceConstructor },
{ &kTRANSFORMIIX_NODESET_CID, false, nullptr, txNodeSetAdaptorConstructor },
{ &kNS_XMLSERIALIZER_CID, false, nullptr, nsDOMSerializerConstructor },
- { &kNS_FORMDATA_CID, false, nullptr, FormDataConstructor },
{ &kNS_HOSTOBJECTURI_CID, false, nullptr, nsHostObjectURIConstructor },
{ &kNS_DOMPARSER_CID, false, nullptr, DOMParserConstructor },
{ &kNS_DOMSESSIONSTORAGEMANAGER_CID, false, nullptr, SessionStorageManagerConstructor },
{ &kNS_DOMLOCALSTORAGEMANAGER_CID, false, nullptr, LocalStorageManagerConstructor },
{ &kNS_TEXTEDITOR_CID, false, nullptr, TextEditorConstructor },
{ &kDOMREQUEST_SERVICE_CID, false, nullptr, DOMRequestServiceConstructor },
{ &kQUOTAMANAGER_SERVICE_CID, false, nullptr, QuotaManagerServiceConstructor },
{ &kSERVICEWORKERMANAGER_CID, false, nullptr, ServiceWorkerManagerConstructor },
@@ -950,17 +946,16 @@ static const mozilla::Module::ContractID
#endif
{ CONTENT_DLF_CONTRACTID, &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID },
{ NS_JSPROTOCOLHANDLER_CONTRACTID, &kNS_JSPROTOCOLHANDLER_CID },
{ NS_WINDOWCONTROLLER_CONTRACTID, &kNS_WINDOWCONTROLLER_CID },
{ PLUGIN_DLF_CONTRACTID, &kNS_PLUGINDOCLOADERFACTORY_CID },
{ NS_STYLESHEETSERVICE_CONTRACTID, &kNS_STYLESHEETSERVICE_CID },
{ TRANSFORMIIX_NODESET_CONTRACTID, &kTRANSFORMIIX_NODESET_CID },
{ NS_XMLSERIALIZER_CONTRACTID, &kNS_XMLSERIALIZER_CID },
- { NS_FORMDATA_CONTRACTID, &kNS_FORMDATA_CID },
{ NS_DOMPARSER_CONTRACTID, &kNS_DOMPARSER_CID },
{ "@mozilla.org/dom/localStorage-manager;1", &kNS_DOMLOCALSTORAGEMANAGER_CID },
// Keeping the old ContractID for backward compatibility
{ "@mozilla.org/dom/storagemanager;1", &kNS_DOMLOCALSTORAGEMANAGER_CID },
{ "@mozilla.org/dom/sessionStorage-manager;1", &kNS_DOMSESSIONSTORAGEMANAGER_CID },
{ "@mozilla.org/editor/texteditor;1", &kNS_TEXTEDITOR_CID },
{ DOMREQUEST_SERVICE_CONTRACTID, &kDOMREQUEST_SERVICE_CID },
{ QUOTAMANAGER_SERVICE_CONTRACTID, &kQUOTAMANAGER_SERVICE_CID },
--- a/toolkit/crashreporter/CrashSubmit.jsm
+++ b/toolkit/crashreporter/CrashSubmit.jsm
@@ -1,17 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/KeyValueParser.jsm");
-Cu.importGlobalProperties(["File", "XMLHttpRequest"]);
+Cu.importGlobalProperties(["File", "FormData", "XMLHttpRequest"]);
ChromeUtils.defineModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
this.EXPORTED_SYMBOLS = [
"CrashSubmit"
];
@@ -211,18 +211,18 @@ Submitter.prototype = {
getService(Ci.nsIEnvironment).get("MOZ_CRASHREPORTER_URL");
if (envOverride != "") {
serverURL = envOverride;
}
let xhr = new XMLHttpRequest();
xhr.open("POST", serverURL, true);
- let formData = Cc["@mozilla.org/files/formdata;1"]
- .createInstance(Ci.nsIDOMFormData);
+ let formData = new FormData();
+
// add the data
for (let [name, value] of Object.entries(this.extraKeyVals)) {
if (name != "ServerURL" && name != "StackTraces") {
formData.append(name, value);
}
}
if (this.noThrottle) {
// tell the server not to throttle this, since it was manually submitted
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -24,17 +24,16 @@
#include "nsIDOMDocumentFragment.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMDragEvent.h"
#include "nsIDOMElement.h"
#include "nsIDOMEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMFileList.h"
#include "nsIDOMFocusEvent.h"
-#include "nsIDOMFormData.h"
#include "nsIDOMGeoPositionError.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMMouseScrollEvent.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNotifyPaintEvent.h"
@@ -78,17 +77,16 @@
#include "mozilla/dom/DocumentFragmentBinding.h"
#include "mozilla/dom/DocumentTypeBinding.h"
#include "mozilla/dom/DragEventBinding.h"
#include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/EventBinding.h"
#include "mozilla/dom/EventTargetBinding.h"
#include "mozilla/dom/FileListBinding.h"
#include "mozilla/dom/FocusEventBinding.h"
-#include "mozilla/dom/FormDataBinding.h"
#include "mozilla/dom/FrameLoaderBinding.h"
#include "mozilla/dom/HTMLAnchorElementBinding.h"
#include "mozilla/dom/HTMLAreaElementBinding.h"
#include "mozilla/dom/HTMLButtonElementBinding.h"
#include "mozilla/dom/HTMLFormElementBinding.h"
#include "mozilla/dom/HTMLFrameSetElementBinding.h"
#include "mozilla/dom/HTMLHtmlElementBinding.h"
#include "mozilla/dom/HTMLInputElementBinding.h"
@@ -196,17 +194,16 @@ const ComponentsInterfaceShimEntry kComp
DEFINE_SHIM(DocumentFragment),
DEFINE_SHIM(DocumentType),
DEFINE_SHIM(DragEvent),
DEFINE_SHIM(Element),
DEFINE_SHIM(Event),
DEFINE_SHIM(EventTarget),
DEFINE_SHIM(FileList),
DEFINE_SHIM(FocusEvent),
- DEFINE_SHIM(FormData),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIFrameLoader, FrameLoader),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMGeoPositionError, PositionError),
DEFINE_SHIM(HTMLFormElement),
DEFINE_SHIM(HTMLInputElement),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject),
DEFINE_SHIM(MouseEvent),
DEFINE_SHIM(MouseScrollEvent),
DEFINE_SHIM(NodeList),