Bug 1230422 - FileReader should handle nested ReadAs*() calls. r=khuey

This commit is contained in:
Andrea Marchesini 2016-01-20 07:55:37 +00:00
parent bbe59f67c6
commit a99bdcd3e8
3 changed files with 37 additions and 0 deletions

View File

@ -365,6 +365,14 @@ FileReader::ReadFileContent(Blob& aBlob,
Abort(error);
error.SuppressException();
if (mReadyState == LOADING) {
// A nested ReadAsSomething() as been called during one of the events
// dispatched by Abort(). We have to terminate this operation in order to
// continue the nested one.
aRv.Throw(NS_ERROR_ABORT);
return;
}
mError = nullptr;
SetDOMStringToNull(mResult);
mTransferred = 0;

View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
var a = new FileReader();
function f() {
a.removeEventListener("loadend", f);
g();
}
function g() {
a.readAsBinaryString(new Blob());
}
a.addEventListener("loadend", f);
try {
g();
g();
} catch(e) {}
</script>
</body>
</html>

View File

@ -205,3 +205,4 @@ load structured_clone_container_throws.html
HTTP(..) load xhr_abortinprogress.html
load xhr_empty_datauri.html
load xhr_html_nullresponse.html
load 1230422.html