forked from mirrors/gecko-dev
Bug 1873996 - Block optional features by default for wildcard/unspecified gfx blocklist entries. r=jrmuizel
Downloadable blocklist entries did not have an explicit way to declare a rule to affect all features prior to this patch. Instead they would leave the "feature" attribute unset, which defaults us to GfxDriverInfo::allFeatures. Now if it is unset, it defaults to GfxDriverInfo::optionalFeatures. There are also explicit wildcard feature strings, ALL and OPTIONAL respectively. Differential Revision: https://phabricator.services.mozilla.com/D198193
This commit is contained in:
parent
e0cc765727
commit
8f25da9554
3 changed files with 12 additions and 6 deletions
|
|
@ -28,7 +28,7 @@ GfxDriverInfo::GfxDriverInfo()
|
||||||
mDriverVendor(GfxDriverInfo::GetDriverVendor(DriverVendor::All)),
|
mDriverVendor(GfxDriverInfo::GetDriverVendor(DriverVendor::All)),
|
||||||
mDevices(GfxDriverInfo::GetDeviceFamily(DeviceFamily::All)),
|
mDevices(GfxDriverInfo::GetDeviceFamily(DeviceFamily::All)),
|
||||||
mDeleteDevices(false),
|
mDeleteDevices(false),
|
||||||
mFeature(allFeatures),
|
mFeature(optionalFeatures),
|
||||||
mFeatureStatus(nsIGfxInfo::FEATURE_STATUS_OK),
|
mFeatureStatus(nsIGfxInfo::FEATURE_STATUS_OK),
|
||||||
mComparisonOp(DRIVER_COMPARISON_IGNORED),
|
mComparisonOp(DRIVER_COMPARISON_IGNORED),
|
||||||
mDriverVersion(0),
|
mDriverVersion(0),
|
||||||
|
|
|
||||||
|
|
@ -329,9 +329,9 @@ struct GfxDriverInfo {
|
||||||
/* A feature from nsIGfxInfo, or a wildcard set of features */
|
/* A feature from nsIGfxInfo, or a wildcard set of features */
|
||||||
int32_t mFeature;
|
int32_t mFeature;
|
||||||
/* Block all features */
|
/* Block all features */
|
||||||
static constexpr int32_t allFeatures = 0;
|
static constexpr int32_t allFeatures = -1;
|
||||||
/* Block all features not permitted by OnlyAllowFeatureOnKnownConfig */
|
/* Block all features not permitted by OnlyAllowFeatureOnKnownConfig */
|
||||||
static constexpr int32_t optionalFeatures = -1;
|
static constexpr int32_t optionalFeatures = -2;
|
||||||
|
|
||||||
/* A feature status from nsIGfxInfo */
|
/* A feature status from nsIGfxInfo */
|
||||||
int32_t mFeatureStatus;
|
int32_t mFeatureStatus;
|
||||||
|
|
|
||||||
|
|
@ -549,13 +549,19 @@ static int32_t BlocklistFeatureToGfxFeature(const nsAString& aFeature) {
|
||||||
if (aFeature.EqualsLiteral("ACCELERATED_CANVAS2D")) {
|
if (aFeature.EqualsLiteral("ACCELERATED_CANVAS2D")) {
|
||||||
return nsIGfxInfo::FEATURE_ACCELERATED_CANVAS2D;
|
return nsIGfxInfo::FEATURE_ACCELERATED_CANVAS2D;
|
||||||
}
|
}
|
||||||
|
if (aFeature.EqualsLiteral("ALL")) {
|
||||||
|
return GfxDriverInfo::allFeatures;
|
||||||
|
}
|
||||||
|
if (aFeature.EqualsLiteral("OPTIONAL")) {
|
||||||
|
return GfxDriverInfo::optionalFeatures;
|
||||||
|
}
|
||||||
|
|
||||||
// If we don't recognize the feature, it may be new, and something
|
// If we don't recognize the feature, it may be new, and something
|
||||||
// this version doesn't understand. So, nothing to do. This is
|
// this version doesn't understand. So, nothing to do. This is
|
||||||
// different from feature not being specified at all, in which case
|
// different from feature not being specified at all, in which case
|
||||||
// this method should not get called and we should continue with the
|
// this method should not get called and we should continue with the
|
||||||
// "all features" blocklisting.
|
// "optional features" blocklisting.
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t BlocklistFeatureStatusToGfxFeatureStatus(
|
static int32_t BlocklistFeatureStatusToGfxFeatureStatus(
|
||||||
|
|
@ -686,7 +692,7 @@ static bool BlocklistEntryToDriverInfo(const nsACString& aBlocklistEntry,
|
||||||
aDriverInfo.mDriverVendor = dataValue;
|
aDriverInfo.mDriverVendor = dataValue;
|
||||||
} else if (key.EqualsLiteral("feature")) {
|
} else if (key.EqualsLiteral("feature")) {
|
||||||
aDriverInfo.mFeature = BlocklistFeatureToGfxFeature(dataValue);
|
aDriverInfo.mFeature = BlocklistFeatureToGfxFeature(dataValue);
|
||||||
if (aDriverInfo.mFeature < 0) {
|
if (aDriverInfo.mFeature == 0) {
|
||||||
// If we don't recognize the feature, we do not want to proceed.
|
// If we don't recognize the feature, we do not want to proceed.
|
||||||
gfxWarning() << "Unrecognized feature " << value.get();
|
gfxWarning() << "Unrecognized feature " << value.get();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue