From 17b7804de78589bfedb792c7aac0ac41e36c143a Mon Sep 17 00:00:00 2001 From: Iulian Moraru Date: Mon, 5 Jun 2023 15:52:52 +0300 Subject: [PATCH] Backed out changeset 4720a9935e8e (bug 1432719) as per dev's request. CLOSED TREE --- browser/actors/SpeechDispatcherChild.sys.mjs | 10 --- browser/actors/SpeechDispatcherParent.sys.mjs | 96 ---------------------- browser/actors/moz.build | 2 - browser/components/BrowserGlue.sys.mjs | 14 ---- browser/locales/en-US/browser/speechDispatcher.ftl | 15 ---- dom/media/webspeech/synth/SpeechSynthesis.cpp | 18 ---- .../webspeech/synth/ipc/PSpeechSynthesis.ipdl | 2 - .../webspeech/synth/ipc/SpeechSynthesisChild.cpp | 6 -- .../webspeech/synth/ipc/SpeechSynthesisChild.h | 2 - .../webspeech/synth/nsISynthVoiceRegistry.idl | 5 -- dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp | 30 ------- dom/media/webspeech/synth/nsSynthVoiceRegistry.h | 2 - .../synth/speechd/SpeechDispatcherService.cpp | 20 ----- .../synth/speechd/SpeechDispatcherService.h | 2 - 14 files changed, 224 deletions(-) delete mode 100644 browser/actors/SpeechDispatcherChild.sys.mjs delete mode 100644 browser/actors/SpeechDispatcherParent.sys.mjs delete mode 100644 browser/locales/en-US/browser/speechDispatcher.ftl diff --git a/browser/actors/SpeechDispatcherChild.sys.mjs b/browser/actors/SpeechDispatcherChild.sys.mjs deleted file mode 100644 index 1184d7244679..000000000000 --- a/browser/actors/SpeechDispatcherChild.sys.mjs +++ /dev/null @@ -1,10 +0,0 @@ -/* vim: set ts=2 sw=2 sts=2 et tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -export class SpeechDispatcherChild extends JSWindowActorChild { - observe(aSubject, aTopic, aData) { - this.sendAsyncMessage("SpeechDispatcher:Error", aData); - } -} diff --git a/browser/actors/SpeechDispatcherParent.sys.mjs b/browser/actors/SpeechDispatcherParent.sys.mjs deleted file mode 100644 index ae891e3cda0f..000000000000 --- a/browser/actors/SpeechDispatcherParent.sys.mjs +++ /dev/null @@ -1,96 +0,0 @@ -/* vim: set ts=2 sw=2 sts=2 et tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -export class SpeechDispatcherParent extends JSWindowActorParent { - prefName() { - return "media.webspeech.synth.dont_notify_on_error"; - } - - disableNotification() { - Services.prefs.setBoolPref(this.prefName(), true); - } - - async receiveMessage(aMessage) { - // The top level browsing context's embedding element should be a xul browser element. - let browser = this.browsingContext.top.embedderElement; - - if (!browser) { - // We don't have a browser so bail! - return; - } - - let notificationId; - let supportPageId; - - if (Services.prefs.getBoolPref(this.prefName(), false)) { - console.info("Opted out from speech-dispatcher error notification"); - return; - } - - let messageId; - switch (aMessage.data) { - case "lib-missing": - messageId = "speech-dispatcher-lib-missing"; - supportPageId = "speechd-setup"; - break; - - case "lib-too-old": - messageId = "speech-dispatcher-lib-too-old"; - supportPageId = "speechd-setup"; - break; - - case "missing-symbol": - messageId = "speech-dispatcher-missing-symbol"; - supportPageId = "speechd-setup"; - break; - - case "open-fail": - messageId = "speech-dispatcher-open-fail"; - supportPageId = "speechd-setup"; - break; - - case "no-voices": - messageId = "speech-dispatcher-no-voices"; - supportPageId = "speechd-no-voices"; - break; - - default: - break; - } - - let MozXULElement = browser.ownerGlobal.MozXULElement; - MozXULElement.insertFTLIfNeeded("browser/speechDispatcher.ftl"); - - // Now actually create the notification - let notificationBox = browser.getTabBrowser().getNotificationBox(browser); - if (notificationBox.getNotificationWithValue(notificationId)) { - return; - } - - let buttons = [ - { - supportPage: supportPageId, - }, - { - "l10n-id": "speech-dispatcher-dismiss-button", - callback: () => { - this.disableNotification(); - }, - }, - ]; - - let iconURL = "chrome://browser/skin/drm-icon.svg"; - notificationBox.appendNotification( - notificationId, - { - label: { "l10n-id": messageId }, - image: iconURL, - priority: notificationBox.PRIORITY_INFO_HIGH, - type: "warning", - }, - buttons - ); - } -} diff --git a/browser/actors/moz.build b/browser/actors/moz.build index 282d00d7565d..af01262d32c8 100644 --- a/browser/actors/moz.build +++ b/browser/actors/moz.build @@ -82,8 +82,6 @@ FINAL_TARGET_FILES.actors += [ "ScreenshotsComponentChild.sys.mjs", "SearchSERPTelemetryChild.sys.mjs", "SearchSERPTelemetryParent.sys.mjs", - "SpeechDispatcherChild.sys.mjs", - "SpeechDispatcherParent.sys.mjs", "SwitchDocumentDirectionChild.sys.mjs", "WebRTCChild.sys.mjs", "WebRTCParent.sys.mjs", diff --git a/browser/components/BrowserGlue.sys.mjs b/browser/components/BrowserGlue.sys.mjs index 89177a168354..92acb0c98ca4 100644 --- a/browser/components/BrowserGlue.sys.mjs +++ b/browser/components/BrowserGlue.sys.mjs @@ -752,20 +752,6 @@ let JSWINDOWACTORS = { matches: ["about:studies*"], }, - SpeechDispatcher: { - parent: { - esModuleURI: "resource:///actors/SpeechDispatcherParent.sys.mjs", - }, - - child: { - esModuleURI: "resource:///actors/SpeechDispatcherChild.sys.mjs", - observers: ["chrome-synth-voices-error"], - }, - - messageManagerGroups: ["browsers"], - allFrames: true, - }, - ASRouter: { parent: { esModuleURI: "resource:///actors/ASRouterParent.sys.mjs", diff --git a/browser/locales/en-US/browser/speechDispatcher.ftl b/browser/locales/en-US/browser/speechDispatcher.ftl deleted file mode 100644 index 761c73afe943..000000000000 --- a/browser/locales/en-US/browser/speechDispatcher.ftl +++ /dev/null @@ -1,15 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -### Speech Dispatches is the name of a speech synthesis tool and shouldn’t be -### localized (https://freebsoft.org/speechd). - -speech-dispatcher-lib-missing = You can’t use speech synthesis because the Speech Dispatcher library is missing. -speech-dispatcher-lib-too-old = You can’t use speech synthesis because Speech Dispatcher needs to be updated. -speech-dispatcher-missing-symbol = You can’t use speech synthesis because the Speech Dispatcher library is broken. -speech-dispatcher-open-fail = You can’t use speech synthesis because Speech Dispatcher won’t open. -speech-dispatcher-no-voices = You can’t use speech synthesis because voices aren’t available in Speech Dispatcher. -speech-dispatcher-dismiss-button = - .label = Don’t show again - .accesskey = D diff --git a/dom/media/webspeech/synth/SpeechSynthesis.cpp b/dom/media/webspeech/synth/SpeechSynthesis.cpp index f26e36a3f4a7..20e3ef754bed 100644 --- a/dom/media/webspeech/synth/SpeechSynthesis.cpp +++ b/dom/media/webspeech/synth/SpeechSynthesis.cpp @@ -65,7 +65,6 @@ SpeechSynthesis::SpeechSynthesis(nsPIDOMWindowInner* aParent) if (obs) { obs->AddObserver(this, "inner-window-destroyed", true); obs->AddObserver(this, "synth-voices-changed", true); - obs->AddObserver(this, "synth-voices-error", true); } } @@ -308,23 +307,6 @@ SpeechSynthesis::Observe(nsISupports* aSubject, const char* aTopic, AdvanceQueue(); } } - } else if (strcmp(aTopic, "synth-voices-error") == 0) { - NS_WARNING("SpeechSynthesis::Observe: synth-voices-error"); - LOG(LogLevel::Debug, ("SpeechSynthesis::onvoiceserror")); - nsCOMPtr window = GetOwner(); - - nsCOMPtr obs = services::GetObserverService(); - if (obs) { - obs->NotifyObservers(window, "chrome-synth-voices-error", aData); - } - - if (!mSpeechQueue.IsEmpty()) { - for (RefPtr& utterance : mSpeechQueue) { - utterance->DispatchSpeechSynthesisEvent(u"error"_ns, 0, nullptr, 0, - u""_ns); - } - mSpeechQueue.Clear(); - } } return NS_OK; diff --git a/dom/media/webspeech/synth/ipc/PSpeechSynthesis.ipdl b/dom/media/webspeech/synth/ipc/PSpeechSynthesis.ipdl index 897c9e787974..38e360bf4c93 100644 --- a/dom/media/webspeech/synth/ipc/PSpeechSynthesis.ipdl +++ b/dom/media/webspeech/synth/ipc/PSpeechSynthesis.ipdl @@ -36,8 +36,6 @@ child: async NotifyVoicesChanged(); - async NotifyVoicesError(nsString aError); - async InitialVoicesAndState(RemoteVoice[] aVoices, nsString[] aDefaults, bool aIsSpeaking); diff --git a/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.cpp b/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.cpp index ff28d0c4183d..9a9e9b6fe292 100644 --- a/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.cpp +++ b/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.cpp @@ -52,12 +52,6 @@ mozilla::ipc::IPCResult SpeechSynthesisChild::RecvNotifyVoicesChanged() { return IPC_OK(); } -mozilla::ipc::IPCResult SpeechSynthesisChild::RecvNotifyVoicesError( - const nsAString& aError) { - nsSynthVoiceRegistry::RecvNotifyVoicesError(aError); - return IPC_OK(); -} - PSpeechSynthesisRequestChild* SpeechSynthesisChild::AllocPSpeechSynthesisRequestChild( const nsAString& aText, const nsAString& aLang, const nsAString& aUri, diff --git a/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.h b/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.h index 459855ee8655..f57582932aae 100644 --- a/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.h +++ b/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.h @@ -36,8 +36,6 @@ class SpeechSynthesisChild : public PSpeechSynthesisChild { mozilla::ipc::IPCResult RecvNotifyVoicesChanged(); - mozilla::ipc::IPCResult RecvNotifyVoicesError(const nsAString& aError); - protected: SpeechSynthesisChild(); virtual ~SpeechSynthesisChild(); diff --git a/dom/media/webspeech/synth/nsISynthVoiceRegistry.idl b/dom/media/webspeech/synth/nsISynthVoiceRegistry.idl index 1898bf68c180..8dd3a0426c75 100644 --- a/dom/media/webspeech/synth/nsISynthVoiceRegistry.idl +++ b/dom/media/webspeech/synth/nsISynthVoiceRegistry.idl @@ -39,11 +39,6 @@ interface nsISynthVoiceRegistry : nsISupports void notifyVoicesChanged(); /** - * Notify chrome code of an error when starting speech synthesis service - */ - void notifyVoicesError(in AString aError); - - /** * Set a voice as default. * * @param aUri a unique identifier of an existing voice. diff --git a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp index c4781661f3bc..d289c816558b 100644 --- a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp +++ b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp @@ -282,15 +282,6 @@ void nsSynthVoiceRegistry::RecvNotifyVoicesChanged() { gSynthVoiceRegistry->NotifyVoicesChanged(); } -void nsSynthVoiceRegistry::RecvNotifyVoicesError(const nsAString& aError) { - // If we dont have a local instance of the registry yet, we don't care. - if (!gSynthVoiceRegistry) { - return; - } - - gSynthVoiceRegistry->NotifyVoicesError(aError); -} - NS_IMETHODIMP nsSynthVoiceRegistry::AddVoice(nsISpeechService* aService, const nsAString& aUri, const nsAString& aName, @@ -379,27 +370,6 @@ nsSynthVoiceRegistry::NotifyVoicesChanged() { } NS_IMETHODIMP -nsSynthVoiceRegistry::NotifyVoicesError(const nsAString& aError) { - if (XRE_IsParentProcess()) { - nsTArray ssplist; - GetAllSpeechSynthActors(ssplist); - - for (uint32_t i = 0; i < ssplist.Length(); ++i) { - Unused << ssplist[i]->SendNotifyVoicesError(aError); - } - } - - nsCOMPtr obs = mozilla::services::GetObserverService(); - if (NS_WARN_IF(!(obs))) { - return NS_ERROR_NOT_AVAILABLE; - } - - obs->NotifyObservers(nullptr, "synth-voices-error", aError.BeginReading()); - - return NS_OK; -} - -NS_IMETHODIMP nsSynthVoiceRegistry::SetDefaultVoice(const nsAString& aUri, bool aIsDefault) { bool found = false; VoiceData* retval = mUriVoiceMap.GetWeak(aUri, &found); diff --git a/dom/media/webspeech/synth/nsSynthVoiceRegistry.h b/dom/media/webspeech/synth/nsSynthVoiceRegistry.h index ba2b57d0d3a7..85c67c087f6d 100644 --- a/dom/media/webspeech/synth/nsSynthVoiceRegistry.h +++ b/dom/media/webspeech/synth/nsSynthVoiceRegistry.h @@ -65,8 +65,6 @@ class nsSynthVoiceRegistry final : public nsISynthVoiceRegistry { static void RecvNotifyVoicesChanged(); - static void RecvNotifyVoicesError(const nsAString& aError); - private: virtual ~nsSynthVoiceRegistry(); diff --git a/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp b/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp index c0944cf24f1e..e0d548874832 100644 --- a/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp +++ b/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp @@ -322,7 +322,6 @@ void SpeechDispatcherService::Setup() { if (!speechdLib) { NS_WARNING("Failed to load speechd library"); - NotifyError(u"lib-missing"_ns); return; } @@ -330,7 +329,6 @@ void SpeechDispatcherService::Setup() { // There is no version getter function, so we rely on a symbol that was // introduced in release 0.8.2 in order to check for ABI compatibility. NS_WARNING("Unsupported version of speechd detected"); - NotifyError(u"lib-too-old"_ns); return; } @@ -342,7 +340,6 @@ void SpeechDispatcherService::Setup() { NS_WARNING(nsPrintfCString("Failed to find speechd symbol for'%s'", kSpeechDispatcherSymbols[i].functionName) .get()); - NotifyError(u"missing-symbol"_ns); return; } } @@ -351,7 +348,6 @@ void SpeechDispatcherService::Setup() { spd_open("firefox", "web speech api", "who", SPD_MODE_THREADED); if (!mSpeechdClient) { NS_WARNING("Failed to call spd_open"); - NotifyError(u"open-fail"_ns); return; } @@ -390,10 +386,6 @@ void SpeechDispatcherService::Setup() { } } - if (mVoices.Count() == 0) { - NotifyError(u"no-voices"_ns); - } - NS_DispatchToMainThread( NewRunnableMethod("dom::SpeechDispatcherService::RegisterVoices", this, &SpeechDispatcherService::RegisterVoices)); @@ -403,18 +395,6 @@ void SpeechDispatcherService::Setup() { // private methods -void SpeechDispatcherService::NotifyError(const nsString& aError) { - if (!NS_IsMainThread()) { - NS_DispatchToMainThread(NewRunnableMethod( - "dom::SpeechDispatcherService::NotifyError", this, - &SpeechDispatcherService::NotifyError, aError)); - return; - } - - RefPtr registry = nsSynthVoiceRegistry::GetInstance(); - DebugOnly rv = registry->NotifyVoicesError(aError); -} - void SpeechDispatcherService::RegisterVoices() { RefPtr registry = nsSynthVoiceRegistry::GetInstance(); for (const auto& entry : mVoices) { diff --git a/dom/media/webspeech/synth/speechd/SpeechDispatcherService.h b/dom/media/webspeech/synth/speechd/SpeechDispatcherService.h index ac67f64d0fd9..2922053c80c8 100644 --- a/dom/media/webspeech/synth/speechd/SpeechDispatcherService.h +++ b/dom/media/webspeech/synth/speechd/SpeechDispatcherService.h @@ -47,8 +47,6 @@ class SpeechDispatcherService final : public nsIObserver, private: virtual ~SpeechDispatcherService(); - void NotifyError(const nsString& aError); - void RegisterVoices(); bool mInitialized; -- 2.11.4.GIT