Bug 792808 - Purge nsIXMLHttpRequest, nsIXMLHttpRequestUpload, nsIXMLHttpRequestEventTarget, nsIXHRSendable XPCOM interfaces; r=baku

MozReview-Commit-ID: 8yzCXSeyO85
This commit is contained in:
Thomas Wisniewski
2017-11-19 17:11:41 -05:00
parent 64ad6daa5a
commit 0c092dc939
18 changed files with 31 additions and 749 deletions

View File

@@ -221,7 +221,6 @@
@RESPATH@/components/dom_webspeechrecognition.xpt @RESPATH@/components/dom_webspeechrecognition.xpt
#endif #endif
@RESPATH@/components/dom_workers.xpt @RESPATH@/components/dom_workers.xpt
@RESPATH@/components/dom_xhr.xpt
@RESPATH@/components/dom_xul.xpt @RESPATH@/components/dom_xul.xpt
@RESPATH@/components/dom_presentation.xpt @RESPATH@/components/dom_presentation.xpt
@RESPATH@/components/downloads.xpt @RESPATH@/components/downloads.xpt

View File

@@ -14,7 +14,6 @@
#include "mozilla/dom/File.h" #include "mozilla/dom/File.h"
#include "mozilla/dom/FormDataBinding.h" #include "mozilla/dom/FormDataBinding.h"
#include "nsIDOMFormData.h" #include "nsIDOMFormData.h"
#include "nsIXMLHttpRequest.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsWrapperCache.h" #include "nsWrapperCache.h"

View File

@@ -1,50 +0,0 @@
/* -*- 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 "gtest/gtest.h"
#include "nsContentUtils.h"
#include "nsIDOMDocument.h"
#include "nsIPrincipal.h"
#include "nsIScriptSecurityManager.h"
#include "nsIXMLHttpRequest.h"
#define TEST_URL_PREFIX "data:text/xml,"
#define TEST_URL_CONTENT "<foo><bar></bar></foo>"
#define TEST_URL TEST_URL_PREFIX TEST_URL_CONTENT
TEST(NativeXMLHttpRequest, Test)
{
nsresult rv;
nsCOMPtr<nsIXMLHttpRequest> xhr =
do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
ASSERT_TRUE(NS_SUCCEEDED(rv)) << "Couldn't create nsIXMLHttpRequest instance";
NS_NAMED_LITERAL_CSTRING(getString, "GET");
NS_NAMED_LITERAL_CSTRING(testURL, TEST_URL);
const nsAString& empty = EmptyString();
rv = xhr->Init(nsContentUtils::GetSystemPrincipal(), nullptr, nullptr, nullptr);
ASSERT_TRUE(NS_SUCCEEDED(rv)) << "Couldn't initialize the XHR";
rv = xhr->Open(getString, testURL, false, empty, empty);
ASSERT_TRUE(NS_SUCCEEDED(rv)) << "Open failed";
rv = xhr->Send(nullptr);
ASSERT_TRUE(NS_SUCCEEDED(rv)) << "Send failed";
nsAutoString response;
rv = xhr->GetResponseText(response);
ASSERT_TRUE(NS_SUCCEEDED(rv)) << "GetResponse failed";
ASSERT_TRUE(response.EqualsLiteral(TEST_URL_CONTENT)) <<
"Response text does not match";
nsCOMPtr<nsIDOMDocument> dom;
rv = xhr->GetResponseXML(getter_AddRefs(dom));
ASSERT_TRUE(NS_SUCCEEDED(rv)) << "GetResponseXML failed";
ASSERT_TRUE(dom) << "No DOM document constructed";
}

View File

@@ -5,7 +5,6 @@
# file, you can obtain one at http://mozilla.org/MPL/2.0/. # file, you can obtain one at http://mozilla.org/MPL/2.0/.
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'TestNativeXMLHttpRequest.cpp',
'TestParserDialogOptions.cpp', 'TestParserDialogOptions.cpp',
'TestPlainTextSerializer.cpp', 'TestPlainTextSerializer.cpp',
'TestXPathGenerator.cpp', 'TestXPathGenerator.cpp',

View File

@@ -167,16 +167,6 @@ BodyExtractor<nsIInputStream>::GetAsStream(nsIInputStream** aResult,
return NS_OK; return NS_OK;
} }
template<> nsresult
BodyExtractor<nsIXHRSendable>::GetAsStream(nsIInputStream** aResult,
uint64_t* aContentLength,
nsACString& aContentTypeWithCharset,
nsACString& aCharset) const
{
return mBody->GetSendInfo(aResult, aContentLength, aContentTypeWithCharset,
aCharset);
}
template<> nsresult template<> nsresult
BodyExtractor<const Blob>::GetAsStream(nsIInputStream** aResult, BodyExtractor<const Blob>::GetAsStream(nsIInputStream** aResult,
uint64_t* aContentLength, uint64_t* aContentLength,

View File

@@ -15,7 +15,6 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsIDOMBlob.h" #include "nsIDOMBlob.h"
#include "nsIMutable.h" #include "nsIMutable.h"
#include "nsIXMLHttpRequest.h"
#include "nsWrapperCache.h" #include "nsWrapperCache.h"
#include "nsWeakReference.h" #include "nsWeakReference.h"

View File

@@ -10,6 +10,7 @@
#include "mozilla/ErrorResult.h" #include "mozilla/ErrorResult.h"
#include "mozilla/dom/FileSystemRequestParent.h" #include "mozilla/dom/FileSystemRequestParent.h"
#include "mozilla/dom/PFileSystemRequestChild.h" #include "mozilla/dom/PFileSystemRequestChild.h"
#include "nsIGlobalObject.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
namespace mozilla { namespace mozilla {

View File

@@ -10,7 +10,6 @@
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/dom/XMLHttpRequestEventTarget.h" #include "mozilla/dom/XMLHttpRequestEventTarget.h"
#include "mozilla/dom/XMLHttpRequestBinding.h" #include "mozilla/dom/XMLHttpRequestBinding.h"
#include "nsIXMLHttpRequest.h"
class nsIJSID; class nsIJSID;

View File

@@ -20,7 +20,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(XMLHttpRequestEventTarget,
NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(XMLHttpRequestEventTarget) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(XMLHttpRequestEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIXMLHttpRequestEventTarget)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper) NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(XMLHttpRequestEventTarget, DOMEventTargetHelper) NS_IMPL_ADDREF_INHERITED(XMLHttpRequestEventTarget, DOMEventTargetHelper)

View File

@@ -8,13 +8,11 @@
#define mozilla_dom_XMLHttpRequestEventTarget_h #define mozilla_dom_XMLHttpRequestEventTarget_h
#include "mozilla/DOMEventTargetHelper.h" #include "mozilla/DOMEventTargetHelper.h"
#include "nsIXMLHttpRequest.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class XMLHttpRequestEventTarget : public DOMEventTargetHelper, class XMLHttpRequestEventTarget : public DOMEventTargetHelper
public nsIXMLHttpRequestEventTarget
{ {
protected: protected:
explicit XMLHttpRequestEventTarget(DOMEventTargetHelper* aOwner) explicit XMLHttpRequestEventTarget(DOMEventTargetHelper* aOwner)
@@ -30,7 +28,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLHttpRequestEventTarget, NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLHttpRequestEventTarget,
DOMEventTargetHelper) DOMEventTargetHelper)
NS_DECL_NSIXMLHTTPREQUESTEVENTTARGET
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper) NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
IMPL_EVENT_HANDLER(loadstart) IMPL_EVENT_HANDLER(loadstart)

View File

@@ -245,30 +245,10 @@ XMLHttpRequestMainThread::~XMLHttpRequestMainThread()
mozilla::DropJSObjects(this); mozilla::DropJSObjects(this);
} }
/**
* This Init method is called from the factory constructor.
*/
nsresult
XMLHttpRequestMainThread::Init()
{
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
nsCOMPtr<nsIPrincipal> subjectPrincipal;
if (secMan) {
secMan->GetSystemPrincipal(getter_AddRefs(subjectPrincipal));
}
NS_ENSURE_STATE(subjectPrincipal);
// Instead of grabbing some random global from the context stack,
// let's use the default one (junk scope) for now.
// We should move away from this Init...
Construct(subjectPrincipal, xpc::NativeGlobal(xpc::PrivilegedJunkScope()));
return NS_OK;
}
/** /**
* This Init method should only be called by C++ consumers. * This Init method should only be called by C++ consumers.
*/ */
NS_IMETHODIMP nsresult
XMLHttpRequestMainThread::Init(nsIPrincipal* aPrincipal, XMLHttpRequestMainThread::Init(nsIPrincipal* aPrincipal,
nsIGlobalObject* aGlobalObject, nsIGlobalObject* aGlobalObject,
nsIURI* aBaseURI, nsIURI* aBaseURI,
@@ -403,7 +383,6 @@ XMLHttpRequestMainThread::IsCertainlyAliveForCC() const
// QueryInterface implementation for XMLHttpRequestMainThread // QueryInterface implementation for XMLHttpRequestMainThread
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(XMLHttpRequestMainThread) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(XMLHttpRequestMainThread)
NS_INTERFACE_MAP_ENTRY(nsIXMLHttpRequest)
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver) NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
NS_INTERFACE_MAP_ENTRY(nsIStreamListener) NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink) NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink)
@@ -451,15 +430,6 @@ XMLHttpRequestMainThread::SizeOfEventTargetIncludingThis(
// - lots // - lots
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetChannel(nsIChannel **aChannel)
{
NS_ENSURE_ARG_POINTER(aChannel);
NS_IF_ADDREF(*aChannel = mChannel);
return NS_OK;
}
static void LogMessage(const char* aWarning, nsPIDOMWindowInner* aWindow, static void LogMessage(const char* aWarning, nsPIDOMWindowInner* aWindow,
const char16_t** aParams=nullptr, uint32_t aParamCount=0) const char16_t** aParams=nullptr, uint32_t aParamCount=0)
{ {
@@ -473,23 +443,6 @@ static void LogMessage(const char* aWarning, nsPIDOMWindowInner* aWindow,
aWarning, aParams, aParamCount); aWarning, aParams, aParamCount);
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetResponseXML(nsIDOMDocument **aResponseXML)
{
ErrorResult rv;
nsIDocument* responseXML = GetResponseXML(rv);
if (rv.Failed()) {
return rv.StealNSResult();
}
if (!responseXML) {
*aResponseXML = nullptr;
return NS_OK;
}
return CallQueryInterface(responseXML, aResponseXML);
}
nsIDocument* nsIDocument*
XMLHttpRequestMainThread::GetResponseXML(ErrorResult& aRv) XMLHttpRequestMainThread::GetResponseXML(ErrorResult& aRv)
{ {
@@ -588,20 +541,6 @@ XMLHttpRequestMainThread::AppendToResponseText(const char * aSrcBuffer,
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetResponseText(nsAString& aResponseText)
{
ErrorResult rv;
DOMString str;
GetResponseText(str, rv);
if (NS_WARN_IF(rv.Failed())) {
return rv.StealNSResult();
}
str.ToString(aResponseText);
return NS_OK;
}
void void
XMLHttpRequestMainThread::GetResponseText(DOMString& aResponseText, XMLHttpRequestMainThread::GetResponseText(DOMString& aResponseText,
ErrorResult& aRv) ErrorResult& aRv)
@@ -692,30 +631,6 @@ XMLHttpRequestMainThread::CreateResponseParsedJSON(JSContext* aCx)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP XMLHttpRequestMainThread::GetResponseType(nsAString& aResponseType)
{
MOZ_ASSERT(mResponseType < XMLHttpRequestResponseType::EndGuard_);
const EnumEntry& entry =
XMLHttpRequestResponseTypeValues::strings[static_cast<uint32_t>(mResponseType)];
aResponseType.AssignASCII(entry.value, entry.length);
return NS_OK;
}
NS_IMETHODIMP XMLHttpRequestMainThread::SetResponseType(const nsAString& aResponseType)
{
uint32_t i = 0;
for (const EnumEntry* entry = XMLHttpRequestResponseTypeValues::strings;
entry->value; ++entry, ++i) {
if (aResponseType.EqualsASCII(entry->value, entry->length)) {
ErrorResult rv;
SetResponseType(static_cast<XMLHttpRequestResponseType>(i), rv);
return rv.StealNSResult();
}
}
return NS_OK;
}
void void
XMLHttpRequestMainThread::SetResponseType(XMLHttpRequestResponseType aResponseType, XMLHttpRequestMainThread::SetResponseType(XMLHttpRequestResponseType aResponseType,
ErrorResult& aRv) ErrorResult& aRv)
@@ -749,14 +664,6 @@ XMLHttpRequestMainThread::SetResponseType(XMLHttpRequestResponseType aResponseTy
mResponseType = aResponseType; mResponseType = aResponseType;
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetResponse(JSContext *aCx, JS::MutableHandle<JS::Value> aResult)
{
ErrorResult rv;
GetResponse(aCx, aResult, rv);
return rv.StealNSResult();
}
void void
XMLHttpRequestMainThread::GetResponse(JSContext* aCx, XMLHttpRequestMainThread::GetResponse(JSContext* aCx,
JS::MutableHandle<JS::Value> aResponse, JS::MutableHandle<JS::Value> aResponse,
@@ -887,8 +794,7 @@ XMLHttpRequestMainThread::GetResponseURL(nsAString& aUrl)
{ {
aUrl.Truncate(); aUrl.Truncate();
uint16_t readyState = ReadyState(); if ((mState == State::unsent || mState == State::opened) || !mChannel) {
if ((readyState == UNSENT || readyState == OPENED) || !mChannel) {
return; return;
} }
@@ -910,14 +816,6 @@ XMLHttpRequestMainThread::GetResponseURL(nsAString& aUrl)
CopyUTF8toUTF16(temp, aUrl); CopyUTF8toUTF16(temp, aUrl);
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetStatus(uint32_t *aStatus)
{
ErrorResult rv;
*aStatus = GetStatus(rv);
return rv.StealNSResult();
}
uint32_t uint32_t
XMLHttpRequestMainThread::GetStatus(ErrorResult& aRv) XMLHttpRequestMainThread::GetStatus(ErrorResult& aRv)
{ {
@@ -927,8 +825,7 @@ XMLHttpRequestMainThread::GetStatus(ErrorResult& aRv)
return 0; return 0;
} }
uint16_t readyState = ReadyState(); if (mState == State::unsent || mState == State::opened) {
if (readyState == UNSENT || readyState == OPENED) {
return 0; return 0;
} }
@@ -964,14 +861,6 @@ XMLHttpRequestMainThread::GetStatus(ErrorResult& aRv)
return status; return status;
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetStatusText(nsACString& aOut)
{
ErrorResult rv;
GetStatusText(aOut, rv);
return rv.StealNSResult();
}
void void
XMLHttpRequestMainThread::GetStatusText(nsACString& aStatusText, XMLHttpRequestMainThread::GetStatusText(nsACString& aStatusText,
ErrorResult& aRv) ErrorResult& aRv)
@@ -989,8 +878,7 @@ XMLHttpRequestMainThread::GetStatusText(nsACString& aStatusText,
// value. This check is to prevent the status text for redirects from being // value. This check is to prevent the status text for redirects from being
// available before all the redirects have been followed and HTTP headers have // available before all the redirects have been followed and HTTP headers have
// been received. // been received.
uint16_t readyState = ReadyState(); if (mState == State::unsent || mState == State::opened) {
if (readyState == UNSENT || readyState == OPENED) {
return; return;
} }
@@ -1143,13 +1031,6 @@ XMLHttpRequestMainThread::AbortInternal(ErrorResult& aRv)
mFlagSyncLooping = false; mFlagSyncLooping = false;
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::SlowAbort()
{
Abort();
return NS_OK;
}
/*Method that checks if it is safe to expose a header value to the client. /*Method that checks if it is safe to expose a header value to the client.
It is used to check what headers are exposed for CORS requests.*/ It is used to check what headers are exposed for CORS requests.*/
bool bool
@@ -1207,14 +1088,6 @@ XMLHttpRequestMainThread::IsSafeHeader(const nsACString& aHeader,
return isSafe; return isSafe;
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetAllResponseHeaders(nsACString& aOut)
{
ErrorResult rv;
GetAllResponseHeaders(aOut, rv);
return rv.StealNSResult();
}
void void
XMLHttpRequestMainThread::GetAllResponseHeaders(nsACString& aResponseHeaders, XMLHttpRequestMainThread::GetAllResponseHeaders(nsACString& aResponseHeaders,
ErrorResult& aRv) ErrorResult& aRv)
@@ -1273,15 +1146,6 @@ XMLHttpRequestMainThread::GetAllResponseHeaders(nsACString& aResponseHeaders,
} }
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetResponseHeader(const nsACString& aHeader,
nsACString& aResult)
{
ErrorResult rv;
GetResponseHeader(aHeader, aResult, rv);
return rv.StealNSResult();
}
void void
XMLHttpRequestMainThread::GetResponseHeader(const nsACString& header, XMLHttpRequestMainThread::GetResponseHeader(const nsACString& header,
nsACString& _retval, ErrorResult& aRv) nsACString& _retval, ErrorResult& aRv)
@@ -1509,15 +1373,6 @@ XMLHttpRequestMainThread::InUploadPhase() const
return mState == State::opened; return mState == State::opened;
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::Open(const nsACString& aMethod, const nsACString& aUrl,
bool aAsync, const nsAString& aUsername,
const nsAString& aPassword, uint8_t optional_argc)
{
return Open(aMethod, aUrl, optional_argc > 0 ? aAsync : true,
aUsername, aPassword);
}
// This case is hit when the async parameter is outright omitted, which // This case is hit when the async parameter is outright omitted, which
// should set it to true (and the username and password to null). // should set it to true (and the username and password to null).
void void
@@ -2168,8 +2023,9 @@ XMLHttpRequestMainThread::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
// suppress parsing failure messages to console for statuses which // suppress parsing failure messages to console for statuses which
// can have empty bodies (see bug 884693). // can have empty bodies (see bug 884693).
uint32_t responseStatus; IgnoredErrorResult rv2;
if (NS_SUCCEEDED(GetStatus(&responseStatus)) && uint32_t responseStatus = GetStatus(rv2);
if (!rv2.Failed() &&
(responseStatus == 201 || responseStatus == 202 || (responseStatus == 201 || responseStatus == 202 ||
responseStatus == 204 || responseStatus == 205 || responseStatus == 204 || responseStatus == 205 ||
responseStatus == 304)) { responseStatus == 304)) {
@@ -2812,86 +2668,6 @@ XMLHttpRequestMainThread::InitiateFetch(already_AddRefed<nsIInputStream> aUpload
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::Send(nsIVariant* aVariant)
{
if (!aVariant) {
return SendInternal(nullptr);
}
uint16_t dataType;
nsresult rv = aVariant->GetDataType(&dataType);
NS_ENSURE_SUCCESS(rv, rv);
if (dataType == nsIDataType::VTYPE_INTERFACE ||
dataType == nsIDataType::VTYPE_INTERFACE_IS) {
nsCOMPtr<nsISupports> supports;
nsID *iid;
rv = aVariant->GetAsInterface(&iid, getter_AddRefs(supports));
NS_ENSURE_SUCCESS(rv, rv);
free(iid);
// document?
nsCOMPtr<nsIDocument> doc = do_QueryInterface(supports);
if (doc) {
BodyExtractor<nsIDocument> body(doc);
return SendInternal(&body);
}
// nsISupportsString?
nsCOMPtr<nsISupportsString> wstr = do_QueryInterface(supports);
if (wstr) {
nsAutoString string;
wstr->GetData(string);
BodyExtractor<const nsAString> body(&string);
return SendInternal(&body);
}
// nsIInputStream?
nsCOMPtr<nsIInputStream> stream = do_QueryInterface(supports);
if (stream) {
BodyExtractor<nsIInputStream> body(stream);
return SendInternal(&body);
}
// nsIXHRSendable?
nsCOMPtr<nsIXHRSendable> sendable = do_QueryInterface(supports);
if (sendable) {
BodyExtractor<nsIXHRSendable> body(sendable);
return SendInternal(&body);
}
// ArrayBuffer?
JS::RootingContext* rootingCx = RootingCx();
JS::Rooted<JS::Value> realVal(rootingCx);
nsresult rv = aVariant->GetAsJSVal(&realVal);
if (NS_SUCCEEDED(rv) && !realVal.isPrimitive()) {
JS::Rooted<JSObject*> obj(rootingCx, realVal.toObjectOrNull());
RootedSpiderMonkeyInterface<ArrayBuffer> buf(rootingCx);
if (buf.Init(obj)) {
BodyExtractor<const ArrayBuffer> body(&buf);
return SendInternal(&body);
}
}
} else if (dataType == nsIDataType::VTYPE_VOID ||
dataType == nsIDataType::VTYPE_EMPTY) {
return SendInternal(nullptr);
}
char16_t* data = nullptr;
uint32_t len = 0;
rv = aVariant->GetAsWStringWithSize(&len, &data);
NS_ENSURE_SUCCESS(rv, rv);
nsString string;
string.Adopt(data, len);
BodyExtractor<const nsAString> body(&string);
return SendInternal(&body);
}
void void
XMLHttpRequestMainThread::UnsuppressEventHandlingAndResume() XMLHttpRequestMainThread::UnsuppressEventHandlingAndResume()
{ {
@@ -3207,20 +2983,23 @@ XMLHttpRequestMainThread::IsLowercaseResponseHeader()
} }
// http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-setrequestheader // http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-setrequestheader
NS_IMETHODIMP void
XMLHttpRequestMainThread::SetRequestHeader(const nsACString& aName, XMLHttpRequestMainThread::SetRequestHeader(const nsACString& aName,
const nsACString& aValue) const nsACString& aValue,
ErrorResult& aRv)
{ {
NOT_CALLABLE_IN_SYNC_SEND NOT_CALLABLE_IN_SYNC_SEND_RV
// Step 1 // Step 1
if (mState != State::opened) { if (mState != State::opened) {
return NS_ERROR_DOM_INVALID_STATE_XHR_MUST_BE_OPENED; aRv.Throw(NS_ERROR_DOM_INVALID_STATE_XHR_MUST_BE_OPENED);
return;
} }
// Step 2 // Step 2
if (mFlagSend) { if (mFlagSend) {
return NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_SENDING; aRv.Throw(NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_SENDING);
return;
} }
// Step 3 // Step 3
@@ -3229,7 +3008,8 @@ XMLHttpRequestMainThread::SetRequestHeader(const nsACString& aName,
// Step 4 // Step 4
if (!NS_IsValidHTTPToken(aName) || !NS_IsReasonableHTTPHeaderValue(value)) { if (!NS_IsValidHTTPToken(aName) || !NS_IsReasonableHTTPHeaderValue(value)) {
return NS_ERROR_DOM_INVALID_HEADER_NAME; aRv.Throw(NS_ERROR_DOM_INVALID_HEADER_NAME);
return;
} }
// Step 5 // Step 5
@@ -3239,7 +3019,7 @@ XMLHttpRequestMainThread::SetRequestHeader(const nsACString& aName,
NS_ConvertUTF8toUTF16 name(aName); NS_ConvertUTF8toUTF16 name(aName);
const char16_t* params[] = { name.get() }; const char16_t* params[] = { name.get() };
LogMessage("ForbiddenHeaderWarning", GetOwner(), params, ArrayLength(params)); LogMessage("ForbiddenHeaderWarning", GetOwner(), params, ArrayLength(params));
return NS_OK; return;
} }
// Step 6.1 // Step 6.1
@@ -3254,23 +3034,6 @@ XMLHttpRequestMainThread::SetRequestHeader(const nsACString& aName,
} else { } else {
mAuthorRequestHeaders.MergeOrSet(aName, value); mAuthorRequestHeaders.MergeOrSet(aName, value);
} }
return NS_OK;
}
NS_IMETHODIMP
XMLHttpRequestMainThread::GetTimeout(uint32_t *aTimeout)
{
*aTimeout = Timeout();
return NS_OK;
}
NS_IMETHODIMP
XMLHttpRequestMainThread::SetTimeout(uint32_t aTimeout)
{
ErrorResult rv;
SetTimeout(aTimeout, rv);
return rv.StealNSResult();
} }
void void
@@ -3345,13 +3108,6 @@ XMLHttpRequestMainThread::StartTimeoutTimer()
); );
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetReadyState(uint16_t *aState)
{
*aState = ReadyState();
return NS_OK;
}
uint16_t uint16_t
XMLHttpRequestMainThread::ReadyState() const XMLHttpRequestMainThread::ReadyState() const
{ {
@@ -3373,28 +3129,13 @@ XMLHttpRequestMainThread::OverrideMimeType(const nsAString& aMimeType,
mOverrideMimeType = aMimeType; mOverrideMimeType = aMimeType;
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::SlowOverrideMimeType(const nsAString& aMimeType)
{
ErrorResult aRv;
OverrideMimeType(aMimeType, aRv);
return aRv.StealNSResult();
}
NS_IMETHODIMP
XMLHttpRequestMainThread::GetMozBackgroundRequest(bool *_retval)
{
*_retval = MozBackgroundRequest();
return NS_OK;
}
bool bool
XMLHttpRequestMainThread::MozBackgroundRequest() const XMLHttpRequestMainThread::MozBackgroundRequest() const
{ {
return mFlagBackgroundRequest; return mFlagBackgroundRequest;
} }
NS_IMETHODIMP nsresult
XMLHttpRequestMainThread::SetMozBackgroundRequest(bool aMozBackgroundRequest) XMLHttpRequestMainThread::SetMozBackgroundRequest(bool aMozBackgroundRequest)
{ {
if (!IsSystemXHR()) { if (!IsSystemXHR()) {
@@ -3419,27 +3160,12 @@ XMLHttpRequestMainThread::SetMozBackgroundRequest(bool aMozBackgroundRequest,
SetMozBackgroundRequest(aMozBackgroundRequest); SetMozBackgroundRequest(aMozBackgroundRequest);
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetWithCredentials(bool *_retval)
{
*_retval = WithCredentials();
return NS_OK;
}
bool bool
XMLHttpRequestMainThread::WithCredentials() const XMLHttpRequestMainThread::WithCredentials() const
{ {
return mFlagACwithCredentials; return mFlagACwithCredentials;
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::SetWithCredentials(bool aWithCredentials)
{
ErrorResult rv;
SetWithCredentials(aWithCredentials, rv);
return rv.StealNSResult();
}
void void
XMLHttpRequestMainThread::SetWithCredentials(bool aWithCredentials, ErrorResult& aRv) XMLHttpRequestMainThread::SetWithCredentials(bool aWithCredentials, ErrorResult& aRv)
{ {
@@ -3689,41 +3415,18 @@ XMLHttpRequestMainThread::GetUpload(ErrorResult& aRv)
return mUpload; return mUpload;
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetUpload(nsIXMLHttpRequestUpload** aUpload)
{
ErrorResult rv;
RefPtr<XMLHttpRequestUpload> upload = GetUpload(rv);
upload.forget(aUpload);
return rv.StealNSResult();
}
bool bool
XMLHttpRequestMainThread::MozAnon() const XMLHttpRequestMainThread::MozAnon() const
{ {
return mIsAnon; return mIsAnon;
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetMozAnon(bool* aAnon)
{
*aAnon = MozAnon();
return NS_OK;
}
bool bool
XMLHttpRequestMainThread::MozSystem() const XMLHttpRequestMainThread::MozSystem() const
{ {
return IsSystemXHR(); return IsSystemXHR();
} }
NS_IMETHODIMP
XMLHttpRequestMainThread::GetMozSystem(bool* aSystem)
{
*aSystem = MozSystem();
return NS_OK;
}
void void
XMLHttpRequestMainThread::HandleTimeoutCallback() XMLHttpRequestMainThread::HandleTimeoutCallback()
{ {

View File

@@ -9,7 +9,6 @@
#include <bitset> #include <bitset>
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsIXMLHttpRequest.h"
#include "nsISupportsUtils.h" #include "nsISupportsUtils.h"
#include "nsIURI.h" #include "nsIURI.h"
#include "nsIHttpChannel.h" #include "nsIHttpChannel.h"
@@ -162,7 +161,6 @@ class nsXHRParseEndListener;
// Make sure that any non-DOM interfaces added here are also added to // Make sure that any non-DOM interfaces added here are also added to
// nsXMLHttpRequestXPCOMifier. // nsXMLHttpRequestXPCOMifier.
class XMLHttpRequestMainThread final : public XMLHttpRequest, class XMLHttpRequestMainThread final : public XMLHttpRequest,
public nsIXMLHttpRequest,
public nsIStreamListener, public nsIStreamListener,
public nsIChannelEventSink, public nsIChannelEventSink,
public nsIProgressEventSink, public nsIProgressEventSink,
@@ -232,11 +230,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
// nsIXMLHttpRequest
NS_DECL_NSIXMLHTTPREQUEST
NS_FORWARD_NSIXMLHTTPREQUESTEVENTTARGET(XMLHttpRequestEventTarget::)
// nsIStreamListener // nsIStreamListener
NS_DECL_NSISTREAMLISTENER NS_DECL_NSISTREAMLISTENER
@@ -291,10 +284,7 @@ public:
virtual void virtual void
SetRequestHeader(const nsACString& aName, const nsACString& aValue, SetRequestHeader(const nsACString& aName, const nsACString& aValue,
ErrorResult& aRv) override ErrorResult& aRv) override;
{
aRv = SetRequestHeader(aName, aValue);
}
virtual uint32_t virtual uint32_t
Timeout() const override Timeout() const override
@@ -434,6 +424,9 @@ public:
virtual bool virtual bool
MozBackgroundRequest() const override; MozBackgroundRequest() const override;
nsresult
SetMozBackgroundRequest(bool aMozBackgroundRequest);
virtual void virtual void
SetMozBackgroundRequest(bool aMozBackgroundRequest, ErrorResult& aRv) override; SetMozBackgroundRequest(bool aMozBackgroundRequest, ErrorResult& aRv) override;
@@ -480,12 +473,11 @@ public:
const ProgressEventType aType, const ProgressEventType aType,
int64_t aLoaded, int64_t aTotal); int64_t aLoaded, int64_t aTotal);
// This is called by the factory constructor. // This is called by nsXULTemplateQueryProcessorXML.
nsresult Init(); nsresult Init(nsIPrincipal* aPrincipal,
nsIGlobalObject* aGlobalObject,
nsresult init(nsIPrincipal* principal, nsIURI* aBaseURI,
nsPIDOMWindowInner* globalObject, nsILoadGroup* aLoadGroup);
nsIURI* baseURI);
void SetRequestObserver(nsIRequestObserver* aObserver); void SetRequestObserver(nsIRequestObserver* aObserver);

View File

@@ -11,7 +11,6 @@ namespace mozilla {
namespace dom { namespace dom {
NS_INTERFACE_MAP_BEGIN(XMLHttpRequestUpload) NS_INTERFACE_MAP_BEGIN(XMLHttpRequestUpload)
NS_INTERFACE_MAP_ENTRY(nsIXMLHttpRequestUpload)
NS_INTERFACE_MAP_END_INHERITING(XMLHttpRequestEventTarget) NS_INTERFACE_MAP_END_INHERITING(XMLHttpRequestEventTarget)
NS_IMPL_ADDREF_INHERITED(XMLHttpRequestUpload, XMLHttpRequestEventTarget) NS_IMPL_ADDREF_INHERITED(XMLHttpRequestUpload, XMLHttpRequestEventTarget)

View File

@@ -8,13 +8,11 @@
#define mozilla_dom_XMLHttpRequestUpload_h #define mozilla_dom_XMLHttpRequestUpload_h
#include "mozilla/dom/XMLHttpRequestEventTarget.h" #include "mozilla/dom/XMLHttpRequestEventTarget.h"
#include "nsIXMLHttpRequest.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class XMLHttpRequestUpload final : public XMLHttpRequestEventTarget, class XMLHttpRequestUpload final : public XMLHttpRequestEventTarget
public nsIXMLHttpRequestUpload
{ {
public: public:
explicit XMLHttpRequestUpload(DOMEventTargetHelper* aOwner) explicit XMLHttpRequestUpload(DOMEventTargetHelper* aOwner)
@@ -25,9 +23,7 @@ public:
{} {}
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_NSIXMLHTTPREQUESTEVENTTARGET(XMLHttpRequestEventTarget::)
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(XMLHttpRequestEventTarget) NS_REALLY_FORWARD_NSIDOMEVENTTARGET(XMLHttpRequestEventTarget)
NS_DECL_NSIXMLHTTPREQUESTUPLOAD
virtual JSObject* virtual JSObject*
WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override; WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;

View File

@@ -7,12 +7,6 @@
with Files("**"): with Files("**"):
BUG_COMPONENT = ("Core", "DOM") BUG_COMPONENT = ("Core", "DOM")
XPIDL_SOURCES += [
'nsIXMLHttpRequest.idl',
]
XPIDL_MODULE = 'dom_xhr'
EXPORTS.mozilla.dom += [ EXPORTS.mozilla.dom += [
'XMLHttpRequest.h', 'XMLHttpRequest.h',
'XMLHttpRequestEventTarget.h', 'XMLHttpRequestEventTarget.h',

View File

@@ -1,324 +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 "nsIDOMEventTarget.idl"
interface nsIChannel;
interface nsIDOMDocument;
interface nsIDOMEventListener;
interface nsILoadGroup;
interface nsIPrincipal;
interface nsIScriptContext;
interface nsIURI;
interface nsIVariant;
interface nsIGlobalObject;
interface nsIInputStream;
interface nsIDOMBlob;
[builtinclass, uuid(88e7d2a0-2e5b-4f65-9624-a61e607a9948)]
interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget {
// event handler attributes
};
[builtinclass, uuid(d74c4dc4-bc8c-4f5d-b7f1-121a48750abe)]
interface nsIXMLHttpRequestUpload : nsIXMLHttpRequestEventTarget {
// for future use
};
/**
* Mozilla's XMLHttpRequest is modelled after Microsoft's IXMLHttpRequest
* object. The goal has been to make Mozilla's version match Microsoft's
* version as closely as possible, but there are bound to be some differences.
*
* In general, Microsoft's documentation for IXMLHttpRequest can be used.
* Mozilla's interface definitions provide some additional documentation. The
* web page to look at is http://www.mozilla.org/xmlextras/
*
* Mozilla's XMLHttpRequest object can be created in JavaScript like this:
* new XMLHttpRequest()
* compare to Internet Explorer:
* new ActiveXObject("Msxml2.XMLHTTP")
*
* From native code, the way to set up onload and onerror handlers is a bit
* different. Here is a comment from Johnny Stenback <jst@netscape.com>:
*
* The mozilla implementation of nsIXMLHttpRequest implements the interface
* nsIDOMEventTarget and that's how you're supported to add event listeners.
* Try something like this:
*
* nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(myxmlhttpreq));
*
* target->AddEventListener(NS_LITERAL_STRING("load"), mylistener,
* PR_FALSE)
*
* where mylistener is your event listener object that implements the
* interface nsIDOMEventListener.
*
* Conclusion: Do not use event listeners on XMLHttpRequest from C++, unless
* you're aware of all the security implications. And then think twice about
* it.
*/
[scriptable, uuid(6f54214c-7175-498d-9d2d-0429e38c2869)]
interface nsIXMLHttpRequest : nsISupports
{
/**
* The request uses a channel in order to perform the
* request. This attribute represents the channel used
* for the request. NULL if the channel has not yet been
* created.
*
* Mozilla only. Requires elevated privileges to access.
*/
readonly attribute nsIChannel channel;
/**
* The response to the request is parsed as if it were a
* text/xml stream. This attributes represents the response as
* a DOM Document object. NULL if the request is unsuccessful or
* has not yet been sent.
*/
readonly attribute nsIDOMDocument responseXML;
/**
* The response to the request as text.
* NULL if the request is unsuccessful or
* has not yet been sent.
*/
readonly attribute AString responseText;
/**
* Determine a response format which response attribute returns.
* empty string (initial value) or "text": as text.
* "arraybuffer": as a typed array ArrayBuffer.
* "blob": as a File API Blob.
* "document": as a DOM Document object.
*/
attribute AString responseType;
/**
* The response to the request as a specified format by responseType.
* NULL if the request is unsuccessful or
* has not yet been sent.
*/
[implicit_jscontext] readonly attribute jsval /* any */ response;
/**
* The status of the response to the request for HTTP requests.
*/
// XXX spec says unsigned short
readonly attribute unsigned long status;
/**
* The string representing the status of the response for
* HTTP requests.
*/
readonly attribute ACString statusText;
/**
* If the request has been sent already, this method will
* abort the request.
*/
[binaryname(SlowAbort)] void abort();
/**
* Returns all of the response headers as a string for HTTP
* requests.
*
* @returns A string containing all of the response headers.
* The empty string if the response has not yet been received.
*/
ACString getAllResponseHeaders();
/**
* Returns the text of the header with the specified name for
* HTTP requests.
*
* @param header The name of the header to retrieve
* @returns A string containing the text of the header specified.
* NULL if the response has not yet been received or the
* header does not exist in the response.
*/
ACString getResponseHeader(in ACString header);
%{C++
// note this is NOT virtual so this won't muck with the vtable!
inline nsresult Open(const nsACString& method, const nsACString& url,
bool async, const nsAString& user,
const nsAString& password) {
return Open(method, url, async, user, password, 3);
}
%}
/**
* Meant to be a script-only method for initializing a request.
*
* If there is an "active" request (that is, if open() has been called
* already), this is equivalent to calling abort() and then open().
*
* @param method The HTTP method - either "POST" or "GET". Ignored
* if the URL is not a HTTP URL.
* @param url The URL to which to send the request.
* @param async (optional) Whether the request is synchronous or
* asynchronous i.e. whether send returns only after
* the response is received or if it returns immediately after
* sending the request. In the latter case, notification
* of completion is sent through the event listeners.
* The default value is true.
* @param user (optional) A username for authentication if necessary.
* The default value is the empty string
* @param password (optional) A password for authentication if necessary.
* The default value is the empty string
*/
[optional_argc] void open(in ACString method, in AUTF8String url,
[optional] in boolean async,
[optional,Undefined(Empty)] in DOMString user,
[optional,Undefined(Empty)] in DOMString password);
/**
* Sends the request. If the request is asynchronous, returns
* immediately after sending the request. If it is synchronous
* returns only after the response has been received.
*
* All event listeners must be set before calling send().
*
* After the initial response, all event listeners will be cleared.
* // XXXbz what does that mean, exactly?
*
* @param body Either an instance of nsIDOMDocument, nsIInputStream
* or a string (nsISupportsString in the native calling
* case). This is used to populate the body of the
* HTTP request if the HTTP request method is "POST".
* If the parameter is a nsIDOMDocument, it is serialized.
* If the parameter is a nsIInputStream, then it must be
* compatible with nsIUploadChannel.setUploadStream, and a
* Content-Length header will be added to the HTTP request
* with a value given by nsIInputStream.available. Any
* headers included at the top of the stream will be
* treated as part of the message body. The MIME type of
* the stream should be specified by setting the Content-
* Type header via the setRequestHeader method before
* calling send.
*/
void send([optional] in nsIVariant body);
/**
* Sets a HTTP request header for HTTP requests. You must call open
* before setting the request headers.
*
* @param header The name of the header to set in the request.
* @param value The body of the header.
*/
void setRequestHeader(in ACString header, in ACString value);
/**
* The amount of milliseconds a request can take before being terminated.
* Initially zero. Zero means there is no timeout.
*/
attribute unsigned long timeout;
/**
* The state of the request.
*
* Possible values:
* 0 UNSENT open() has not been called yet.
* 1 OPENED send() has not been called yet.
* 2 HEADERS_RECEIVED
* send() has been called, headers and status are available.
* 3 LOADING Downloading, responseText holds the partial data.
* 4 DONE Finished with all operations.
*/
const unsigned short UNSENT = 0;
const unsigned short OPENED = 1;
const unsigned short HEADERS_RECEIVED = 2;
const unsigned short LOADING = 3;
const unsigned short DONE = 4;
readonly attribute unsigned short readyState;
/**
* Override the mime type returned by the server (if any). This may
* be used, for example, to force a stream to be treated and parsed
* as text/xml, even if the server does not report it as such. This
* must be done before the <code>send</code> method is invoked.
*
* @param mimetype The type used to override that returned by the server
* (if any).
*/
[binaryname(SlowOverrideMimeType)] void overrideMimeType(in DOMString mimetype);
/**
* Set to true if this is a background service request. This will
* prevent a load group being associated with the request, and
* suppress any security dialogs from being shown * to the user.
* In the cases where one of those dialogs would be shown, the request
* will simply fail instead.
*/
attribute boolean mozBackgroundRequest;
/**
* When set to true attempts to make cross-site Access-Control requests
* with credentials such as cookies and authorization headers.
*
* Never affects same-site requests.
*
* Defaults to false.
*/
attribute boolean withCredentials;
/**
* Initialize the object for use from C++ code with the principal, script
* context, and owner window that should be used.
*
* @param principal The principal to use for the request. This must not be
* null.
* @param globalObject The associated global for the request. Can be the
* outer window, a sandbox, or a backstage pass.
* May be null, but then the request cannot create a
* document.
* @param baseURI The base URI to use when resolving relative URIs. May be
* null.
* @param loadGroup An optional load group to use when performing the request.
* This will be used even if the global has a window with a
* load group.
*/
[noscript] void init(in nsIPrincipal principal,
in nsIGlobalObject globalObject,
in nsIURI baseURI,
[optional] in nsILoadGroup loadGroup);
/**
* Upload process can be tracked by adding event listener to |upload|.
*/
readonly attribute nsIXMLHttpRequestUpload upload;
/**
* If true, the request will be sent without cookie and authentication
* headers.
*/
readonly attribute boolean mozAnon;
/**
* If true, the same origin policy will not be enforced on the request.
*/
readonly attribute boolean mozSystem;
};
[uuid(840d0d00-e83e-4a29-b3c7-67e96e90a499)]
interface nsIXHRSendable : nsISupports {
// 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
void getSendInfo(out nsIInputStream body,
out uint64_t contentLength,
out ACString contentTypeWithCharset,
out ACString charset);
};
%{ C++
#define NS_XMLHTTPREQUEST_CID \
{ /* d164e770-4157-11d4-9a42-000064657374 */ \
0xd164e770, 0x4157, 0x11d4, \
{0x9a, 0x42, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74} }
#define NS_XMLHTTPREQUEST_CONTRACTID \
"@mozilla.org/xmlextras/xmlhttprequest;1"
%}

View File

@@ -62,7 +62,6 @@
#include "txNodeSetAdaptor.h" #include "txNodeSetAdaptor.h"
#include "mozilla/dom/DOMParser.h" #include "mozilla/dom/DOMParser.h"
#include "mozilla/dom/XMLHttpRequestMainThread.h"
#include "nsDOMSerializer.h" #include "nsDOMSerializer.h"
// view stuff // view stuff
@@ -224,7 +223,6 @@ already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
// Factory Constructor // Factory Constructor
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(XMLHttpRequestMainThread, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(FormData) NS_GENERIC_FACTORY_CONSTRUCTOR(FormData)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHostObjectURI) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHostObjectURI)
NS_GENERIC_FACTORY_CONSTRUCTOR(DOMParser) NS_GENERIC_FACTORY_CONSTRUCTOR(DOMParser)
@@ -595,7 +593,6 @@ NS_DEFINE_NAMED_CID(TRANSFORMIIX_NODESET_CID);
NS_DEFINE_NAMED_CID(NS_XMLSERIALIZER_CID); NS_DEFINE_NAMED_CID(NS_XMLSERIALIZER_CID);
NS_DEFINE_NAMED_CID(NS_FORMDATA_CID); NS_DEFINE_NAMED_CID(NS_FORMDATA_CID);
NS_DEFINE_NAMED_CID(NS_HOSTOBJECTURI_CID); NS_DEFINE_NAMED_CID(NS_HOSTOBJECTURI_CID);
NS_DEFINE_NAMED_CID(NS_XMLHTTPREQUEST_CID);
NS_DEFINE_NAMED_CID(NS_DOMPARSER_CID); NS_DEFINE_NAMED_CID(NS_DOMPARSER_CID);
NS_DEFINE_NAMED_CID(NS_DOMSESSIONSTORAGEMANAGER_CID); NS_DEFINE_NAMED_CID(NS_DOMSESSIONSTORAGEMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_DOMLOCALSTORAGEMANAGER_CID); NS_DEFINE_NAMED_CID(NS_DOMLOCALSTORAGEMANAGER_CID);
@@ -845,7 +842,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kNS_XMLSERIALIZER_CID, false, nullptr, nsDOMSerializerConstructor }, { &kNS_XMLSERIALIZER_CID, false, nullptr, nsDOMSerializerConstructor },
{ &kNS_FORMDATA_CID, false, nullptr, FormDataConstructor }, { &kNS_FORMDATA_CID, false, nullptr, FormDataConstructor },
{ &kNS_HOSTOBJECTURI_CID, false, nullptr, nsHostObjectURIConstructor }, { &kNS_HOSTOBJECTURI_CID, false, nullptr, nsHostObjectURIConstructor },
{ &kNS_XMLHTTPREQUEST_CID, false, nullptr, XMLHttpRequestMainThreadConstructor },
{ &kNS_DOMPARSER_CID, false, nullptr, DOMParserConstructor }, { &kNS_DOMPARSER_CID, false, nullptr, DOMParserConstructor },
{ &kNS_DOMSESSIONSTORAGEMANAGER_CID, false, nullptr, SessionStorageManagerConstructor }, { &kNS_DOMSESSIONSTORAGEMANAGER_CID, false, nullptr, SessionStorageManagerConstructor },
{ &kNS_DOMLOCALSTORAGEMANAGER_CID, false, nullptr, LocalStorageManagerConstructor }, { &kNS_DOMLOCALSTORAGEMANAGER_CID, false, nullptr, LocalStorageManagerConstructor },
@@ -960,7 +956,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
{ TRANSFORMIIX_NODESET_CONTRACTID, &kTRANSFORMIIX_NODESET_CID }, { TRANSFORMIIX_NODESET_CONTRACTID, &kTRANSFORMIIX_NODESET_CID },
{ NS_XMLSERIALIZER_CONTRACTID, &kNS_XMLSERIALIZER_CID }, { NS_XMLSERIALIZER_CONTRACTID, &kNS_XMLSERIALIZER_CID },
{ NS_FORMDATA_CONTRACTID, &kNS_FORMDATA_CID }, { NS_FORMDATA_CONTRACTID, &kNS_FORMDATA_CID },
{ NS_XMLHTTPREQUEST_CONTRACTID, &kNS_XMLHTTPREQUEST_CID },
{ NS_DOMPARSER_CONTRACTID, &kNS_DOMPARSER_CID }, { NS_DOMPARSER_CONTRACTID, &kNS_DOMPARSER_CID },
{ "@mozilla.org/dom/localStorage-manager;1", &kNS_DOMLOCALSTORAGEMANAGER_CID }, { "@mozilla.org/dom/localStorage-manager;1", &kNS_DOMLOCALSTORAGEMANAGER_CID },
// Keeping the old ContractID for backward compatibility // Keeping the old ContractID for backward compatibility

View File

@@ -59,7 +59,6 @@
#include "nsISelection.h" #include "nsISelection.h"
#include "nsITreeBoxObject.h" #include "nsITreeBoxObject.h"
#include "nsIWebBrowserPersistable.h" #include "nsIWebBrowserPersistable.h"
#include "nsIXMLHttpRequest.h"
#include "mozilla/dom/CanvasRenderingContext2DBinding.h" #include "mozilla/dom/CanvasRenderingContext2DBinding.h"
#include "mozilla/dom/CharacterDataBinding.h" #include "mozilla/dom/CharacterDataBinding.h"
@@ -127,8 +126,6 @@
#include "mozilla/dom/UIEventBinding.h" #include "mozilla/dom/UIEventBinding.h"
#include "mozilla/dom/WheelEventBinding.h" #include "mozilla/dom/WheelEventBinding.h"
#include "mozilla/dom/XMLDocumentBinding.h" #include "mozilla/dom/XMLDocumentBinding.h"
#include "mozilla/dom/XMLHttpRequestEventTargetBinding.h"
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
#include "mozilla/dom/XMLSerializerBinding.h" #include "mozilla/dom/XMLSerializerBinding.h"
#include "mozilla/dom/XULCommandEventBinding.h" #include "mozilla/dom/XULCommandEventBinding.h"
#include "mozilla/dom/XULDocumentBinding.h" #include "mozilla/dom/XULDocumentBinding.h"
@@ -238,8 +235,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIWebBrowserPersistable, FrameLoader), DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIWebBrowserPersistable, FrameLoader),
DEFINE_SHIM(WheelEvent), DEFINE_SHIM(WheelEvent),
DEFINE_SHIM(XMLDocument), DEFINE_SHIM(XMLDocument),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIXMLHttpRequestEventTarget, XMLHttpRequestEventTarget),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIXMLHttpRequestUpload, XMLHttpRequestUpload),
DEFINE_SHIM(XULCommandEvent), DEFINE_SHIM(XULCommandEvent),
DEFINE_SHIM(XULElement), DEFINE_SHIM(XULElement),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsISelection, Selection), DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsISelection, Selection),