Bug 580786. Require gWindowUtils. r=dbaron
☠☠ backed out by 52f52eb53549 ☠ ☠
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Mon, 19 Dec 2011 09:02:47 -0500
changeset 85900 efd165428f08c0f5043745105a50875a8de312a9
parent 85899 4a79fefefa28fdb09001ac809ad37b17ada51477
child 85901 992cb2426ecff91b1106c068cbf683dde2a6382d
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs580786
milestone12.0a1
Bug 580786. Require gWindowUtils. r=dbaron We should have DOMWindowUtils everywhere and this cleans up the code.
layout/tools/reftest/reftest.js
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -340,23 +340,19 @@ function InitAndStartRefTests()
         gTotalChunks = prefs.getIntPref("reftest.totalChunks");
         gThisChunk = prefs.getIntPref("reftest.thisChunk");
     }
     catch(e) {
         gTotalChunks = 0;
         gThisChunk = 0;
     }
 
-    try {
-        gWindowUtils = gContainingWindow.QueryInterface(CI.nsIInterfaceRequestor).getInterface(CI.nsIDOMWindowUtils);
-        if (gWindowUtils && !gWindowUtils.compareCanvases)
-            gWindowUtils = null;
-    } catch (e) {
-        gWindowUtils = null;
-    }
+    gWindowUtils = gContainingWindow.QueryInterface(CI.nsIInterfaceRequestor).getInterface(CI.nsIDOMWindowUtils);
+    if (!gWindowUtils || !gWindowUtils.compareCanvases)
+        throw "nsIDOMWindowUtils inteface missing";
 
     gIOService = CC[IO_SERVICE_CONTRACTID].getService(CI.nsIIOService);
     gDebug = CC[DEBUG_CONTRACTID].getService(CI.nsIDebug2);
 
     RegisterProcessCrashObservers();
 
     if (gRemote) {
         gServer = null;
@@ -516,19 +512,19 @@ function BuildConditionSandbox(aURL) {
     try {
         // nsIGfxInfo is currently only implemented on Windows
         sandbox.d2d = (NS_GFXINFO_CONTRACTID in CC) && CC[NS_GFXINFO_CONTRACTID].getService(CI.nsIGfxInfo).D2DEnabled;
     } catch(e) {
         sandbox.d2d = false;
     }
 
     sandbox.layersGPUAccelerated =
-      gWindowUtils && gWindowUtils.layerManagerType != "Basic";
+      gWindowUtils.layerManagerType != "Basic";
     sandbox.layersOpenGL =
-      gWindowUtils && gWindowUtils.layerManagerType == "OpenGL";
+      gWindowUtils.layerManagerType == "OpenGL";
 
     // Shortcuts for widget toolkits.
     sandbox.Android = xr.OS == "Android";
     sandbox.cocoaWidget = xr.widgetToolkit == "cocoa";
     sandbox.gtk2Widget = xr.widgetToolkit == "gtk2";
     sandbox.qtWidget = xr.widgetToolkit == "qt";
     sandbox.winWidget = xr.widgetToolkit == "windows";
 
@@ -1398,25 +1394,18 @@ function RecordResult(testRunTime, error
             // if the comparison result matches the expected result specified
             // in the manifest.
 
             // number of different pixels
             var differences;
             // whether the two renderings match:
             var equal;
 
-            if (gWindowUtils) {
-                differences = gWindowUtils.compareCanvases(gCanvas1, gCanvas2, {});
-                equal = (differences == 0);
-            } else {
-                differences = -1;
-                var k1 = gCanvas1.toDataURL();
-                var k2 = gCanvas2.toDataURL();
-                equal = (k1 == k2);
-            }
+            differences = gWindowUtils.compareCanvases(gCanvas1, gCanvas2, {});
+            equal = (differences == 0);
 
             // whether the comparison result matches what is in the manifest
             var test_passed = (equal == (gURLs[0].type == TYPE_REFTEST_EQUAL));
             // what is expected on this platform (PASS, FAIL, or RANDOM)
             var expected = gURLs[0].expected;
             output = outputs[expected][test_passed];
 
             ++gTestResults[output.n];