Bug 741979 - Don't require version numbers in the downloaded graphics driver blacklist. r=bjacob

--HG--
extra : rebase_source : b8abd6950804e1957d126b134146c55224288d14
This commit is contained in:
Joe Drew 2012-05-04 15:33:59 -04:00
Родитель 33df9be77c
Коммит ff50fc9894
7 изменённых файлов: 134 добавлений и 4 удалений

Просмотреть файл

@ -114,5 +114,41 @@
<driverVersion> 7 </driverVersion>
<driverVersionComparator> GREATER_THAN_OR_EQUAL </driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>WINNT 6.1</os>
<vendor>0xabcd</vendor>
<devices>
<device>0x6666</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DEVICE </featureStatus>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Darwin 9</os>
<vendor>0xabcd</vendor>
<devices>
<device>0x6666</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DEVICE </featureStatus>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Linux</os>
<vendor>0xabcd</vendor>
<devices>
<device>0x6666</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DEVICE </featureStatus>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Android</os>
<vendor>0xabcd</vendor>
<devices>
<device>0x6666</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DEVICE </featureStatus>
</gfxBlacklistEntry>
</gfxItems>
</blocklist>

Просмотреть файл

@ -0,0 +1,89 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Test whether a machine which exactly matches the blacklist entry is
// successfully blocked.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsITimerCallback);
blocklist.notify(null);
}
// Performs the initial setup
function run_test() {
try {
var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
} catch (e) {
do_test_finished();
return;
}
// We can't do anything if we can't spoof the stuff we need.
if (!(gfxInfo instanceof Ci.nsIGfxInfoDebug)) {
do_test_finished();
return;
}
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x6666");
// Spoof the OS version so it matches the test file.
switch (get_platform()) {
case "WINNT":
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
break;
case "Darwin":
gfxInfo.spoofOSVersion(0x1050);
break;
case "Android":
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);
do_test_pending();
function checkBlacklist()
{
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_NO_INFO);
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);
load_blocklist("test_gfxBlacklist.xml");
}

Просмотреть файл

@ -157,6 +157,7 @@ skip-if = os == "android"
[test_gfxBlacklist_Equal_OK.js]
[test_gfxBlacklist_GTE_DriverOld.js]
[test_gfxBlacklist_GTE_OK.js]
[test_gfxBlacklist_No_Comparison.js]
[test_gfxBlacklist_OK.js]
[test_gfxBlacklist_OS.js]
[test_gfxBlacklist_Vendor.js]

Просмотреть файл

@ -364,7 +364,7 @@ GfxInfo::AddCrashReportAnnotations()
// We don't support checking driver versions on Mac.
#define IMPLEMENT_MAC_DRIVER_BLOCKLIST(os, vendor, device, features, blockOn) \
APPEND_TO_DRIVER_BLOCKLIST(os, vendor, device, features, blockOn, \
DRIVER_UNKNOWN_COMPARISON, V(0,0,0,0), "")
DRIVER_COMPARISON_IGNORED, V(0,0,0,0), "")
const nsTArray<GfxDriverInfo>&

Просмотреть файл

@ -54,7 +54,7 @@ GfxDriverInfo::GfxDriverInfo()
mDeleteDevices(false),
mFeature(allFeatures),
mFeatureStatus(nsIGfxInfo::FEATURE_NO_INFO),
mComparisonOp(DRIVER_UNKNOWN_COMPARISON),
mComparisonOp(DRIVER_COMPARISON_IGNORED),
mDriverVersion(0),
mDriverVersionMax(0),
mSuggestedVersion(nsnull)

Просмотреть файл

@ -76,7 +76,7 @@ enum VersionComparisonOp {
DRIVER_BETWEEN_EXCLUSIVE, // driver > version && driver < versionMax
DRIVER_BETWEEN_INCLUSIVE, // driver >= version && driver <= versionMax
DRIVER_BETWEEN_INCLUSIVE_START, // driver >= version && driver < versionMax
DRIVER_UNKNOWN_COMPARISON
DRIVER_COMPARISON_IGNORED
};
enum DeviceFamily {

Просмотреть файл

@ -342,7 +342,7 @@ BlacklistComparatorToComparisonOp(const nsAString& op)
else if (op == NS_LITERAL_STRING("BETWEEN_INCLUSIVE_START"))
return DRIVER_BETWEEN_INCLUSIVE_START;
return DRIVER_UNKNOWN_COMPARISON;
return DRIVER_COMPARISON_IGNORED;
}
// Arbitrarily returns the first |tagname| child of |element|.
@ -632,6 +632,10 @@ GfxInfoBase::FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& info,
case DRIVER_BETWEEN_INCLUSIVE_START:
match = driverVersion >= info[i].mDriverVersion && driverVersion < info[i].mDriverVersionMax;
break;
case DRIVER_COMPARISON_IGNORED:
// We don't have a comparison op, so we match everything.
match = true;
break;
default:
NS_WARNING("Bogus op in GfxDriverInfo");
break;