Bug 662403: Fix reftest-analyzer and leak-gauge to not use removed nsIDOMFile methods. r=bz
authorKyle Huey <khuey@kylehuey.com>
Tue, 07 Jun 2011 10:03:02 -0700
changeset 70693 33fd438b74ad48c3c3d8890dc1f2de80321b27b9
parent 70692 17dacc2cf5ae987e130ad27066a81818f028ae56
child 70694 827d5938a23e17a10dea35ef6227656b7a2ee692
push id1
push userpweitershausen@mozilla.com
push dateWed, 08 Jun 2011 16:12:33 +0000
treeherdermozilla-inbound@a58cdcdcac5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs662403
milestone7.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 662403: Fix reftest-analyzer and leak-gauge to not use removed nsIDOMFile methods. r=bz DONTBUILD
layout/tools/reftest/reftest-analyzer.xhtml
tools/footprint/leak-gauge.html
--- a/layout/tools/reftest/reftest-analyzer.xhtml
+++ b/layout/tools/reftest/reftest-analyzer.xhtml
@@ -186,33 +186,38 @@ function show_phase(phaseid) {
   if (phase == "viewer")
     ID("images").style.display = "none";
 }
 
 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() {
   show_phase("loading");
   var entry = ID("logentry");
   var log = entry.value;
   entry.value = "";
   process_log(log);
--- a/tools/footprint/leak-gauge.html
+++ b/tools/footprint/leak-gauge.html
@@ -43,17 +43,28 @@
 <title>Leak Gauge</title>
 
 <style type="text/css">
 pre { margin: 0; }
 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.
     var handlers = {
         "DOMWINDOW": {
             count: 0,
             windows: {},
             handle_line: function(line) {
@@ -231,19 +242,16 @@ function runfile(file) {
                 for (var w in this.nims)
                     ++len;
                 result += 'Leaked content nodes in ' + len + ' out of ' +
                           this.count + " documents\n";
             }
         }
     };
 
-    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];
         // strip off initial "-", thread id, and thread pointer; separate
         // first word and rest
         var matches = line.match(/^\-?[0-9]*\[[0-9a-f]*\]: (\S*) (.*)$/);
         if (matches) {
             var handler = matches[1];