Backed out changeset 3421c306d8cf (bug 1311798) for failing event-readystatechange-loaded.htm and unexpected passes. r=backout

This commit is contained in:
Sebastian Hengst 2016-11-20 21:39:59 +01:00
Родитель fcc3c463e9
Коммит 0718e6147b
4 изменённых файлов: 6 добавлений и 82 удалений

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

@ -1064,75 +1064,10 @@ XMLHttpRequestMainThread::CloseRequestWithError(const ProgressEventType aType)
}
void
XMLHttpRequestMainThread::RequestErrorSteps(const ProgressEventType aEventType,
const nsresult aOptionalException,
ErrorResult& aRv)
{
// Step 1
mState = State::done;
StopProgressEventTimer();
// Step 2
mFlagSend = false;
// Step 3
ResetResponse();
// If we're in the destructor, don't risk dispatching an event.
if (mFlagDeleted) {
mFlagSyncLooping = false;
return;
}
// Step 4
if (mFlagSynchronous && NS_FAILED(aOptionalException)) {
aRv.Throw(aOptionalException);
return;
}
// Step 5
FireReadystatechangeEvent();
// Step 6
if (mUpload && !mUploadComplete) {
// Step 6-1
mUploadComplete = true;
// Step 6-2
if (mFlagHadUploadListenersOnSend) {
// Steps 6-3, 6-4 (loadend is fired for us)
DispatchProgressEvent(mUpload, aEventType, 0, -1);
}
}
// Steps 7 and 8 (loadend is fired for us)
DispatchProgressEvent(this, aEventType, 0, -1);
}
void
XMLHttpRequestMainThread::Abort(ErrorResult& aRv)
XMLHttpRequestMainThread::Abort(ErrorResult& arv)
{
mFlagAborted = true;
// Step 1
CloseRequest();
// Step 2
if ((mState == State::opened && mFlagSend) ||
mState == State::headers_received ||
mState == State::loading) {
RequestErrorSteps(ProgressEventType::abort, NS_OK, aRv);
}
// Step 3
if (mState == State::done) {
ChangeState(State::unsent, false); // no ReadystateChange event
}
mFlagSyncLooping = false;
CloseRequestWithError(ProgressEventType::abort);
}
NS_IMETHODIMP

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

@ -395,11 +395,6 @@ public:
aRv = SendInternal(&body);
}
void
RequestErrorSteps(const ProgressEventType aEventType,
const nsresult aOptionalException,
ErrorResult& aRv);
void
Abort() {
ErrorResult rv;

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

@ -1669,9 +1669,7 @@ XMLHttpRequestWorker::MaybeDispatchPrematureAbortEvents(ErrorResult& aRv)
// Only send readystatechange event when state changed.
bool isStateChanged = false;
if ((mStateData.mReadyState == 1 && mStateData.mFlagSend) ||
mStateData.mReadyState == 2 ||
mStateData.mReadyState == 3) {
if (mStateData.mReadyState != 4) {
isStateChanged = true;
mStateData.mReadyState = 4;
}
@ -1813,8 +1811,6 @@ XMLHttpRequestWorker::SendInternal(SendRunnable* aRunnable,
aRunnable->SetSyncLoopTarget(syncLoopTarget);
aRunnable->SetHaveUploadListeners(hasUploadListeners);
mStateData.mFlagSend = true;
aRunnable->Dispatch(aRv);
if (aRv.Failed()) {
// Dispatch() may have spun the event loop and we may have already unrooted.
@ -1841,7 +1837,6 @@ XMLHttpRequestWorker::SendInternal(SendRunnable* aRunnable,
if (!autoSyncLoop->Run() && !aRv.Failed()) {
aRv.Throw(NS_ERROR_FAILURE);
}
mStateData.mFlagSend = false;
}
bool

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

@ -33,16 +33,15 @@ public:
uint32_t mStatus;
nsCString mStatusText;
uint16_t mReadyState;
bool mFlagSend;
JS::Heap<JS::Value> mResponse;
nsresult mResponseTextResult;
nsresult mStatusResult;
nsresult mResponseResult;
StateData()
: mStatus(0), mReadyState(0), mFlagSend(false),
mResponse(JS::UndefinedValue()), mResponseTextResult(NS_OK),
mStatusResult(NS_OK), mResponseResult(NS_OK)
: mStatus(0), mReadyState(0), mResponse(JS::UndefinedValue()),
mResponseTextResult(NS_OK), mStatusResult(NS_OK),
mResponseResult(NS_OK)
{ }
void trace(JSTracer* trc);