Bug 661940: Dump verbose messages if MOZ_REFTEST_VERBOSE is set in the environment. r=roc
authorChris Jones <jones.chris.g@gmail.com>
Fri, 10 Jun 2011 10:00:11 -0700
changeset 70880 b735bb9178c15c769ad874b51358af590b1aac8b
parent 70879 635d71b87150506a97b1cbdcea901b5415b4dccb
child 70882 24b3cd3c8ed79f6f8d910015d383f9ac8e90aeac
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersroc
bugs661940
milestone7.0a1
Bug 661940: Dump verbose messages if MOZ_REFTEST_VERBOSE is set in the environment. r=roc
layout/tools/reftest/reftest.js
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -151,37 +151,42 @@ var gRunSlowTests = true;
 
 // whether we should skip caching canvases
 var gNoCanvasCache = false;
 
 var gRecycledCanvases = new Array();
 
 // By default we just log to stdout
 var gDumpLog = dump;
+var gVerbose = false;
 
 // Only dump the sandbox once, because it doesn't depend on the
 // manifest URL (yet!).
 var gDumpedConditionSandbox = false;
 
 function LogWarning(str)
 {
     gDumpLog("REFTEST INFO | " + str + "\n");
     gTestLog.push(str);
 }
 
 function LogInfo(str)
 {
-//    gDumpLog("REFTEST INFO | " + str + "\n");
+    if (gVerbose)
+        gDumpLog("REFTEST INFO | " + str + "\n");
     gTestLog.push(str);
 }
 
 function FlushTestLog()
 {
-    for (var i = 0; i < gTestLog.length; ++i) {
-        gDumpLog("REFTEST INFO | Saved log: " + gTestLog[i] + "\n");
+    if (!gVerbose) {
+        // In verbose mode, we've dumped all these messages already.
+        for (var i = 0; i < gTestLog.length; ++i) {
+            gDumpLog("REFTEST INFO | Saved log: " + gTestLog[i] + "\n");
+        }
     }
     gTestLog = [];
 }
 
 function AllocateCanvas()
 {
     var windowElem = document.documentElement;
 
@@ -213,16 +218,20 @@ function IDForEventTarget(event)
 }
 
 function OnRefTestLoad()
 {
     gCrashDumpDir = CC[NS_DIRECTORY_SERVICE_CONTRACTID]
                     .getService(CI.nsIProperties)
                     .get("ProfD", CI.nsIFile);
     gCrashDumpDir.append("minidumps");
+    
+    var env = CC["@mozilla.org/process/environment;1"].
+              getService(CI.nsIEnvironment);
+    gVerbose = !!env.get("MOZ_REFTEST_VERBOSE");
 
     var prefs = Components.classes["@mozilla.org/preferences-service;1"].
                 getService(Components.interfaces.nsIPrefBranch2);
     try {
         gBrowserIsRemote = prefs.getBoolPref("browser.tabs.remote");
     } catch (e) {
         gBrowserIsRemote = false;
     }