Bug 1972600 - Spoof network connection for HTMLMediaElement preload. a=pascalc

Original Revision: https://phabricator.services.mozilla.com/D254027

Differential Revision: https://phabricator.services.mozilla.com/D255984
This commit is contained in:
Fatih Kilic
2025-07-09 09:12:43 +00:00
committed by pchevrel@mozilla.com
parent a9402a5a1d
commit 3392ea7ae8
7 changed files with 100 additions and 5 deletions

View File

@@ -3130,6 +3130,9 @@ uint32_t HTMLMediaElement::GetPreloadDefault() const {
if (mMediaSource) {
return HTMLMediaElement::PRELOAD_METADATA;
}
if (ShouldResistFingerprinting(RFPTarget::NetworkConnection)) {
return HTMLMediaElement::PRELOAD_METADATA;
}
if (OnCellularConnection()) {
return Preferences::GetInt("media.preload.default.cellular",
HTMLMediaElement::PRELOAD_NONE);
@@ -3139,6 +3142,9 @@ uint32_t HTMLMediaElement::GetPreloadDefault() const {
}
uint32_t HTMLMediaElement::GetPreloadDefaultAuto() const {
if (ShouldResistFingerprinting(RFPTarget::NetworkConnection)) {
return HTMLMediaElement::PRELOAD_ENOUGH;
}
if (OnCellularConnection()) {
return Preferences::GetInt("media.preload.auto.cellular",
HTMLMediaElement::PRELOAD_METADATA);