7
0
Files
nodejs-electron/disable-webspeech.patch
Bruno Pitrus bfff7443fb Accepting request 1272836 from home:dziobian:gulgul-ultron:19
- Update to 35.2.1
  * Chromium 134.0.6998.205
  * Node 22.14.0
  * V8 13.4
  * Removed AVIF image format
  * Added excludeUrls to webRequest filter and deprecated the use of empty arrays in urls property.
  * Added fromVersionID on ServiceWorkers to get an instance of ServiceWorkerMain.
  * Deprecated getPreloads and setPreloads on Session.
  * Moved 'console-message' arguments into event object.
  * Added ServiceWorkerMain class to interact with service workers in the main process.
  * Added contextBridge.executeInMainWorld to safely execute code across world boundaries.
  * Added frame to 'console-message' event.
  * Added optional animation parameter to BrowserWindow.setVibrancy.
  * Added permission support for document.executeCommand("paste").
  * Added support for service worker preload scripts.
  * Support Portal's globalShortcuts.
    Electron must be run with --enable-features=GlobalShortcutsPortal in order to have the feature working.
  * see https://github.com/electron/electron/releases/tag/v35.0.0 and https://www.electronjs.org/blog/electron-35-0 for more
- Remove Fedora 40 support
  * drop bundled-minizip.patch
  * drop quiche-absl-HexStringToBytes.patch
- Leap 15.6: use backported wayland-protocols
  * drop wayland-protocol-toplevel-icon.patch
  * drop wayland-protocol-toplevel-icon-2.patch
  * drop wayland-protocol-toplevel-drag.patch
- Build with LTO also on 15.6 (so now we enable it everywhere)
- Fedora: use system simdjson
  * merge system-ada-url.patch into use-system-libraries-in-node.patch
- Drop no longer applicable patches
  * account_id-missing-optional.patch
  * blink-platform-INSIDE_BLINK-Wodr.patch
  * boringssl-internal-addc-cxx.patch
  * build-without-extensions.patch
  * css_attr_value_tainting-missing-once_flag.patch
  * electron-13-fix-base-check-nomerge.patch
  * exception_context-missing-variant.patch
  * fix-build-without-safebrowsing.patch
  * fix-build-without-service-discovery.patch
  * ip_protection_data_types-missing-optional.patch
  * node-compiler.patch
  * skia_image_decoder_base-missing-stack.patch
  * vtt_scanner-missing-variant.patch
  * wayland_connection-Wchanges-meaning.patch
- Add backported or upstreamable patches
  * ax_platform_node_id-fpermissive.patch
  * browser_process_impl-fix-safe_browsing_mode-0.patch
  * content_browser_client-incomplete-WebUIController.patch
  * css_shape_value-constructor.patch
  * exception_state-constexpr-initializer.patch
  * fix-build-without-pdf.patch
  * fix-build-without-video-effects.patch
  * media_session_uma_helper-missing-optional.patch
  * object_paint_properties-explicit-specialization-in-non-namespace-scope.patch
  * perfetto-ThreadTrack-Current-null-dereference.patch
  * picture_in_picture_window_manager_uma_helper-missing-optional.patch
  * plugin_utils-build-without-electron_extensions.patch
  * raw_ptr-fpermissive.patch
  * resource_response-Wchanges-meaning.patch
  * resource-Wchanges-meaning.patch
  * string-hasher-flax-vector-conversions.patch
  * string_truncator-convert.patch
  * style_scope-unqualified-To.patch
  * to_vector-std-projected-gcc119888.patch
  * unexportable_key_service_impl-Wlto-type-mismatch.patch
  * xml_document_parser-Wmissing-template-keyword.patch
- merge remove-libphonenumber.patch & delete-old-language-detection-which-uses-tflite.patch
  into remove-ai-language-detection-factory-which-requires-tflite-and-libphonenumber.patch
- Revert upstream change which breaks build with old abseil
  * webrtc-make_ref_counted-absl2024-nullability.patch
- Conditionally (15.6) remove feature change which needs new spirv
  * angle-SPV_BINARY_TO_TEXT_OPTION_NESTED_INDENT.patch
- Use system sqlite in node (except 15.6)
  * system-sqlite.patch
- Remove more rust code
  * chromium-132-no-rust.patch
- Actually disable AVIF support without disabling AV1 video
  * disable-avif-really.patch
- Various other build fixes
  * absl_strings-missing-headers.patch
  * blink-shape_result-highway.patch
  * build-without-mesage-center.patch
  * fix-system-highway.patch
  * gn-logspam-breaks-install.patch
  * permission-gcc14.2.patch

OBS-URL: https://build.opensuse.org/request/show/1272836
OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/nodejs-electron?expand=0&rev=202
2025-04-26 10:14:41 +00:00

290 lines
12 KiB
Diff

From d617766b236a93749ddbb50b75573dd35238ffc9 Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Date: Fri, 29 Jan 2016 14:20:48 +0100
Subject: Fix building without WebSpeech
WebSpeech requires Google API keys, so we do not support it, and
disabling it also gets rid of libspeex and libFLAC.
Also splits speech recognition from speech synthesis, so we can
disable the former without disabling the latter.
Change-Id: I80a54ec4c6a13ea4c443289aa42369196c2e095a
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
---
chromium/content/browser/BUILD.gn | 56 ++++++++++++----------
.../content/browser/browser_interface_binders.cc | 10 ++++
chromium/content/browser/browser_main_loop.cc | 7 ++-
chromium/content/browser/browser_main_loop.h | 2 +
chromium/content/child/runtime_features.cc | 1 -
chromium/media/BUILD.gn | 1 +
chromium/media/media_options.gni | 2 +
7 files changed, 52 insertions(+), 27 deletions(-)
--- src/content/browser/BUILD.gn.orig 2024-12-08 18:44:00.234689649 +0100
+++ src/content/browser/BUILD.gn 2024-12-18 12:20:19.753578327 +0100
@@ -2134,13 +2134,6 @@ source_set("browser") {
"sms/user_consent_handler.h",
"sms/webotp_service.cc",
"sms/webotp_service.h",
- "speech/speech_recognition_dispatcher_host.cc",
- "speech/speech_recognition_dispatcher_host.h",
- "speech/speech_recognition_manager_impl.cc",
- "speech/speech_recognition_manager_impl.h",
- "speech/speech_recognition_session.cc",
- "speech/speech_recognition_session.h",
- "speech/speech_recognizer.h",
"speech/speech_synthesis_impl.cc",
"speech/speech_synthesis_impl.h",
"speech/tts_controller_impl.cc",
@@ -3340,13 +3333,6 @@ source_set("browser") {
"service_worker/service_worker_usb_delegate_observer.cc",
"service_worker/service_worker_usb_delegate_observer.h",
- # Most speech code is non-Android.
- "speech/network_speech_recognition_engine_impl.cc",
- "speech/network_speech_recognition_engine_impl.h",
- "speech/speech_recognition_engine.cc",
- "speech/speech_recognition_engine.h",
- "speech/speech_recognizer_impl.cc",
- "speech/speech_recognizer_impl.h",
"tracing/tracing_ui.cc",
"tracing/tracing_ui.h",
@@ -3397,10 +3383,8 @@ source_set("browser") {
"//components/soda:constants",
"//components/soda:soda",
"//components/soda:utils",
- "//components/speech:speech",
"//components/vector_icons",
"//components/webauthn/json",
- "//media/mojo/mojom:speech_recognition",
"//ui/base",
]
}
@@ -3471,6 +3455,37 @@ source_set("browser") {
deps += [ "//ui/compositor" ]
}
+ if (enable_web_speech) {
+ sources += [
+ "speech/audio_buffer.cc",
+ "speech/audio_buffer.h",
+ "speech/audio_encoder.cc",
+ "speech/audio_encoder.h",
+ "speech/chunked_byte_buffer.cc",
+ "speech/chunked_byte_buffer.h",
+ "speech/endpointer/endpointer.cc",
+ "speech/endpointer/endpointer.h",
+ "speech/endpointer/energy_endpointer.cc",
+ "speech/endpointer/energy_endpointer.h",
+ "speech/endpointer/energy_endpointer_params.cc",
+ "speech/endpointer/energy_endpointer_params.h",
+ "speech/speech_recognition_engine.cc",
+ "speech/speech_recognition_engine.h",
+ "speech/speech_recognizer_impl.cc",
+ "speech/speech_recognizer_impl.h",
+ "speech/speech_recognition_dispatcher_host.cc",
+ "speech/speech_recognition_dispatcher_host.h",
+ "speech/speech_recognition_manager_impl.cc",
+ "speech/speech_recognition_manager_impl.h",
+ "speech/speech_recognizer.h",
+ ]
+ deps += [
+ "//components/speech",
+ "//content/browser/speech/proto",
+ "//third_party/flac",
+ ]
+ }
+
if ((is_linux || is_chromeos) && use_dbus) {
deps += [ "//dbus" ]
}
-- src/content/browser/browser_interface_binders.cc.orig 2025-04-11 12:05:19.980351905 +0200
+++ src/content/browser/browser_interface_binders.cc 2025-04-11 19:48:15.944587282 +0200
@@ -61,7 +61,9 @@
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/service_worker/service_worker_host.h"
#include "content/browser/shared_storage/shared_storage_worklet_host.h"
+#if BUILDFLAG(ENABLE_WEB_SPEECH)
#include "content/browser/speech/speech_recognition_dispatcher_host.h"
+#endif
#include "content/browser/storage_access/storage_access_handle.h"
#include "content/browser/tracing/trace_report/trace_report.mojom.h"
#include "content/browser/tracing/trace_report/trace_report_internals_ui.h"
@@ -100,7 +102,9 @@
#include "media/mojo/mojom/media_metrics_provider.mojom.h"
#include "media/mojo/mojom/media_player.mojom.h"
#include "media/mojo/mojom/remoting.mojom.h"
+#if BUILDFLAG(ENABLE_WEB_SPEECH)
#include "media/mojo/mojom/speech_recognizer.mojom.h"
+#endif
#include "media/mojo/mojom/video_decode_perf_history.mojom.h"
#include "media/mojo/mojom/video_encoder_metrics_provider.mojom.h"
#include "media/mojo/mojom/webrtc_video_perf.mojom.h"
@@ -206,7 +210,9 @@
#else // BUILDFLAG(IS_ANDROID)
#include "content/browser/direct_sockets/direct_sockets_service_impl.h"
#include "media/mojo/mojom/renderer_extensions.mojom.h"
+#if BUILDFLAG(ENABLE_WEB_SPEECH)
#include "media/mojo/mojom/speech_recognition.mojom.h" // nogncheck
+#endif
#include "third_party/blink/public/mojom/hid/hid.mojom.h"
#include "third_party/blink/public/mojom/installedapp/installed_app_provider.mojom.h"
#include "third_party/blink/public/mojom/serial/serial.mojom.h"
@@ -865,11 +871,13 @@ void PopulateFrameBinders(RenderFrameHos
map->Add<blink::mojom::SharedWorkerConnector>(
base::BindRepeating(&BindSharedWorkerConnector, base::Unretained(host)));
+#if BUILDFLAG(ENABLE_WEB_SPEECH)
map->Add<media::mojom::SpeechRecognizer>(
base::BindRepeating(&SpeechRecognitionDispatcherHost::Create,
host->GetProcess()->GetDeprecatedID(),
host->GetRoutingID()),
GetIOThreadTaskRunner({}));
+#endif
map->Add<blink::mojom::SpeechSynthesis>(base::BindRepeating(
&RenderFrameHostImpl::GetSpeechSynthesis, base::Unretained(host)));
@@ -1197,6 +1205,7 @@ void PopulateBinderMapWithContext(
#if !BUILDFLAG(IS_ANDROID)
map->Add<blink::mojom::DirectSocketsService>(
base::BindRepeating(&DirectSocketsServiceImpl::CreateForFrame));
+#if BUILDFLAG(ENABLE_WEB_SPEECH)
map->Add<media::mojom::SpeechRecognitionContext>(base::BindRepeating(
&EmptyBinderForFrame<media::mojom::SpeechRecognitionContext>));
map->Add<media::mojom::SpeechRecognitionClientBrowserInterface>(
@@ -1208,6 +1217,7 @@ void PopulateBinderMapWithContext(
map->Add<media::mojom::MediaPlayerObserverClient>(base::BindRepeating(
&EmptyBinderForFrame<media::mojom::MediaPlayerObserverClient>));
#endif
+#endif
#if BUILDFLAG(ENABLE_UNHANDLED_TAP)
map->Add<blink::mojom::UnhandledTapNotifier>(base::BindRepeating(
&EmptyBinderForFrame<blink::mojom::UnhandledTapNotifier>));
diff --git a/chromium/content/browser/browser_main_loop.cc b/chromium/content/browser/browser_main_loop.cc
index aaa752bec61..b3a1ed50d20 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -87,7 +87,9 @@
#include "content/browser/screenlock_monitor/screenlock_monitor.h"
#include "content/browser/screenlock_monitor/screenlock_monitor_device_source.h"
#include "content/browser/sms/sms_provider.h"
+#if BUILDFLAG(ENABLE_WEB_SPEECH)
#include "content/browser/speech/speech_recognition_manager_impl.h"
+#endif
#include "content/browser/speech/tts_controller_impl.h"
#include "content/browser/startup_data_impl.h"
#include "content/browser/startup_task_runner.h"
@@ -1114,12 +1116,14 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
midi_service_->Shutdown();
}
+#if BUILDFLAG(ENABLE_WEB_SPEECH)
{
TRACE_EVENT0("shutdown",
"BrowserMainLoop::Subsystem:SpeechRecognitionManager");
io_thread_->task_runner()->DeleteSoon(
FROM_HERE, speech_recognition_manager_.release());
}
+#endif
TtsControllerImpl::GetInstance()->Shutdown();
@@ -1364,13 +1368,14 @@ void BrowserMainLoop::PostCreateThreadsImpl() {
media_stream_manager_ =
std::make_unique<MediaStreamManager>(audio_system_.get());
}
-
+#if BUILDFLAG(ENABLE_WEB_SPEECH)
{
TRACE_EVENT0("startup",
"BrowserMainLoop::PostCreateThreads:InitSpeechRecognition");
speech_recognition_manager_.reset(new SpeechRecognitionManagerImpl(
audio_system_.get(), media_stream_manager_.get()));
}
+#endif
{
TRACE_EVENT0("startup",
diff --git a/chromium/content/browser/browser_main_loop.h b/chromium/content/browser/browser_main_loop.h
index a8c8c6b5d16..7d92e0a701e 100644
--- a/content/browser/browser_main_loop.h
+++ b/content/browser/browser_main_loop.h
@@ -367,8 +367,10 @@ class CONTENT_EXPORT BrowserMainLoop {
std::unique_ptr<midi::MidiService> midi_service_;
+#if defined(ENABLE_WEB_SPEECH)
// Must be deleted on the IO thread.
std::unique_ptr<SpeechRecognitionManagerImpl> speech_recognition_manager_;
+#endif
#if BUILDFLAG(IS_WIN)
std::unique_ptr<media::SystemMessageWindowWin> system_message_window_;
diff --git a/chromium/content/child/runtime_features.cc b/chromium/content/child/runtime_features.cc
index 3a2e713ccc3..6af5afde20e 100644
--- a/content/child/runtime_features.cc
+++ b/content/child/runtime_features.cc
@@ -465,7 +465,6 @@ void SetRuntimeFeaturesFromCommandLine(const base::CommandLine& command_line) {
{wrf::EnablePushMessaging, switches::kDisableNotifications, false},
{wrf::EnableScriptedSpeechRecognition, switches::kDisableSpeechAPI,
false},
- {wrf::EnableScriptedSpeechSynthesis, switches::kDisableSpeechAPI, false},
{wrf::EnableScriptedSpeechSynthesis, switches::kDisableSpeechSynthesisAPI,
false},
{wrf::EnableSharedWorker, switches::kDisableSharedWorkers, false},
diff --git a/chromium/media/BUILD.gn b/chromium/media/BUILD.gn
index 01e0910666e..6ce78127e3f 100644
--- src/media/BUILD.gn 2025-04-11 12:05:21.244153535 +0200
+++ src/media/BUILD.gn 2025-04-11 19:48:51.764578046 +0200
@@ -61,6 +61,7 @@ buildflag_header("media_buildflags") {
"ENABLE_MSE_MPEG2TS_STREAM_PARSER=$enable_mse_mpeg2ts_stream_parser",
"PLATFORM_HAS_OPTIONAL_HEVC_DECODE_SUPPORT=$platform_has_optional_hevc_decode_support",
"PLATFORM_HAS_OPTIONAL_HEVC_ENCODE_SUPPORT=$platform_has_optional_hevc_encode_support",
+ "ENABLE_WEB_SPEECH=$enable_web_speech",
"USE_ARC_PROTECTED_MEDIA=$use_arc_protected_media",
"USE_CHROMEOS_MEDIA_ACCELERATION=$use_vaapi||$use_v4l2_codec",
"USE_CHROMEOS_PROTECTED_AV1=$use_chromeos_protected_av1",
diff --git a/chromium/media/media_options.gni b/chromium/media/media_options.gni
index 5667cac61f3..48ea95a99a6 100644
--- a/media/media_options.gni
+++ b/media/media_options.gni
@@ -66,6 +66,8 @@ declare_args() {
# kAllowClearDolbyVisionInMseWhenPlatformEncryptedDvEnabled.
enable_platform_encrypted_dolby_vision = proprietary_codecs && is_win
+ enable_web_speech = true
+
# Enable logging override, e.g. enable DVLOGs through level 2 at build time.
# On Cast devices, these are logged as INFO.
# When enabled on Fuchsia, these are logged as VLOGs.
--
cgit v1.2.1
--- src/components/speech/BUILD.gn.orig 2024-12-08 18:34:57.021340049 +0100
+++ src/components/speech/BUILD.gn 2024-12-18 12:18:14.187490208 +0100
@@ -6,12 +6,6 @@ import("//build/config/features.gni")
source_set("speech") {
sources = [
- "audio_buffer.cc",
- "audio_buffer.h",
- "audio_encoder.cc",
- "audio_encoder.h",
- "chunked_byte_buffer.cc",
- "chunked_byte_buffer.h",
"downstream_loader.cc",
"downstream_loader.h",
"downstream_loader_client.h",
@@ -27,7 +21,6 @@ source_set("speech") {
"//mojo/public/cpp/system",
"//services/network/public/cpp",
"//services/network/public/mojom",
- "//third_party/flac",
]
if (!is_android) {