Bug 668303 - convert mozillafilelogger to specialpowers. r=ctalbert, a=test-only
authorJoel Maher <jmaher@mozilla.com>
Mon, 18 Jul 2011 22:10:29 -0400
changeset 72959 e437a34e2d6bd8913f793ffde89e781c5dc5c839
parent 72958 b31c7eeec41bde6ceea35cc2727eef12de0a5ee7
child 72960 97e01c543d7099a8dce50d85104db6c0f67dbc8c
push idunknown
push userunknown
push dateunknown
reviewersctalbert, test-only
bugs668303
milestone8.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 668303 - convert mozillafilelogger to specialpowers. r=ctalbert, a=test-only
layout/tools/reftest/jar.mn
layout/tools/reftest/reftest.js
layout/tools/reftest/reftest.xul
testing/mochitest/browser-harness.xul
testing/mochitest/harness-overlay.xul
testing/mochitest/ipc-overlay.xul
testing/mochitest/ipc.js
testing/mochitest/jar.mn
testing/mochitest/server.js
testing/mochitest/specialpowers/components/SpecialPowersObserver.js
testing/mochitest/specialpowers/content/specialpowers.js
testing/mochitest/specialpowers/jar.mn
testing/mochitest/tests/SimpleTest/Makefile.in
testing/mochitest/tests/SimpleTest/MozillaFileLogger.js
testing/mochitest/tests/SimpleTest/MozillaLogger.js
testing/mochitest/tests/SimpleTest/setup.js
testing/mochitest/tests/index.html
--- a/layout/tools/reftest/jar.mn
+++ b/layout/tools/reftest/jar.mn
@@ -1,12 +1,12 @@
 reftest.jar:
 % content reftest %content/
 *  content/quit.js (quit.js)
 *  content/reftest.js (reftest.js)
   content/reftest-content.js (reftest-content.js)
   content/reftest.xul (reftest.xul)
-  content/MozillaFileLogger.js (../../../testing/mochitest/tests/SimpleTest/MozillaFileLogger.js)
+  content/MozillaLogger.js (../../../testing/mochitest/tests/SimpleTest/MozillaLogger.js)
 #ifdef XPI_NAME
 %  component {32530271-8c1b-4b7d-a812-218e42c6bb23} components/reftest-cmdline.js
 %  contract @mozilla.org/commandlinehandler/general-startup;1?type=reftest {32530271-8c1b-4b7d-a812-218e42c6bb23}
 %  category command-line-handler m-reftest @mozilla.org/commandlinehandler/general-startup;1?type=reftest
 #endif
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -259,19 +259,19 @@ function InitAndStartRefTests()
     /* set the gLoadTimeout */
     try {
       var prefs = Components.classes["@mozilla.org/preferences-service;1"].
                   getService(Components.interfaces.nsIPrefBranch2);
       gLoadTimeout = prefs.getIntPref("reftest.timeout");
       logFile = prefs.getCharPref("reftest.logFile");
       if (logFile) {
         try {
-          MozillaFileLogger.init(logFile);
+          var mfl = new MozillaFileLogger(logFile);
           // Set to mirror to stdout as well as the file
-          gDumpLog = function (msg) {dump(msg); MozillaFileLogger.log(msg);};
+          gDumpLog = function (msg) {dump(msg); mfl.log(msg);};
         }
         catch(e) {
           // If there is a problem, just use stdout
           gDumpLog = dump;
         }
       }
       gRemote = prefs.getBoolPref("reftest.remote");
       gIgnoreWindowSize = prefs.getBoolPref("reftest.ignoreWindowSize");
--- a/layout/tools/reftest/reftest.xul
+++ b/layout/tools/reftest/reftest.xul
@@ -46,11 +46,11 @@
         id="reftest-window"
         hidechrome="true"
         onload="OnRefTestLoad();"
         onunload="OnRefTestUnload();"
         style="background:white; overflow:hidden"
         >
     <script type="application/ecmascript" src="quit.js" />
     <script type="application/ecmascript" src="reftest.js" />
-    <script type="application/ecmascript" src="MozillaFileLogger.js" />
+    <script type="application/ecmascript" src="MozillaLogger.js" />
     <!-- The reftest browser element is dynamically created, here -->
 </window>
--- a/testing/mochitest/browser-harness.xul
+++ b/testing/mochitest/browser-harness.xul
@@ -39,17 +39,17 @@
    -
    - ***** END LICENSE BLOCK ***** -->
 
 <window id="browserTestHarness"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="TestStart();"
         title="Browser chrome tests"
         width="1024">
-  <script src="chrome://mochikit/content/tests/SimpleTest/MozillaFileLogger.js"/>
+  <script src="chrome://mochikit/content/tests/SimpleTest/MozillaLogger.js"/>
   <script src="chrome://mochikit/content/tests/SimpleTest/quit.js"/>
   <script src="chrome://mochikit/content/chrome-harness.js"/>
   <style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
     #results {
       margin: 5px;
       background-color: window;
       -moz-user-select: text;
     }
@@ -101,18 +101,17 @@
     
     var gConfig;
 
     var gDumper = {
       get fileLogger() {
         let logger = null;
         if (gConfig.logFile) {
           try {
-            MozillaFileLogger.init(gConfig.logFile);
-            logger = MozillaFileLogger;
+            logger = new MozillaFileLogger(gConfig.logFile)
           } catch (ex) {
             dump("TEST-UNEXPECTED-FAIL | (browser-harness.xul) | " +
                  "Error trying to log to " + gConfig.logFile + ": " + ex + "\n");
           }
         }
         delete this.fileLogger;
         return this.fileLogger = logger;
       },
--- a/testing/mochitest/harness-overlay.xul
+++ b/testing/mochitest/harness-overlay.xul
@@ -9,17 +9,17 @@
          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
 <window>
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js" />
   <script type="text/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/TestRunner.js"/>
   <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/MozillaFileLogger.js"/>
+          src="chrome://mochikit/content/tests/SimpleTest/MozillaLogger.js"/>
   <script type="text/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/quit.js" />
   <script type="application/javascript"
           src="chrome://mochikit/content/chrome-harness.js" />
   <script type="text/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/setup.js" />
   <script type="application/javascript;version=1.7"><![CDATA[
 
--- a/testing/mochitest/ipc-overlay.xul
+++ b/testing/mochitest/ipc-overlay.xul
@@ -60,16 +60,15 @@ function messageHandler(m) {
     break;
   default:
     break;
   }
 }
 
 function setup() {
   window.removeEventListener("load", setup, false);
-  messageManager.loadFrameScript("chrome://mochikit/content/tests/SimpleTest/MozillaFileLogger.js", true);
   messageManager.loadFrameScript("chrome://mochikit/content/ipc.js", true);
   messageManager.addMessageListener("chromeEvent", messageHandler);
 }
 
 window.addEventListener("load", setup, false);
 </script>
 </window></overlay>
--- a/testing/mochitest/ipc.js
+++ b/testing/mochitest/ipc.js
@@ -40,26 +40,16 @@ if (Cc === undefined) {
 }
 
 function ipcEvent(e) {
     var sync = e.getData("sync");
     var type = e.getData("type");
     var data = JSON.parse(e.getData("data"));
 
     switch(type) {
-    case 'LoggerInit':
-      MozillaFileLogger.init(data.filename);
-      break;
-    case 'Logger':
-      var logger = MozillaFileLogger.getLogCallback();
-      logger({"num":data.num, "level":data.level, "info": Array(data.info)});
-      break;
-    case 'LoggerClose':
-      MozillaFileLogger.close();
-      break;
     case 'waitForFocus':
       if (content)
         var wrapper = content.wrappedJSObject.frames[0].SimpleTest;
       else
         var wrapper = SimpleTest;
       ipctest.waitForFocus(wrapper[data.callback], data.targetWindow, data.expectBlankPage);
       break;
     default:
--- a/testing/mochitest/jar.mn
+++ b/testing/mochitest/jar.mn
@@ -10,17 +10,17 @@ mochikit.jar:
   content/ipc-overlay.xul (ipc-overlay.xul)
   content/mozprefs.js (mozprefs.js)
   content/redirect.html (redirect.html)
   content/redirect.js (redirect.js)
   content/server.js (server.js)
   content/dynamic/getMyDirectory.sjs (dynamic/getMyDirectory.sjs)
   content/static/harness.css (static/harness.css)
   content/tests/SimpleTest/EventUtils.js (tests/SimpleTest/EventUtils.js)
-  content/tests/SimpleTest/MozillaFileLogger.js (tests/SimpleTest/MozillaFileLogger.js)
+  content/tests/SimpleTest/MozillaLogger.js (tests/SimpleTest/MozillaLogger.js)
   content/tests/SimpleTest/PluginUtils.js (tests/SimpleTest/PluginUtils.js)
   content/tests/SimpleTest/quit.js (tests/SimpleTest/quit.js)
   content/tests/SimpleTest/setup.js (tests/SimpleTest/setup.js)
   content/tests/SimpleTest/SimpleTest.js (tests/SimpleTest/SimpleTest.js)
   content/tests/SimpleTest/test.css (tests/SimpleTest/test.css)
   content/tests/SimpleTest/TestRunner.js (tests/SimpleTest/TestRunner.js)
   content/tests/SimpleTest/WindowSnapshot.js (tests/SimpleTest/WindowSnapshot.js)
   content/tests/SimpleTest/mockObjects.js (../../toolkit/content/tests/browser/common/mockObjects.js)
--- a/testing/mochitest/server.js
+++ b/testing/mochitest/server.js
@@ -612,17 +612,17 @@ function testListing(metadata, response)
         TITLE("MochiTest | ", metadata.path),
         LINK({rel: "stylesheet",
               type: "text/css", href: "/static/harness.css"}
         ),
         SCRIPT({type: "text/javascript", src: "/MochiKit/packed.js"}),
         SCRIPT({type: "text/javascript",
                  src: "/tests/SimpleTest/TestRunner.js"}),
         SCRIPT({type: "text/javascript",
-                 src: "/tests/SimpleTest/MozillaFileLogger.js"}),
+                 src: "/tests/SimpleTest/MozillaLogger.js"}),
         SCRIPT({type: "text/javascript",
                  src: "/tests/SimpleTest/quit.js"}),
         SCRIPT({type: "text/javascript",
                  src: "/tests/SimpleTest/setup.js"}),
         SCRIPT({type: "text/javascript"},
                "connect(window, 'onload', hookup); gTestList=" + tests + ";"
         )
       ),
--- a/testing/mochitest/specialpowers/components/SpecialPowersObserver.js
+++ b/testing/mochitest/specialpowers/components/SpecialPowersObserver.js
@@ -45,16 +45,17 @@
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 const CHILD_SCRIPT = "chrome://specialpowers/content/specialpowers.js"
+const CHILD_LOGGER_SCRIPT = "chrome://specialpowers/content/MozillaLogger.js"
 
 /**
  * Special Powers Exception - used to throw exceptions nicely
  **/
 function SpecialPowersException(aMsg) {
   this.message = aMsg;
   this.name = "SpecialPowersException";
 }
@@ -86,16 +87,17 @@ SpecialPowersObserver.prototype = {
 
       case "chrome-document-global-created":
         if (!this._isFrameScriptLoaded) {
           // Register for any messages our API needs us to handle
           this._messageManager.addMessageListener("SPPrefService", this);
           this._messageManager.addMessageListener("SPProcessCrashService", this);
           this._messageManager.addMessageListener("SPPingService", this);
 
+          this._messageManager.loadFrameScript(CHILD_LOGGER_SCRIPT, true);
           this._messageManager.loadFrameScript(CHILD_SCRIPT, true);
           this._isFrameScriptLoaded = true;
         }
         break;
 
       case "xpcom-shutdown":
         this.uninit();
         break;
--- a/testing/mochitest/specialpowers/content/specialpowers.js
+++ b/testing/mochitest/specialpowers/content/specialpowers.js
@@ -298,25 +298,37 @@ SpecialPowers.prototype = {
     tm.mainThread.dispatch({
       run: function() {
         aFunc();
       }
     }, Ci.nsIThread.DISPATCH_NORMAL);
   },
 
   addSystemEventListener: function(target, type, listener, useCapture) {
-    Components.classes["@mozilla.org/eventlistenerservice;1"].
-      getService(Components.interfaces.nsIEventListenerService).
+    Cc["@mozilla.org/eventlistenerservice;1"].
+      getService(Ci.nsIEventListenerService).
       addSystemEventListener(target, type, listener, useCapture);
   },
   removeSystemEventListener: function(target, type, listener, useCapture) {
-    Components.classes["@mozilla.org/eventlistenerservice;1"].
-      getService(Components.interfaces.nsIEventListenerService).
+    Cc["@mozilla.org/eventlistenerservice;1"].
+      getService(Ci.nsIEventListenerService).
       removeSystemEventListener(target, type, listener, useCapture);
-  }
+  },
+
+  setLogFile: function(path) {
+    this._mfl = new MozillaFileLogger(path);
+  },
+
+  log: function(data) {
+    this._mfl.log(data);
+  },
+
+  closeLogFile: function() {
+    this._mfl.close();
+  },
 };
 
 // Expose everything but internal APIs (starting with underscores) to
 // web content.
 SpecialPowers.prototype.__exposedProps__ = {};
 for each (i in Object.keys(SpecialPowers.prototype).filter(function(v) {return v.charAt(0) != "_";})) {
   SpecialPowers.prototype.__exposedProps__[i] = "r";
 }
--- a/testing/mochitest/specialpowers/jar.mn
+++ b/testing/mochitest/specialpowers/jar.mn
@@ -1,3 +1,4 @@
 specialpowers.jar:
 % content specialpowers %content/
   content/specialpowers.js (content/specialpowers.js)
+  content/MozillaLogger.js (../tests/SimpleTest/MozillaLogger.js)
--- a/testing/mochitest/tests/SimpleTest/Makefile.in
+++ b/testing/mochitest/tests/SimpleTest/Makefile.in
@@ -37,17 +37,17 @@
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = testing/mochitest/tests/SimpleTest
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
-_SIMPLETEST_FILES =	MozillaFileLogger.js \
+_SIMPLETEST_FILES =	MozillaLogger.js \
 			quit.js \
 			SimpleTest.js \
 			test.css \
 			TestRunner.js \
 			setup.js \
 			EventUtils.js \
 			WindowSnapshot.js \
 			PluginUtils.js \
rename from testing/mochitest/tests/SimpleTest/MozillaFileLogger.js
rename to testing/mochitest/tests/SimpleTest/MozillaLogger.js
--- a/testing/mochitest/tests/SimpleTest/MozillaFileLogger.js
+++ b/testing/mochitest/tests/SimpleTest/MozillaLogger.js
@@ -1,116 +1,118 @@
 /**
- * MozillaFileLogger, a log listener that can write to a local file.
+ * MozillaLogger, a base class logger that just logs to stdout.
  */
 
-try {
-  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
-  if (Cc === undefined) {
-    var Cc = Components.classes;
-    var Ci = Components.interfaces;
-  }
-} catch (ex) {} //running in ipcMode-chrome
+function MozillaLogger(aPath) {
+}
 
-try {
-  const FOSTREAM_CID = "@mozilla.org/network/file-output-stream;1";
-  const LF_CID = "@mozilla.org/file/local;1";
-  
-  // File status flags. It is a bitwise OR of the following bit flags.
-  // Only one of the first three flags below may be used.
-  const PR_READ_ONLY    = 0x01; // Open for reading only.
-  const PR_WRITE_ONLY   = 0x02; // Open for writing only.
-  const PR_READ_WRITE   = 0x04; // Open for reading and writing.
+MozillaLogger.prototype = {
+
+  init : function(path) {},
   
-  // If the file does not exist, the file is created.
-  // If the file exists, this flag has no effect.
-  const PR_CREATE_FILE  = 0x08;
-  
-  // The file pointer is set to the end of the file prior to each write.
-  const PR_APPEND       = 0x10;
-  
-  // If the file exists, its length is truncated to 0.
-  const PR_TRUNCATE     = 0x20;
-  
-  // If set, each write will wait for both the file data
-  // and file status to be physically updated.
-  const PR_SYNC         = 0x40;
-  
-  // If the file does not exist, the file is created. If the file already
-  // exists, no action and NULL is returned.
-  const PR_EXCL         = 0x80;
-} catch (ex) {
- // probably not running in the test harness
+  getLogCallback : function() {
+    return function (msg) {
+      var data = msg.num + " " + msg.level + " " + msg.info.join(' ') + "\n";
+      dump(data);
+    }
+  },
+
+  log : function(msg) {
+    dump(msg);
+  },
+
+  close : function() {}
+};
+
+
+/**
+ * SpecialPowersLogger, inherits from MozillaLogger and utilizes SpecialPowers.
+ * intented to be used in content scripts to write to a file
+ */
+function SpecialPowersLogger(aPath) {
+  // Call the base constructor
+  MozillaLogger.call(this);
+  this.prototype = new MozillaLogger(aPath);
+  this.init(aPath);
 }
 
+SpecialPowersLogger.prototype = {
+  init : function (path) {
+    SpecialPowers.setLogFile(path);
+  },
+
+  getLogCallback : function () {
+    return function (msg) {
+      var data = msg.num + " " + msg.level + " " + msg.info.join(' ') + "\n";
+      SpecialPowers.log(data);
+
+      if (data.indexOf("SimpleTest FINISH") >= 0) {
+        SpecialPowers.closeLogFile();
+      }
+    }
+  },
+
+  log : function (msg) {
+    SpecialPowers.log(msg);
+  },
+
+  close : function () {
+    SpecialPowers.closeLogFile();
+  }
+};
+
+
+/**
+ * MozillaFileLogger, a log listener that can write to a local file.
+ * intended to be run from chrome space
+ */
+
 /** Init the file logger with the absolute path to the file.
     It will create and append if the file already exists **/
-var MozillaFileLogger = {};
-
-var ipcMode = false;
-try {
-  if (typeof(TestRunner) != undefined)
-    ipcMode = TestRunner.ipcMode;
-} catch(e) { };
-
-MozillaFileLogger.init = function(path) {
-  if (ipcMode) {
-    contentAsyncEvent("LoggerInit", {"filename": path});
-    return;
-  }
-
-  try {
-    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-  } catch (ex) {} //running in ipcMode-chrome
-
-  MozillaFileLogger._file = Cc[LF_CID].createInstance(Ci.nsILocalFile);
-  MozillaFileLogger._file.initWithPath(path);
-  MozillaFileLogger._foStream = Cc[FOSTREAM_CID].createInstance(Ci.nsIFileOutputStream);
-  MozillaFileLogger._foStream.init(this._file, PR_WRITE_ONLY | PR_CREATE_FILE | PR_APPEND,
-                                   0664, 0);
+function MozillaFileLogger(aPath) {
+  // Call the base constructor
+  MozillaLogger.call(this);
+  this.prototype = new MozillaLogger(aPath);
+  this.init(aPath);
 }
 
-MozillaFileLogger.getLogCallback = function() {
-  if (ipcMode) {
-    return function(msg) {
-      contentAsyncEvent("Logger", {"num": msg.num, "level": msg.level, "info": msg.info.join(' ')});
-    }
-  }
+MozillaFileLogger.prototype = {
+  
+  init : function (path) {
+    var PR_WRITE_ONLY   = 0x02; // Open for writing only.
+    var PR_CREATE_FILE  = 0x08;
+    var PR_APPEND       = 0x10;
+    this._file = Components.classes["@mozilla.org/file/local;1"].
+                            createInstance(Components.interfaces.nsILocalFile);
+    this._file.initWithPath(path);
+    this._foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
+                                     createInstance(Components.interfaces.nsIFileOutputStream);
+    this._foStream.init(this._file, PR_WRITE_ONLY | PR_CREATE_FILE | PR_APPEND,
+                                     0664, 0);
+  },
 
-  return function (msg) {
-    try {
-      netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-    } catch(ex) {} //running in ipcMode-chrome
-
-    var data = msg.num + " " + msg.level + " " + msg.info.join(' ') + "\n";
-    if (MozillaFileLogger._foStream)
-      MozillaFileLogger._foStream.write(data, data.length);
-
-    if (data.indexOf("SimpleTest FINISH") >= 0) {
-      MozillaFileLogger.close();
-    }
-  }
-}
+  getLogCallback : function() {
+    return function (msg) {
+      var data = msg.num + " " + msg.level + " " + msg.info.join(' ') + "\n";
+      if (MozillaFileLogger._foStream)
+        this._foStream.write(data, data.length);
 
-// This is only used from chrome space by the reftest harness
-MozillaFileLogger.log = function(msg) {
-  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-  if (MozillaFileLogger._foStream)
-    MozillaFileLogger._foStream.write(msg, msg.length);
-}
+      if (data.indexOf("SimpleTest FINISH") >= 0) {
+        MozillaFileLogger.close();
+      }
+    }
+  },
 
-MozillaFileLogger.close = function() {
-  if (ipcMode) {
-    contentAsyncEvent("LoggerClose");
-    return;
+  log : function(msg) {
+    if (this._foStream)
+      this._foStream.write(msg, msg.length);
+  },
+
+  close : function() {
+    if(this._foStream)
+      this._foStream.close();
+  
+    this._foStream = null;
+    this._file = null;
   }
-
-  try {
-    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-  } catch(ex) {} //running in ipcMode-chrome
+};
 
-  if(MozillaFileLogger._foStream)
-    MozillaFileLogger._foStream.close();
-  
-  MozillaFileLogger._foStream = null;
-  MozillaFileLogger._file = null;
-}
--- a/testing/mochitest/tests/SimpleTest/setup.js
+++ b/testing/mochitest/tests/SimpleTest/setup.js
@@ -76,18 +76,18 @@ if (params.loops) {
 
 // closeWhenDone tells us to call quit.js when complete
 if (params.closeWhenDone) {
   TestRunner.onComplete = goQuitApplication;
 }
 
 // logFile to write our results
 if (params.logFile) {
-  MozillaFileLogger.init(params.logFile);
-  TestRunner.logger.addListener("mozLogger", fileLevel + "", MozillaFileLogger.getLogCallback());
+  var spl = new SpecialPowersLogger(params.logFile);
+  TestRunner.logger.addListener("mozLogger", fileLevel + "", spl.getLogCallback());
 }
 
 // if we get a quiet param, don't log to the console
 if (!params.quiet) {
   function dumpListener(msg) {
     dump(msg.num + " " + msg.level + " " + msg.info.join(' ') + "\n");
   }
   TestRunner.logger.addListener("dumpListener", consoleLevel + "", dumpListener);
--- a/testing/mochitest/tests/index.html
+++ b/testing/mochitest/tests/index.html
@@ -1,14 +1,14 @@
 <html>
 <head>
     <!-- This harness does not work locally in Safari -->
     <script type="text/javascript" src="../MochiKit/MochiKit.js"></script>
     <script type="text/javascript" src="SimpleTest/TestRunner.js"></script>
-    <script type="text/javascript" src="SimpleTest/MozillaFileLogger.js"></script>
+    <script type="text/javascript" src="SimpleTest/MozillaLogger.js"></script>
     <script type="text/javascript" src="SimpleTest/quit.js"></script>
     <!--<link rel="stylesheet" type="text/css" href="/static/main.css" />-->
 </head>
 <body>
 <p><a href="#" id="runtests">Click To Run Tests</a></p>
 <!--<div id="mt_maketemplate">Make Template for Bug <input type="text" /></div>-->
 <script type="text/javascript">
 
@@ -24,18 +24,18 @@ var consoleLevel = params.consoleLevel |
 
 // closeWhenDone tells us to call quit.js when complete
 if (params.closeWhenDone) {
   TestRunner.onComplete = goQuitApplication;
 }
 
 // logFile to write our results
 if (params.logFile) {
-  MozillaFileLogger.init(params.logFile);
-  TestRunner.logger.addListener("mozLogger", fileLevel + "", MozillaFileLogger.getLogCallback());
+  var spl = SpecialPowersLogger(params.logFile);
+  TestRunner.logger.addListener("mozLogger", fileLevel + "", spl.getLogCallback());
 }
 
 // if we get a quiet param, don't log to the console
 if (!params.quiet) {
   function dumpListener(msg) {
     dump("*** " + msg.num + " " + msg.level + " " + msg.info.join(' ') + "\n");
   }
   TestRunner.logger.addListener("dumpListener", consoleLevel + "", dumpListener);