Bug 688749 - reftest.js will throw an exception if we do a getPref and the pref doesn't exist. r=dbaron
authorJoel Maher <jmaher@mozilla.com>
Tue, 27 Sep 2011 08:30:24 -0400
changeset 79011 9733c9885c0202a93cee7b7d2e9901593a4213cb
parent 79010 ef9284803c474490076d91d9261c06f5ad27e0ff
child 79012 9a4ee730c0d9d513d141fb72a92cbc1d94588a3d
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs688749
milestone9.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 688749 - reftest.js will throw an exception if we do a getPref and the pref doesn't exist. r=dbaron
layout/tools/reftest/reftest.js
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -251,40 +251,58 @@ function OnRefTestLoad()
                              .frameLoader.messageManager;
     // The content script waits for the initial onload, then notifies
     // us.
     RegisterMessageListenersAndLoadContentScript();
 }
 
 function InitAndStartRefTests()
 {
-    /* set the gLoadTimeout */
+    /* These prefs are optional, so we don't need to spit an error to the log */
     try {
       var prefs = Components.classes["@mozilla.org/preferences-service;1"].
                   getService(Components.interfaces.nsIPrefBranch2);
+    } catch(e) {
+      gDumpLog("REFTEST TEST-UNEXPECTED-FAIL | | EXCEPTION: " + e + "\n");
+    }
+    
+    /* set the gLoadTimeout */
+    try {
       gLoadTimeout = prefs.getIntPref("reftest.timeout");
+    } catch(e) { 
+      gLoadTimeout = 5 * 60 * 1000; //5 minutes as per bug 479518
+    }
+    
+    /* Get the logfile for android tests */
+    try {
       logFile = prefs.getCharPref("reftest.logFile");
       if (logFile) {
         try {
           var mfl = new MozillaFileLogger(logFile);
           // Set to mirror to stdout as well as the file
           gDumpLog = function (msg) {dump(msg); mfl.log(msg);};
         }
         catch(e) {
           // If there is a problem, just use stdout
           gDumpLog = dump;
         }
       }
+    } catch(e) {}
+    
+    try {
       gRemote = prefs.getBoolPref("reftest.remote");
-      gIgnoreWindowSize = prefs.getBoolPref("reftest.ignoreWindowSize");
-    }
-    catch(e) {
-      gLoadTimeout = 5 * 60 * 1000; //5 minutes as per bug 479518
+    } catch(e) { 
+      gRemote = false;
     }
 
+    try {
+      gIgnoreWindowSize = prefs.getBoolPref("reftest.ignoreWindowSize");
+    } catch(e) {
+      gIgnoreWindowSize = false;
+    }
 
     /* Support for running a chunk (subset) of tests.  In separate try as this is optional */
     try {
       gTotalChunks = prefs.getIntPref("reftest.totalChunks");
       gThisChunk = prefs.getIntPref("reftest.thisChunk");
     }
     catch(e) {
       gTotalChunks = 0;