Bug 662403: Fix reftest-analyzer and leak-gauge to not use removed nsIDOMFile methods. r=bz

DONTBUILD
This commit is contained in:
Kyle Huey 2011-06-07 10:03:02 -07:00
parent 4193a686a0
commit 090fb7c81d
2 changed files with 24 additions and 11 deletions

View File

@ -191,23 +191,28 @@ function fileentry_changed() {
show_phase("loading");
var input = ID("fileentry");
var files = input.files;
var log = null;
if (files.length > 0) {
// Only handle the first file; don't handle multiple selection.
// The parts of the log we care about are ASCII-only. Since we
// can ignore lines we don't care about, best to read in as
// iso-8859-1, which guarantees we don't get decoding errors.
log = files[0].getAsText("iso-8859-1");
var fileReader = new FileReader();
fileReader.onload = function(e) {
var log = null;
log = e.target.result;
if (log)
process_log(log);
else
show_phase("entry");
}
fileReader.readAsText(files[0], "iso-8859-1");
}
// So the user can process the same filename again (after
// overwriting the log), clear the value on the form input so we
// will always get an onchange event.
input.value = "";
if (log)
process_log(log);
else
show_phase("entry");
}
function log_pasted() {

View File

@ -48,7 +48,18 @@ pre.output { border: medium solid; padding: 1em; margin: 1em; }
</style>
<script type="text/javascript">
function runfile(file) {
function runFile(file) {
var result = "Results of processing log " + file.fileName + " :\n";
var fileReader = new FileReader();
fileReader.onload = function(e)
{
runContents(result, e.target.result);
}
fileReader.readAsText(file, "iso-8859-1");
}
function runContents(result, contents) {
// A hash of objects (keyed by the first word of the line in the log)
// that have two public methods, handle_line and dump (to be called using
// call, above), along with any private data they need.
@ -236,9 +247,6 @@ function runfile(file) {
}
};
var result = "Results of processing log " + file.fileName + " :\n";
var contents = file.getAsText("iso-8859-1");
var lines = contents.split(/[\r\n]+/);
for (var j in lines) {
var line = lines[j];