Backed out changeset 8c4dcbaa44b9 (bug 1321525) for failing test_fileapi.html and test_fileReader.html. r=backout on a CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 01 Dec 2016 17:19:12 +0100
changeset 325029 1464a199a2a568b8a9259dba6fe7933833254517
parent 325028 dd01d903f823c089789b30c7f95d4da80e5e6162
child 325030 d727d297aeeee2e9e490b4285d365d35f9323c8e
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersbackout
bugs1321525
milestone53.0a1
backs out8c4dcbaa44b92fe8248c8aac2c6191c15fc91b1d
Backed out changeset 8c4dcbaa44b9 (bug 1321525) for failing test_fileapi.html and test_fileReader.html. r=backout on a CLOSED TREE
dom/file/FileReader.cpp
dom/file/tests/test_fileapi.html
testing/web-platform/meta/FileAPI/reading-data-section/FileReader-multiple-reads.html.ini
--- a/dom/file/FileReader.cpp
+++ b/dom/file/FileReader.cpp
@@ -344,28 +344,31 @@ FileReader::DoReadData(uint64_t aCount)
 // Helper methods
 
 void
 FileReader::ReadFileContent(Blob& aBlob,
                             const nsAString &aCharset,
                             eDataFormat aDataFormat,
                             ErrorResult& aRv)
 {
+  //Implicit abort to clear any other activity going on
+  ErrorResult error;
+  Abort(error);
+  error.SuppressException();
+
   if (mReadyState == LOADING) {
-    aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
+    // 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);
-  mResultArrayBuffer = nullptr;
-
-  mAsyncStream = nullptr;
-
   mTransferred = 0;
   mTotal = 0;
   mReadyState = EMPTY;
   FreeFileData();
 
   mBlob = &aBlob;
   mDataFormat = aDataFormat;
   CopyUTF16toUTF8(aCharset, mCharset);
--- a/dom/file/tests/test_fileapi.html
+++ b/dom/file/tests/test_fileapi.html
@@ -351,36 +351,28 @@ function onFilesOpened(message) {
   r = new FileReader();
   r.onabort = function (event) {
     is(reuseAbortHasRun, false, "abort should only fire once");
     reuseAbortHasRun = true;
     is(event.target.readyState, FileReader.DONE, "should be DONE while firing onabort");
     is(event.target.error.name, "AbortError", "error set to AbortError for aborted reads");
     is(event.target.result, null, "file data should be null on aborted reads");
   }
-  r.onload = function() { ok(false, "load should fire for nested reads"); }'
-
+  r.onload = function() { ok(false, "load should not fire for aborted reads") };
   var abortThrew = false;
   try {
     r.abort();
   } catch(e) {
     abortThrew = true;
   }
   is(abortThrew, true, "abort() must throw if not loading");
   is(reuseAbortHasRun, false, "abort() is a no-op unless loading");
   r.readAsText(asciiFile);
-
-  var readThrew = false;
-  try {
-    r.readAsText(asciiFile);
-  } catch(e) {
-    readThrew = true;
-  }
-  is(readThrew, true, "readAsText() must throw if loading");
-  is(reuseAbortHasRun, false, "abort should not fire");
+  r.readAsText(asciiFile);
+  is(reuseAbortHasRun, true, "abort should fire sync");
   r.onload = getLoadHandler(testASCIIData, testASCIIData.length, "reuse-as-abort reading");
   expectedTestCount++;
 
 
   // Test reading from nonexistent files
   r = new FileReader();
   var didThrow = false;
   r.onerror = function (event) {
--- a/testing/web-platform/meta/FileAPI/reading-data-section/FileReader-multiple-reads.html.ini
+++ b/testing/web-platform/meta/FileAPI/reading-data-section/FileReader-multiple-reads.html.ini
@@ -1,5 +1,17 @@
 [FileReader-multiple-reads.html]
   type: testharness
+  [test FileReader InvalidStateError exception for readAsText]
+    expected: FAIL
+
+  [test FileReader InvalidStateError exception for readAsDataURL]
+    expected: FAIL
+
+  [test FileReader InvalidStateError exception for readAsArrayBuffer]
+    expected: FAIL
+
+  [test FileReader InvalidStateError exception in onloadstart event for readAsArrayBuffer]
+    expected: FAIL
+
   [test FileReader no InvalidStateError exception in onloadstart event for readAsArrayBuffer]
     expected: FAIL