From 0c70ea0a2f0e1d828de3f7d4649116bc18acbe30 Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Fri, 31 Mar 2023 07:53:08 +0000 Subject: [PATCH] Bug 1825233 - Cut SpeechSynthesis over to RFPTarget. r=tjr Differential Revision: https://phabricator.services.mozilla.com/D173944 --- dom/media/webspeech/synth/SpeechSynthesis.cpp | 6 ++++-- dom/media/webspeech/synth/SpeechSynthesisUtterance.cpp | 3 ++- toolkit/components/resistfingerprinting/RFPTargets.inc | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dom/media/webspeech/synth/SpeechSynthesis.cpp b/dom/media/webspeech/synth/SpeechSynthesis.cpp index 6879db14568f..20e3ef754bed 100644 --- a/dom/media/webspeech/synth/SpeechSynthesis.cpp +++ b/dom/media/webspeech/synth/SpeechSynthesis.cpp @@ -225,7 +225,8 @@ void SpeechSynthesis::GetVoices( nsCOMPtr window = GetOwner(); nsCOMPtr docShell = window ? window->GetDocShell() : nullptr; - if (nsContentUtils::ShouldResistFingerprinting(docShell)) { + if (nsContentUtils::ShouldResistFingerprinting(docShell, + RFPTarget::SpeechSynthesis)) { return; } @@ -298,7 +299,8 @@ SpeechSynthesis::Observe(nsISupports* aSubject, const char* aTopic, nsCOMPtr window = GetOwner(); nsCOMPtr docShell = window ? window->GetDocShell() : nullptr; - if (!nsContentUtils::ShouldResistFingerprinting(docShell)) { + if (!nsContentUtils::ShouldResistFingerprinting( + docShell, RFPTarget::SpeechSynthesis)) { DispatchTrustedEvent(u"voiceschanged"_ns); // If we have a pending item, and voices become available, speak it. if (!mCurrentTask && !mHoldQueue && HasVoices()) { diff --git a/dom/media/webspeech/synth/SpeechSynthesisUtterance.cpp b/dom/media/webspeech/synth/SpeechSynthesisUtterance.cpp index d310648683e5..4d8dcd5c12b5 100644 --- a/dom/media/webspeech/synth/SpeechSynthesisUtterance.cpp +++ b/dom/media/webspeech/synth/SpeechSynthesisUtterance.cpp @@ -35,7 +35,8 @@ SpeechSynthesisUtterance::SpeechSynthesisUtterance( mPitch(1), mPaused(false), mShouldResistFingerprinting( - aOwnerWindow->AsGlobal()->ShouldResistFingerprinting()) {} + aOwnerWindow->AsGlobal()->ShouldResistFingerprinting( + RFPTarget::SpeechSynthesis)) {} SpeechSynthesisUtterance::~SpeechSynthesisUtterance() = default; diff --git a/toolkit/components/resistfingerprinting/RFPTargets.inc b/toolkit/components/resistfingerprinting/RFPTargets.inc index a617e2e83cc7..5f20fe8caa22 100644 --- a/toolkit/components/resistfingerprinting/RFPTargets.inc +++ b/toolkit/components/resistfingerprinting/RFPTargets.inc @@ -8,6 +8,8 @@ ITEM_VALUE(TouchEvents, 0x0001) ITEM_VALUE(ScreenOrientation, 0x0005) +// SpeechSynthesis part of the Web Speech API +ITEM_VALUE(SpeechSynthesis, 0x0006) /* * Certain classes (Document, at time of writing) have a cached value for