зеркало из https://github.com/mozilla/gecko-dev.git
Bug 530269: Clear data when reusing a FileReader for multiple reads. r=bz a=jst
This commit is contained in:
Родитель
577f0aea98
Коммит
c32f1419fb
|
@ -483,6 +483,7 @@ nsDOMFileReader::ReadFileContent(nsIDOMFile* aFile,
|
|||
mDataFormat = aDataFormat;
|
||||
mCharset = aCharset;
|
||||
mError = nsnull;
|
||||
SetDOMStringToNull(mResult);
|
||||
|
||||
//Obtain the nsDOMFile's underlying nsIFile
|
||||
nsresult rv;
|
||||
|
|
|
@ -116,6 +116,20 @@ r.readAsText(createFileWithData(convertToUTF32(testTextData)), "UTF-32");
|
|||
expectedTestCount++;
|
||||
|
||||
|
||||
// Test reusing a FileReader to read multiple times
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(testASCIIData, "to-be-reused reading")
|
||||
var makeAnotherReadListener = function(event) {
|
||||
r = event.target;
|
||||
r.removeEventListener("load", makeAnotherReadListener, false);
|
||||
r.onload = getLoadHandler(testBinaryData, "reused reading");
|
||||
r.readAsBinaryString(binaryFile);
|
||||
};
|
||||
r.addEventListener("load", makeAnotherReadListener, false);
|
||||
r.readAsText(asciiFile, "");
|
||||
expectedTestCount += 2;
|
||||
|
||||
|
||||
//Test data-URI encoding on differing file sizes
|
||||
dataurldata = testBinaryData.substr(0, testBinaryData.length -
|
||||
testBinaryData.length % 3);
|
||||
|
|
Загрузка…
Ссылка в новой задаче