Backed out changeset d10fb80f7aa0 (bug 1502403) for build bustages at rules.mk. CLOSED TREE

This commit is contained in:
Butkovits Atila 2020-06-09 17:06:04 +03:00
Родитель ed11539ff5
Коммит 29d7b0825b
6 изменённых файлов: 41 добавлений и 72 удалений

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

@ -84,29 +84,6 @@ class MOZ_RAII FileReaderDecreaseBusyCounter {
~FileReaderDecreaseBusyCounter() { mFileReader->DecreaseBusyCounter(); }
};
class FileReader::AsyncWaitRunnable final : public CancelableRunnable {
public:
explicit AsyncWaitRunnable(FileReader* aReader)
: CancelableRunnable("FileReader::AsyncWaitRunnable"), mReader(aReader) {}
NS_IMETHOD
Run() override {
if (mReader) {
mReader->InitialAsyncWait();
}
return NS_OK;
}
NS_IMETHOD
Cancel() override {
mReader = nullptr;
return NS_OK;
}
public:
RefPtr<FileReader> mReader;
};
void FileReader::RootResultArrayBuffer() { mozilla::HoldJSObjects(this); }
// FileReader constructors/initializers
@ -179,7 +156,7 @@ void FileReader::GetResult(JSContext* aCx,
return;
}
if (mReadyState != DONE || mResult.IsVoid()) {
if (mResult.IsVoid()) {
aResult.SetNull();
return;
}
@ -423,8 +400,7 @@ void FileReader::ReadFileContent(Blob& aBlob, const nsAString& aCharset,
}
}
mAsyncWaitRunnable = new AsyncWaitRunnable(this);
aRv = NS_DispatchToCurrentThread(mAsyncWaitRunnable);
aRv = DoAsyncWait();
if (NS_WARN_IF(aRv.Failed())) {
FreeFileData();
return;
@ -432,18 +408,6 @@ void FileReader::ReadFileContent(Blob& aBlob, const nsAString& aCharset,
// FileReader should be in loading state here
mReadyState = LOADING;
}
void FileReader::InitialAsyncWait() {
mAsyncWaitRunnable = nullptr;
nsresult rv = DoAsyncWait();
if (NS_WARN_IF(NS_FAILED(rv))) {
mReadyState = EMPTY;
FreeFileData();
return;
}
DispatchProgressEvent(NS_LITERAL_STRING(LOADSTART_STR));
}
@ -730,11 +694,6 @@ void FileReader::Abort() {
ClearProgressEventTimer();
if (mAsyncWaitRunnable) {
mAsyncWaitRunnable->Cancel();
mAsyncWaitRunnable = nullptr;
}
mReadyState = DONE;
// XXX The spec doesn't say this
@ -744,20 +703,6 @@ void FileReader::Abort() {
SetDOMStringToNull(mResult);
mResultArrayBuffer = nullptr;
// If we have the stream and the busy-count is not 0, it means that we are
// waiting for an OnInputStreamReady() call. Let's abort the current
// AsyncWait() calling it again with a nullptr callback. See
// nsIAsyncInputStream.idl.
if (mAsyncStream && mBusyCount) {
mAsyncStream->AsyncWait(/* callback */ nullptr,
/* aFlags*/ 0,
/* aRequestedCount */ 0, mTarget);
DecreaseBusyCounter();
MOZ_ASSERT(mBusyCount == 0);
mAsyncStream->Close();
}
mAsyncStream = nullptr;
mBlob = nullptr;
@ -767,7 +712,7 @@ void FileReader::Abort() {
// Dispatch the events
DispatchProgressEvent(NS_LITERAL_STRING(ABORT_STR));
DispatchProgressEvent(NS_LITERAL_STRING(LOADEND_STR));
} // namespace dom
}
nsresult FileReader::IncreaseBusyCounter() {
if (mWeakWorkerRef && mBusyCount++ == 0) {
@ -800,11 +745,6 @@ void FileReader::DecreaseBusyCounter() {
void FileReader::Shutdown() {
mReadyState = DONE;
if (mAsyncWaitRunnable) {
mAsyncWaitRunnable->Cancel();
mAsyncWaitRunnable = nullptr;
}
if (mAsyncStream) {
mAsyncStream->Close();
mAsyncStream = nullptr;

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

@ -117,8 +117,6 @@ class FileReader final : public DOMEventTargetHelper,
eDataFormat DataFormat() const { return mDataFormat; }
const nsString& Result() const { return mResult; }
void InitialAsyncWait();
private:
virtual ~FileReader();
@ -193,10 +191,6 @@ class FileReader final : public DOMEventTargetHelper,
// This value is set when the reading starts in order to keep the worker alive
// during the process.
RefPtr<StrongWorkerRef> mStrongWorkerRef;
// Runnable to start the reading asynchronous.
class AsyncWaitRunnable;
RefPtr<AsyncWaitRunnable> mAsyncWaitRunnable;
};
NS_DEFINE_STATIC_IID_ACCESSOR(FileReader, FILEREADER_ID)

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

@ -344,7 +344,7 @@ function test_readAsText(blob, text) {
is(r.readyState, FileReader.LOADING, "correct loading text readyState");
is(onloadHasRun, false, "text loading must be async");
is(onloadStartHasRun, false, "text loadstart should fire async");
is(onloadStartHasRun, true, "text loadstart should fire sync");
});
}
@ -378,7 +378,7 @@ function test_readAsBinaryString(blob, text) {
is(r.readyState, FileReader.LOADING, "correct loading binary readyState");
is(onloadHasRun, false, "binary loading must be async");
is(onloadStartHasRun, false, "binary loadstart should fire async");
is(onloadStartHasRun, true, "binary loadstart should fire sync");
});
}
@ -419,7 +419,7 @@ function test_readAsArrayBuffer(blob, text) {
"correct loading arrayBuffer readyState"
);
is(onloadHasRun, false, "arrayBuffer loading must be async");
is(onloadStartHasRun, false, "arrayBuffer loadstart should fire sync");
is(onloadStartHasRun, true, "arrayBuffer loadstart should fire sync");
});
}

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

@ -0,0 +1,4 @@
[filereader_abort.html]
[Aborting after read]
expected: FAIL

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

@ -0,0 +1,15 @@
[filereader_events.any.html]
[events are dispatched in the correct order for a non-empty blob]
expected: FAIL
[events are dispatched in the correct order for an empty blob]
expected: FAIL
[filereader_events.any.worker.html]
[events are dispatched in the correct order for a non-empty blob]
expected: FAIL
[events are dispatched in the correct order for an empty blob]
expected: FAIL

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

@ -0,0 +1,16 @@
[filereader_result.html]
[result is null during "loadstart" event for readAsBinaryString]
expected: FAIL
[result is null during "loadstart" event for readAsDataURL]
expected: FAIL
[result is null during "progress" event for readAsBinaryString]
expected: FAIL
[result is null during "loadstart" event for readAsArrayBuffer]
expected: FAIL
[result is null during "loadstart" event for readAsText]
expected: FAIL