Bug 1270252: Skip a blocklisting test when everything is blocked because of a missing driver version. Clean up some returns from blocklisting, where the status and return value were missing or inconsistent. r?benwa draft
authorMilan Sreckovic <msreckovic@mozilla.com>
Wed, 11 May 2016 17:08:49 -0400
changeset 366000 d5393b42643cfc18600e59d51065172c5afd1a00
parent 365273 1579b9e2e50f3a27ad02d58cc9170c91e0973fec
child 520685 fd8fe1dc03cf8969a1f485fd97ebfd4a4bcc5bde
push id17881
push usermsreckovic@mozilla.com
push dateWed, 11 May 2016 21:09:13 +0000
reviewersbenwa
bugs1270252
milestone49.0a1
Bug 1270252: Skip a blocklisting test when everything is blocked because of a missing driver version. Clean up some returns from blocklisting, where the status and return value were missing or inconsistent. r?benwa MozReview-Commit-ID: IIJGltGMjOi
toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_No_Comparison.js
widget/GfxInfoBase.cpp
widget/windows/GfxInfo.cpp
--- a/toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_No_Comparison.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_No_Comparison.js
@@ -62,23 +62,25 @@ function run_test() {
 
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
   startupManager();
 
   do_test_pending();
 
   function checkBlacklist()
   {
-    var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D);
-    do_check_eq(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DEVICE);
+    var driverVersion = gfxInfo.adapterDriverVersion;
+    if (driverVersion) {
+      var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D);
+      do_check_eq(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DEVICE);
 
-    // Make sure unrelated features aren't affected
-    status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS);
-    do_check_eq(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK);
-
+      // Make sure unrelated features aren't affected
+      status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS);
+      do_check_eq(status, Ci.nsIGfxInfo.FEATURE_STATUS_OK);
+    }
     gTestserver.stop(do_test_finished);
   }
 
   Services.obs.addObserver(function(aSubject, aTopic, aData) {
     // If we wait until after we go through the event loop, gfxInfo is sure to
     // have processed the gfxItems event.
     do_execute_soon(checkBlacklist);
   }, "blocklist-data-gfxItems", false);
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -823,16 +823,17 @@ GfxInfoBase::GetFeatureStatusImpl(int32_
   nsAutoString adapterVendorID;
   nsAutoString adapterDeviceID;
   nsAutoString adapterDriverVersionString;
   if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
       NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
       NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
   {
     aFailureId = "FEATURE_FAILURE_CANT_RESOLVE_ADAPTER";
+    *aStatus = FEATURE_BLOCKED_DEVICE;
     return NS_OK;
   }
 
   // Check if the device is blocked from the downloaded blocklist. If not, check
   // the static list after that. This order is used so that we can later escape
   // out of static blocks (i.e. if we were wrong or something was patched, we
   // can back out our static block without doing a release).
   int32_t status;
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -1154,41 +1154,43 @@ GfxInfo::GetFeatureStatusImpl(int32_t aF
     nsAutoString adapterVendorID;
     nsAutoString adapterDeviceID;
     nsAutoString adapterDriverVersionString;
     if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
         NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
         NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
     {
       aFailureId = "FEATURE_FAILURE_GET_ADAPTER";
-      return NS_ERROR_FAILURE;
+      *aStatus = FEATURE_BLOCKED_DEVICE;
+      return NS_OK;
     }
 
     if (!adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorIntel), nsCaseInsensitiveStringComparator()) &&
         !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), nsCaseInsensitiveStringComparator()) &&
         !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorAMD), nsCaseInsensitiveStringComparator()) &&
         !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorATI), nsCaseInsensitiveStringComparator()) &&
         !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorMicrosoft), nsCaseInsensitiveStringComparator()) &&
         // FIXME - these special hex values are currently used in xpcshell tests introduced by
         // bug 625160 patch 8/8. Maybe these tests need to be adjusted now that we're only whitelisting
         // intel/ati/nvidia.
         !adapterVendorID.LowerCaseEqualsLiteral("0xabcd") &&
         !adapterVendorID.LowerCaseEqualsLiteral("0xdcba") &&
         !adapterVendorID.LowerCaseEqualsLiteral("0xabab") &&
         !adapterVendorID.LowerCaseEqualsLiteral("0xdcdc"))
     {
+      aFailureId = "FEATURE_FAILURE_TEST";
       *aStatus = FEATURE_BLOCKED_DEVICE;
-      aFailureId = "FEATURE_FAILURE_TEST";
       return NS_OK;
     }
 
     uint64_t driverVersion;
     if (!ParseDriverVersion(adapterDriverVersionString, &driverVersion)) {
       aFailureId = "FEATURE_FAILURE_PARSE_DRIVER";
-      return NS_ERROR_FAILURE;
+      *aStatus = FEATURE_BLOCKED_DRIVER_VERSION;
+      return NS_OK;
     }
 
     // special-case the WinXP test slaves: they have out-of-date drivers, but we still want to
     // whitelist them, actually we do know that this combination of device and driver version
     // works well.
     if (mWindowsVersion == kWindowsXP &&
         adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), nsCaseInsensitiveStringComparator()) &&
         adapterDeviceID.LowerCaseEqualsLiteral("0x0861") && // GeForce 9400