Bug 845631 - Remove nsXMLHttpProgressEvent, r=sicking

--HG--
extra : rebase_source : e5c6e80fbb656782bfe0f530c778cda9d9f97f0f
This commit is contained in:
Olli Pettay 2013-02-28 20:53:04 +02:00
Родитель 1a000924e5
Коммит e594545631
15 изменённых файлов: 11 добавлений и 220 удалений

Просмотреть файл

@ -212,7 +212,6 @@
@BINPATH@/components/dom_xbl.xpt
@BINPATH@/components/dom_xpath.xpt
@BINPATH@/components/dom_xul.xpt
@BINPATH@/components/dom_loadsave.xpt
@BINPATH@/components/dom_time.xpt
@BINPATH@/components/downloads.xpt
@BINPATH@/components/editor.xpt

Просмотреть файл

@ -211,7 +211,6 @@
@BINPATH@/components/dom_xbl.xpt
@BINPATH@/components/dom_xpath.xpt
@BINPATH@/components/dom_xul.xpt
@BINPATH@/components/dom_loadsave.xpt
@BINPATH@/components/downloads.xpt
@BINPATH@/components/editor.xpt
@BINPATH@/components/embed_base.xpt

Просмотреть файл

@ -19,8 +19,6 @@ DEPRECATED_OPERATION(OwnerElement)
DEPRECATED_OPERATION(NodeValue)
DEPRECATED_OPERATION(TextContent)
DEPRECATED_OPERATION(EnablePrivilege)
DEPRECATED_OPERATION(Position)
DEPRECATED_OPERATION(TotalSize)
DEPRECATED_OPERATION(InputEncoding)
DEPRECATED_OPERATION(MozBeforePaint)
DEPRECATED_OPERATION(DOMExceptionCode)

Просмотреть файл

@ -387,7 +387,6 @@ nsXMLHttpRequest::nsXMLHttpRequest()
mRequestObserver(nullptr), mState(XML_HTTP_REQUEST_UNSENT),
mUploadTransferred(0), mUploadTotal(0), mUploadComplete(true),
mProgressSinceLastProgressEvent(false),
mUploadProgress(0), mUploadProgressMax(0),
mRequestSentTime(0), mTimeoutMilliseconds(0),
mErrorLoad(false), mWaitingForOnStopRequest(false),
mProgressTimerIsActive(false), mProgressEventWasDelayed(false),
@ -1544,10 +1543,8 @@ nsXMLHttpRequest::CreateReadystatechangeEvent(nsIDOMEvent** aDOMEvent)
void
nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
const nsAString& aType,
bool aUseLSEventWrapper,
bool aLengthComputable,
uint64_t aLoaded, uint64_t aTotal,
uint64_t aPosition, uint64_t aTotalSize)
uint64_t aLoaded, uint64_t aTotal)
{
NS_ASSERTION(aTarget, "null target");
NS_ASSERTION(!aType.IsEmpty(), "missing event type");
@ -1558,9 +1555,9 @@ nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
}
bool dispatchLoadend = aType.EqualsLiteral(LOAD_STR) ||
aType.EqualsLiteral(ERROR_STR) ||
aType.EqualsLiteral(TIMEOUT_STR) ||
aType.EqualsLiteral(ABORT_STR);
aType.EqualsLiteral(ERROR_STR) ||
aType.EqualsLiteral(TIMEOUT_STR) ||
aType.EqualsLiteral(ABORT_STR);
nsCOMPtr<nsIDOMEvent> event;
nsresult rv = NS_NewDOMProgressEvent(getter_AddRefs(event),
@ -1579,17 +1576,11 @@ nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
event->SetTrusted(true);
if (aUseLSEventWrapper) {
nsCOMPtr<nsIDOMProgressEvent> xhrprogressEvent =
new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize, GetOwner());
event = xhrprogressEvent;
}
aTarget->DispatchDOMEvent(nullptr, event, nullptr, nullptr);
if (dispatchLoadend) {
DispatchProgressEvent(aTarget, NS_LITERAL_STRING(LOADEND_STR),
aUseLSEventWrapper, aLengthComputable,
aLoaded, aTotal, aPosition, aTotalSize);
aLengthComputable, aLoaded, aTotal);
}
}
@ -2809,8 +2800,6 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
mErrorLoad = false;
mLoadLengthComputable = false;
mLoadTotal = 0;
mUploadProgress = 0;
mUploadProgressMax = 0;
if ((aVariant || !aBody.IsNull()) && httpChannel &&
!method.EqualsLiteral("GET")) {
@ -3647,13 +3636,11 @@ nsXMLHttpRequest::MaybeDispatchProgressEvents(bool aFinalProgress)
if ((XML_HTTP_REQUEST_OPENED | XML_HTTP_REQUEST_SENT) & mState) {
if (aFinalProgress) {
mUploadTotal = mUploadTransferred;
mUploadProgressMax = mUploadProgress;
}
if (mUpload && !mUploadComplete) {
DispatchProgressEvent(mUpload, NS_LITERAL_STRING(PROGRESS_STR),
true, mUploadLengthComputable, mUploadTransferred,
mUploadTotal, mUploadProgress,
mUploadProgressMax);
mUploadLengthComputable, mUploadTransferred,
mUploadTotal);
}
} else {
if (aFinalProgress) {
@ -3661,8 +3648,8 @@ nsXMLHttpRequest::MaybeDispatchProgressEvents(bool aFinalProgress)
}
mInLoadProgressEvent = true;
DispatchProgressEvent(this, NS_LITERAL_STRING(PROGRESS_STR),
true, mLoadLengthComputable, mLoadTransferred,
mLoadTotal, mLoadTransferred, mLoadTotal);
mLoadLengthComputable, mLoadTransferred,
mLoadTotal);
mInLoadProgressEvent = false;
if (mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT ||
mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER) {
@ -3701,8 +3688,6 @@ nsXMLHttpRequest::OnProgress(nsIRequest *aRequest, nsISupports *aContext, uint64
}
mUploadLengthComputable = lengthComputable;
mUploadTransferred = loaded;
mUploadProgress = aProgress;
mUploadProgressMax = aProgressMax;
mProgressSinceLastProgressEvent = true;
MaybeDispatchProgressEvents(false);
@ -4009,81 +3994,6 @@ nsHeaderVisitor::VisitHeader(const nsACString &header, const nsACString &value)
return NS_OK;
}
// DOM event class to handle progress notifications
nsXMLHttpProgressEvent::nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
uint64_t aCurrentProgress,
uint64_t aMaxProgress,
nsPIDOMWindow* aWindow)
: mWindow(aWindow)
{
mInner = aInner;
mCurProgress = aCurrentProgress;
mMaxProgress = aMaxProgress;
}
nsXMLHttpProgressEvent::~nsXMLHttpProgressEvent()
{}
DOMCI_DATA(XMLHttpProgressEvent, nsXMLHttpProgressEvent)
// QueryInterface implementation for nsXMLHttpProgressEvent
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLHttpProgressEvent)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMProgressEvent)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEvent, nsIDOMProgressEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMProgressEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMLSProgressEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XMLHttpProgressEvent)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mInner);
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput)
{
*aInput = nullptr;
return NS_ERROR_NOT_IMPLEMENTED;
}
void
nsXMLHttpProgressEvent::WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations aOperation)
{
if (!mWindow) {
return;
}
nsCOMPtr<nsIDocument> document =
do_QueryInterface(mWindow->GetExtantDocument());
if (!document) {
return;
}
document->WarnOnceAbout(aOperation);
}
NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(uint32_t *aPosition)
{
WarnAboutLSProgressEvent(nsIDocument::ePosition);
// XXX can we change the iface?
*aPosition = uint32_t(mCurProgress);
return NS_OK;
}
NS_IMETHODIMP nsXMLHttpProgressEvent::GetTotalSize(uint32_t *aTotalSize)
{
WarnAboutLSProgressEvent(nsIDocument::eTotalSize);
// XXX can we change the iface?
*aTotalSize = uint32_t(mMaxProgress);
return NS_OK;
}
// nsXMLHttpRequestXPCOMifier implementation
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLHttpRequestXPCOMifier)
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)

Просмотреть файл

@ -26,7 +26,6 @@
#include "nsCOMArray.h"
#include "nsJSUtils.h"
#include "nsTArray.h"
#include "nsIDOMLSProgressEvent.h"
#include "nsITimer.h"
#include "nsIDOMProgressEvent.h"
#include "nsDOMEventTargetHelper.h"
@ -450,29 +449,10 @@ public:
// This creates a trusted readystatechange event, which is not cancelable and
// doesn't bubble.
static nsresult CreateReadystatechangeEvent(nsIDOMEvent** aDOMEvent);
// For backwards compatibility aPosition should contain the headers for upload
// and aTotalSize is UINT64_MAX when unknown. Both those values are
// used by nsXMLHttpProgressEvent. Normal progress event should not use
// headers in aLoaded and aTotal is 0 when unknown.
void DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
const nsAString& aType,
// Whether to use nsXMLHttpProgressEvent,
// which implements LS Progress Event.
bool aUseLSEventWrapper,
bool aLengthComputable,
// For Progress Events
uint64_t aLoaded, uint64_t aTotal,
// For LS Progress Events
uint64_t aPosition, uint64_t aTotalSize);
void DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
const nsAString& aType,
bool aLengthComputable,
uint64_t aLoaded, uint64_t aTotal)
{
DispatchProgressEvent(aTarget, aType, false,
aLengthComputable, aLoaded, aTotal,
aLoaded, aLengthComputable ? aTotal : UINT64_MAX);
}
uint64_t aLoaded, uint64_t aTotal);
// Dispatch the "progress" event on the XHR or XHR.upload object if we've
// received data since the last "progress" event. Also dispatches
@ -641,8 +621,6 @@ protected:
bool mUploadLengthComputable;
bool mUploadComplete;
bool mProgressSinceLastProgressEvent;
uint64_t mUploadProgress; // For legacy
uint64_t mUploadProgressMax; // For legacy
// Timeout support
PRTime mRequestSentTime;
@ -737,33 +715,6 @@ private:
nsRefPtr<nsXMLHttpRequest> mXHR;
};
// helper class to expose a progress DOM Event
class nsXMLHttpProgressEvent : public nsIDOMProgressEvent,
public nsIDOMLSProgressEvent
{
public:
nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
uint64_t aCurrentProgress,
uint64_t aMaxProgress,
nsPIDOMWindow* aWindow);
virtual ~nsXMLHttpProgressEvent();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXMLHttpProgressEvent, nsIDOMProgressEvent)
NS_FORWARD_NSIDOMEVENT(mInner->)
NS_FORWARD_NSIDOMPROGRESSEVENT(mInner->)
NS_DECL_NSIDOMLSPROGRESSEVENT
protected:
void WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations);
nsCOMPtr<nsIDOMProgressEvent> mInner;
nsCOMPtr<nsPIDOMWindow> mWindow;
uint64_t mCurProgress;
uint64_t mMaxProgress;
};
class nsXHRParseEndListener : public nsIDOMEventListener
{
public:

Просмотреть файл

@ -157,7 +157,6 @@
#include "nsIXSLTProcessor.h"
#include "nsIXSLTProcessorPrivate.h"
#include "nsIDOMLSProgressEvent.h"
#include "nsXMLHttpRequest.h"
#include "nsIDOMSettingsManager.h"
#include "nsIDOMContactManager.h"
@ -202,7 +201,6 @@
#include "nsIDOMTimeRanges.h"
#include "nsIDOMHTMLVideoElement.h"
#include "nsIDOMHTMLAudioElement.h"
#include "nsIDOMProgressEvent.h"
#include "nsIDOMCSSCharsetRule.h"
#include "nsIDOMCSSImportRule.h"
#include "nsIDOMCSSMediaRule.h"
@ -929,9 +927,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(StorageItem, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(XMLHttpProgressEvent, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(ClientRect, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -2498,12 +2493,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMToString)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(XMLHttpProgressEvent, nsIDOMEvent)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLSProgressEvent)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMProgressEvent)
DOM_CLASSINFO_EVENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(XULCommandEvent, nsIDOMXULCommandEvent)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULCommandEvent)
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES

Просмотреть файл

@ -179,9 +179,6 @@ DOMCI_CLASS(StorageObsolete)
DOMCI_CLASS(Storage)
DOMCI_CLASS(StorageItem)
// XMLHttpRequest
DOMCI_CLASS(XMLHttpProgressEvent)
DOMCI_CLASS(ClientRect)
DOMCI_CLASS(XULCommandEvent)

Просмотреть файл

@ -1,24 +0,0 @@
# 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/.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = dom
XPIDL_MODULE = dom_loadsave
XPIDLSRCS = \
nsIDOMLSProgressEvent.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk
XPIDL_FLAGS += \
-I$(topsrcdir)/dom/interfaces/base \
-I$(topsrcdir)/dom/interfaces/events \
$(NULL)

Просмотреть файл

@ -1,5 +0,0 @@
# vim: set filetype=python:
# 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/.

Просмотреть файл

@ -1,16 +0,0 @@
/* -*- Mode: IDL; 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 "nsIDOMEvent.idl"
interface nsIDOMLSInput;
[scriptable, builtinclass, uuid(5343c259-78c1-4f20-a81f-5ddce4f0188e)]
interface nsIDOMLSProgressEvent : nsIDOMEvent
{
readonly attribute nsIDOMLSInput input;
readonly attribute unsigned long position;
readonly attribute unsigned long totalSize;
};

Просмотреть файл

@ -60,8 +60,6 @@ OwnerElementWarning=Use of attributes' ownerElement attribute is deprecated.
NodeValueWarning=Use of attributes' nodeValue attribute is deprecated. Use value instead.
TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead.
EnablePrivilegeWarning=Use of enablePrivilege is deprecated. Please use code that runs with the system principal (e.g. an extension) instead.
PositionWarning=Use of XMLHttpRequest's progress events' position attribute is deprecated.
TotalSizeWarning=Use of XMLHttpRequest's progress events' totalSize attribute is deprecated.
nsIJSONDecodeDeprecatedWarning=nsIJSON.decode is deprecated. Please use JSON.parse instead.
nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.stringify instead.
nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow instead.

Просмотреть файл

@ -19,7 +19,6 @@ interfaces = [
'range',
'xbl',
'xpath',
'load-save',
'xul',
'storage',
'json',

Просмотреть файл

@ -147,8 +147,6 @@ members = [
# dom/interfaces/json - None.
# All methods of nsIJSON call GetCurrentNativeCallContext.
# dom/interfaces/load-save - None.
# dom/interfaces/offline - None.
# dom/interfaces/range

Просмотреть файл

@ -142,7 +142,6 @@
@BINPATH@/components/dom_xbl.xpt
@BINPATH@/components/dom_xpath.xpt
@BINPATH@/components/dom_xul.xpt
@BINPATH@/components/dom_loadsave.xpt
@BINPATH@/components/downloads.xpt
@BINPATH@/components/editor.xpt
@BINPATH@/components/embed_base.xpt

Просмотреть файл

@ -191,7 +191,6 @@
@BINPATH@/components/dom_xbl.xpt
@BINPATH@/components/dom_xpath.xpt
@BINPATH@/components/dom_xul.xpt
@BINPATH@/components/dom_loadsave.xpt
@BINPATH@/components/downloads.xpt
@BINPATH@/components/editor.xpt
@BINPATH@/components/embed_base.xpt