Bug 1940800: Spoof hardware support in RFP. r=tjr

Differential Revision: https://phabricator.services.mozilla.com/D233755
This commit is contained in:
Fatih Kilic
2025-01-22 23:46:32 +00:00
parent 6d9fe6d3bb
commit 6da71a1a9e
2 changed files with 8 additions and 0 deletions

View File

@@ -298,6 +298,13 @@ const RefPtr<SupportedLimits>& Adapter::Limits() const { return mLimits; }
const RefPtr<AdapterInfo>& Adapter::Info() const { return mInfo; }
bool Adapter::IsFallbackAdapter() const {
if (GetParentObject()->ShouldResistFingerprinting(
RFPTarget::WebGPUIsFallbackAdapter)) {
// Always report hardware support for WebGPU.
// This behaviour matches with media capabilities API.
return false;
}
return mInfoInner->device_type == ffi::WGPUDeviceType::WGPUDeviceType_Cpu;
}

View File

@@ -95,6 +95,7 @@ ITEM_VALUE(SiteSpecificZoom, 61)
ITEM_VALUE(FontVisibilityRestrictGenerics, 62)
ITEM_VALUE(WebVTT, 63)
ITEM_VALUE(WebGPULimits, 64)
ITEM_VALUE(WebGPUIsFallbackAdapter, 65)
// !!! Don't forget to update kDefaultFingerprintingProtections in nsRFPService.cpp
// if necessary.